afa hai 5 meses
pai
achega
63f2b6b78a
Modificáronse 1 ficheiros con 11 adicións e 4 borrados
  1. 11 4
      application/api/logic/CommonLogic.php

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

@@ -32,13 +32,20 @@ class CommonLogic
                   $teamCount = UserModel::where('parent_id', $user_id)->where('team_level_id', $team_level_id)->count();
                   //组合套数
                   $groupCount = UserPledge::getPledgeCount($user_id) + $num;
-                  if($teamCount >= $config[$team_level_id]['direct'] && $groupCount >= $config[$team_level_id]['num']){
+
+                  if($team_level_id == 1 && ($groupCount == 0 || $address_level < $config[0]['direct'])){
                         $result = true;
-                        $team_level_id += 1; //+1
+                        $team_level_id = 0;
                   }else{
-                        $result = true;
-                        $team_level_id -=1; //-1
+                        if($teamCount >= $config[$team_level_id]['direct'] && $groupCount >= $config[$team_level_id]['num']){
+                              $result = true;
+                              $team_level_id += 1; //+1
+                        }else{
+                              $result = true;
+                              $team_level_id -=1; //-1
+                        }
                   }
+                  
             }
             return $result? UserModel::where('id', $user_id)->update(['team_level_id'=> $team_level_id]): false;
       }