afa hai 5 meses
pai
achega
eebc64a485

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

@@ -81,7 +81,7 @@ class Pledge extends Api
       {
 
 
-          //  dump(CommonLogic::setIsUpLevel(1477, 0, 3));die;
+        //dump(CommonLogic::setIsUpLevel(1477, 0, 3));die;
         $pledge_id  = $this->request->post('pledge_id', 0, 'intval');
         $order_id   = $this->request->post('order_id/a', '');
         $pay_type   = $this->request->post('pay_type/d', 1);//支付方式 1 茶宝 2 Teac

+ 5 - 6
application/api/logic/CommonLogic.php

@@ -32,7 +32,7 @@ class CommonLogic
                   //组合套数
                   $groupCount = UserPledge::getPledgeCount($user_id) + 1;
                   //直推
-                  $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();
                   if($teamCount >= $config[$team_level_id]['direct'] && $groupCount >= $config[$team_level_id]['num']){
                         $result = true;
                         $team_level_id += 1; //+1
@@ -53,7 +53,7 @@ class CommonLogic
                   $parent = $userModel::where('id', $item)->find();
                   if($parent->team_level_id > 0){
                         //推广人数
-                        $teamCount = $userModel::where('parent_id', $item)->where('team_level_id', $parent->team_level_id)->count() +1;
+                        $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']){
@@ -71,16 +71,15 @@ class CommonLogic
             $config = config('team_level_where');
             $result = false;
             //组合套数
-            $groupCount = UserPledge::getPledgeCount($user_id) -1 ;
+            $groupCount = UserPledge::getPledgeCount($user_id) -1;
             if($team_level_id == 1 && ($groupCount == 0 || $address_level < $config[0]['direct'])){
                   $result = true;
                   $team_level_id = 0;
                   self::setIsOuLevelParent($user_id, $config);
             }
-
             if($team_level_id > 1){
                   //直推
-                  $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()-1;
                   if($teamCount < $config[$team_level_id]['direct'] && $groupCount < $config[$team_level_id]['num']){
                         $result = true;
                         $team_level_id -= 1;
@@ -100,7 +99,7 @@ class CommonLogic
                   $parent = $userModel::where('id', $item)->find();
                   if($parent->team_level_id > 0){
                         //推广人数
-                        $teamCount = $userModel::where('parent_id', $item)->where('team_level_id', $parent->team_level_id)->count()-1;
+                        $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']){

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

@@ -104,6 +104,7 @@ class PledgeLogic
     //解除质抵押订单
     public static function setPledgeRemove(int $pledge_id, string $order_id, int $user_id, $team_level_id, $address_level)
     {
+        
         $model  = Loader::model('UserPledge');
         $time  = time();
         $rows   = $model::alias('a')