WIN-2308041133\Administrator 2 weeks ago
parent
commit
12c4be001c
1 changed files with 9 additions and 1 deletions
  1. 9 1
      app/models/system/SystemUserTask.php

+ 9 - 1
app/models/system/SystemUserTask.php

@@ -202,6 +202,12 @@ class SystemUserTask extends BaseModel
 
         $max = 0;
         $team_achievement=0;
+        $teamUids = UserController::getAllTeamMembers($uid);  //获取团队所有成员
+        $team_achievement = 0;
+        if (!empty($teamUids)) {
+            $team_achievement = User::whereIn('uid', $teamUids)
+                ->sum('achievement');
+        }
         if (!empty($directSubordinateUids)) {
             @file_put_contents('quanju.txt', json_encode($directSubordinateUids) . "-直属下级uid\r\n", 8);
             foreach ($directSubordinateUids as $key => $value){
@@ -210,13 +216,15 @@ class SystemUserTask extends BaseModel
                 if (!empty($teamUids)) {
                     $personal_achievement = User::whereIn('uid', $teamUids)
                         ->sum('achievement');
-                    $team_achievement += $personal_achievement;
+//                    $team_achievement += $personal_achievement;
                     if ($personal_achievement > $max){  //获取最高消费团队
                         $max = $personal_achievement;
                     }
                 }
             }
         }
+        @file_put_contents('quanju.txt', $max . "-大区业绩\r\n", 8);
+
         $community_achievement = bcsub($team_achievement, $max, 2);  //小区消费
         @file_put_contents('quanju.txt', $team_achievement . "-总消费\r\n", 8);
         @file_put_contents('quanju.txt', $max . "-大区消费\r\n", 8);