浏览代码

升级降级

afa 5 月之前
父节点
当前提交
63f2b6b78a
共有 1 个文件被更改,包括 11 次插入4 次删除
  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();
                   $teamCount = UserModel::where('parent_id', $user_id)->where('team_level_id', $team_level_id)->count();
                   //组合套数
                   //组合套数
                   $groupCount = UserPledge::getPledgeCount($user_id) + $num;
                   $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;
                         $result = true;
-                        $team_level_id += 1; //+1
+                        $team_level_id = 0;
                   }else{
                   }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;
             return $result? UserModel::where('id', $user_id)->update(['team_level_id'=> $team_level_id]): false;
       }
       }