afa 4 сар өмнө
parent
commit
048cd13fcb

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

@@ -104,7 +104,7 @@ class Pledge extends Api
             $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);
+            if($pledge->type_id == 2) CommonLogic::setIsUpLevel($this->auth->id, $this->auth->team_level_id);
             // 提交事务
             Db::commit();
         } catch (Exception $e) {

+ 11 - 14
application/api/logic/CommonLogic.php

@@ -17,20 +17,21 @@ class CommonLogic
 {
 
       // 升级
-      public static function setIsUpLevel(int $user_id, int $team_level_id, int $address_level): bool
+      public static function setIsUpLevel(int $user_id, int $team_level_id): bool
       {
             $config = config('team_level_where');
             if($team_level_id == count($config)) return false;
             $result = false;
+            //组合套数
+            $groupCount = UserPledge::getPledgeCount($user_id) + 1;
             if($team_level_id == 0){
-                  if($address_level >= $config[$team_level_id]['direct']) {
+                  if($groupCount >= $config[$team_level_id]['num']) {
                         $result = true;
                         $team_level_id += 1;
                         self::setIsUpLevelParent($user_id, $config);
                   }
             }else{
-                  //组合套数
-                  $groupCount = UserPledge::getPledgeCount($user_id) + 1;
+              
                   //直推
                   $teamCount = UserModel::where('parent_id', $user_id)->where('team_level_id','>=', $team_level_id)->count();
                   if($teamCount >= $config[$team_level_id]['direct'] && $groupCount >= $config[$team_level_id]['num']){
@@ -51,7 +52,7 @@ class CommonLogic
             foreach ($pathId as $item) 
             {
                   $parent = $userModel::where('id', $item)->find();
-                  if($parent->team_level_id > 0 && $parent->team_level_id < 5){
+                  if($parent->team_level_id > 0 && $parent->team_level_id < 3){
                         //推广人数
                         $teamCount = $userModel::where('parent_id', $item)->where('team_level_id', '>=',$parent->team_level_id)->count() +1;
                         //组合套数
@@ -66,13 +67,13 @@ class CommonLogic
 
 
       //降级
-      public static  function setIsOuLevelSave($user_id,  $team_level_id, $address_level)
+      public static  function setIsOuLevelSave($user_id,  $team_level_id)
       {
             $config = config('team_level_where');
             $result = false;
             //组合套数
             $groupCount = UserPledge::getPledgeCount($user_id) -1;
-            if($team_level_id == 1 && ($groupCount == 0 || $address_level < $config[0]['direct'])){
+            if($team_level_id == 1 && $groupCount < $config[0]['num']){
                   $result = true;
                   $team_level_id = 0;
                   self::setIsOuLevelParent($user_id, $config);
@@ -127,15 +128,11 @@ class CommonLogic
             //分享 1 个拿 3 层,分享 2 个拿 7 层
             foreach ($parents_info as $parent){
                   $send_user_id = 0;  //需要发放的会员ID列表
-                  if($parent['team_level_id'] >= 1 && $parent['distance'] <= 3){
-                        $send_user_id = $parent['id'];
-                  }else if($parent['team_level_id'] >= 2 && $parent['distance'] <= 7){
-                        $send_user_id = $parent['id'];
-                  }else if($parent['team_level_id'] >= 3 && $parent['distance'] <= 13){
+                  if($parent['team_level_id'] >= 1 && $parent['distance'] <= 1){
                         $send_user_id = $parent['id'];
-                  }else if($parent['team_level_id'] >= 4 && $parent['distance'] <= 21){
+                  }else if($parent['team_level_id'] >= 2 && $parent['distance'] <= 2){
                         $send_user_id = $parent['id'];
-                  }else if($parent['team_level_id'] >= 5 && $parent['distance'] <= 31){
+                  }else if($parent['team_level_id'] >= 3 && $parent['distance'] <= 3){
                         $send_user_id = $parent['id'];
                   }
                   if($send_user_id > 0)  Loader::model('LedgerWalletModel')->changeWalletAccount($send_user_id, $asset, $income, $action, $user_id);

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

@@ -146,7 +146,7 @@ class PledgeLogic
         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);
+        if($rows->type_id == 2) CommonLogic::setIsOuLevelSave($user_id, $team_level_id);
         $rows->last_time = $time;
         return  $rows->save();   
     }

+ 4 - 5
application/config.php

@@ -386,11 +386,10 @@ return [
     ],
     //团队等级收益条件
     'team_level_where' => [
-        0 => ['direct'=>3,'num'=>1, 'level'=>3],  //1级:黄金地址等级3,组合*1 上级3层发放收益
-        1 => ['direct'=>7,'num'=>2, 'level'=>7],  //2级:直推7个V1,组合*2 上级7层发放收益
-        2 => ['direct'=>7,'num'=>3, 'level'=>13],  //3级:直推7个V2,组合*3 上级13层发放收益
-        3 => ['direct'=>5,'num'=>4, 'level'=>21],  //4级:直推5个V3,组合*4 上级21层发放收益
-        4 => ['direct'=>3,'num'=>5, 'level'=>31],  //5级:直推3个V4,组合*5 上级31层发放收益
+        0 => ['direct'=>0,'num'=>3, 'level'=>1],  //1级:组合挖矿*3, 上级1层发放收益
+        1 => ['direct'=>7,'num'=>5, 'level'=>2],  //2级:直推7个V1,组合*2 上级2层发放收益
+        2 => ['direct'=>7,'num'=>9, 'level'=>3],  //3级:直推7个V2,组合*3 上级3层发放收益
+    
     ],
     //团队等级收益
     'team_level_inc' => 0.01,