afa 4 mesiacov pred
rodič
commit
2391000c9c
1 zmenil súbory, kde vykonal 2 pridanie a 4 odobranie
  1. 2 4
      application/api/logic/CommonLogic.php

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

@@ -20,7 +20,6 @@ class CommonLogic
       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;
             //组合套数
@@ -32,7 +31,6 @@ class CommonLogic
                         self::setIsUpLevelParent($user_id, $config);
                   }
             }else{
-              
                   //直推
                   $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']){
@@ -82,7 +80,7 @@ class CommonLogic
             if($team_level_id > 1){
                   //直推
                   $teamCount = UserModel::where('parent_id', $user_id)->where('team_level_id','>=', $team_level_id)->count()-1;
-                  if($teamCount < $config[$team_level_id]['direct'] && $groupCount < $config[$team_level_id]['num']){
+                  if($teamCount < $config[$team_level_id-1]['direct'] && $groupCount < $config[$team_level_id-1]['num']){
                         $result = true;
                         $team_level_id -= 1;
                         self::setIsOuLevelParent($user_id, $config);
@@ -104,7 +102,7 @@ class CommonLogic
                         $teamCount = $userModel::where('parent_id', $item)->where('team_level_id', '>=',$parent->team_level_id)->count()-1;
                         //组合套数
                         $groupCount = $userPledge::getPledgeCount($item);
-                        if($teamCount < $config[$parent->team_level_id]['direct'] || $groupCount < $config[$parent->team_level_id]['num']){
+                        if($teamCount < $config[$parent->team_level_id-1]['direct'] || $groupCount < $config[$parent->team_level_id-1]['num']){
                               $parent->team_level_id -=1;
                               $parent->save();
                         }