afa 5 сар өмнө
parent
commit
4175d6d3bf

+ 2 - 1
application/api/logic/CommonLogic.php

@@ -66,7 +66,8 @@ class CommonLogic
                   $income = bcmul($num, config('team_level_inc'), 2);
                   $income = bcmul($num, config('team_level_inc'), 2);
                   //余额记录
                   //余额记录
                   foreach($paths as $pathId){
                   foreach($paths as $pathId){
-                        Loader::model('LedgerWalletModel')->changeWalletAccount($pathId, $asset, $income, $action, $user_id);
+
+                        Loader::model('LedgerWalletModel')->changeWalletAccount($pathId, $asset, $income, $action, $user_id, true);
                   }
                   }
             }
             }
             return true;
             return true;

+ 3 - 1
application/common/model/LedgerWalletModel.php

@@ -74,12 +74,14 @@ class LedgerWalletModel extends Model
      * @param string $asset 资产类型
      * @param string $asset 资产类型
      * @param string $amount 金额 正:表示加 负:表示减
      * @param string $amount 金额 正:表示加 负:表示减
      * @param int $action 账变类型
      * @param int $action 账变类型
+     * @param bool $team_level 层级账变
      * @return void
      * @return void
      * @throws Exception
      * @throws Exception
      */
      */
-    public function changeWalletAccount(int $uid, string $asset, string $amount, int $action, int $from_id = 0)
+    public function changeWalletAccount(int $uid, string $asset, string $amount, int $action, int $from_id = 0, bool $team_level = false)
     {
     {
         $available = $this->getWallet($uid);
         $available = $this->getWallet($uid);
+        if($team_level && empty($available['team_level_id'])) return;
         if (empty($available)) (new LedgerWalletModel())->insertGetId(['user_id' => $uid]);  // 创建钱包
         if (empty($available)) (new LedgerWalletModel())->insertGetId(['user_id' => $uid]);  // 创建钱包
         // 账变资产模型
         // 账变资产模型
         switch ($asset) {
         switch ($asset) {