浏览代码

组合质押

afa 5 月之前
父节点
当前提交
4cf8df641e

+ 2 - 2
application/api/controller/Pledge.php

@@ -103,7 +103,7 @@ class Pledge extends Api
             $res = $pledgeLogic::setPledgeOrder($pledge, $order_id, $this->auth->id, $count, $this->pay[$pay_type], $pledge[$this->pay[$pay_type]]);
             $res = $pledgeLogic::setPledgeOrder($pledge, $order_id, $this->auth->id, $count, $this->pay[$pay_type], $pledge[$this->pay[$pay_type]]);
 
 
             //组合质押
             //组合质押
-            if($pledge->type_id == 2) CommonLogic::setIsUpLevel($this->auth->id, $this->auth->team_level_id, $this->auth->address_level, $this->auth->parent_id);
+            if($pledge->type_id == 2) CommonLogic::setIsUpLevel($this->auth->id, $this->auth->team_level_id, $this->auth->address_level);
             // 提交事务
             // 提交事务
             Db::commit();
             Db::commit();
         } catch (Exception $e) {
         } catch (Exception $e) {
@@ -168,7 +168,7 @@ class Pledge extends Api
             Db::startTrans();
             Db::startTrans();
             try {
             try {
                   // 质抵押订单 
                   // 质抵押订单 
-                  $res = $pledgeLogic::setPledgeRemove($pledge_id, $order_id, $this->auth->id, $this->auth->team_level_id, $this->auth->address_level, $this->auth->parent_id);
+                  $res = $pledgeLogic::setPledgeRemove($pledge_id, $order_id, $this->auth->id, $this->auth->team_level_id, $this->auth->address_level);
 
 
                   // 提交事务
                   // 提交事务
                   Db::commit();
                   Db::commit();

+ 4 - 4
application/api/logic/CommonLogic.php

@@ -17,7 +17,7 @@ class CommonLogic
 {
 {
 
 
       // 升级
       // 升级
-      public static function setIsUpLevel(int $user_id, int $team_level_id, int $address_level, int $parent_id): bool
+      public static function setIsUpLevel(int $user_id, int $team_level_id, int $address_level): bool
       {
       {
             $config = config('team_level_where');
             $config = config('team_level_where');
             if($team_level_id == count($config)) return false;
             if($team_level_id == count($config)) return false;
@@ -66,7 +66,7 @@ class CommonLogic
 
 
 
 
       //降级
       //降级
-      public static  function setIsOuLevelSave($user_id,  $team_level_id, $address_level, $parent_id)
+      public static  function setIsOuLevelSave($user_id,  $team_level_id, $address_level)
       {
       {
             $config = config('team_level_where');
             $config = config('team_level_where');
             $result = false;
             $result = false;
@@ -75,7 +75,7 @@ class CommonLogic
             if($team_level_id == 1 && ($groupCount == 0 || $address_level < $config[0]['direct'])){
             if($team_level_id == 1 && ($groupCount == 0 || $address_level < $config[0]['direct'])){
                   $result = true;
                   $result = true;
                   $team_level_id = 0;
                   $team_level_id = 0;
-                  self::setIsOuLevelParent($parent_id, $config);
+                  self::setIsOuLevelParent($user_id, $config);
             }
             }
 
 
             if($team_level_id > 1){
             if($team_level_id > 1){
@@ -84,7 +84,7 @@ class CommonLogic
                   if($teamCount < $config[$team_level_id]['direct'] && $groupCount < $config[$team_level_id]['num']){
                   if($teamCount < $config[$team_level_id]['direct'] && $groupCount < $config[$team_level_id]['num']){
                         $result = true;
                         $result = true;
                         $team_level_id -= 1;
                         $team_level_id -= 1;
-                        self::setIsOuLevelParent($parent_id, $config);
+                        self::setIsOuLevelParent($user_id, $config);
                   }
                   }
             }
             }
             return $result? UserModel::where('id', $user_id)->update(['team_level_id'=> $team_level_id]): false;
             return $result? UserModel::where('id', $user_id)->update(['team_level_id'=> $team_level_id]): false;

+ 2 - 2
application/api/logic/PledgeLogic.php

@@ -102,7 +102,7 @@ class PledgeLogic
     }
     }
 
 
     //解除质抵押订单
     //解除质抵押订单
-    public static function setPledgeRemove(int $pledge_id, string $order_id, int $user_id, $team_level_id, $address_level, $parent_id)
+    public static function setPledgeRemove(int $pledge_id, string $order_id, int $user_id, $team_level_id, $address_level)
     {
     {
         $model  = Loader::model('UserPledge');
         $model  = Loader::model('UserPledge');
         $time  = time();
         $time  = time();
@@ -142,7 +142,7 @@ class PledgeLogic
         Loader::model('ProductOrder')::where('user_id', $user_id)->whereIn('id', $orderId)->setField('status', ProductOrder::Paid);
         Loader::model('ProductOrder')::where('user_id', $user_id)->whereIn('id', $orderId)->setField('status', ProductOrder::Paid);
 
 
         //
         //
-        if($rows->type_id == 2) CommonLogic::setIsOuLevelSave($user_id, $team_level_id, $address_level, $parent_id);
+        if($rows->type_id == 2) CommonLogic::setIsOuLevelSave($user_id, $team_level_id, $address_level);
         //更新领取状态
         //更新领取状态
         $rows->last_time = $time;
         $rows->last_time = $time;
         return  $rows->save();   
         return  $rows->save();