Explorar o código

Merge branch 'master' of https://git.bjtdba.com/shop/php

xialei hai 1 ano
pai
achega
5b076c0ef3
Modificáronse 1 ficheiros con 34 adicións e 36 borrados
  1. 34 36
      app/controller/api/store/merchant/Taskorder.php

+ 34 - 36
app/controller/api/store/merchant/Taskorder.php

@@ -1366,10 +1366,11 @@ function getRecursiveChildren($parentUid) {
1366 1366
 //获取大小部门业绩(新表小标0是大部门,下标1是小部门)
1367 1367
 public function getbig_samll_datas($user_id) {
1368 1368
 
1369
-    $common_nums = $this->getCommonNums($user_id);
1370
-      $child_nums = [];
1369
+         $common_nums = $this->getCommonNums($user_id);
1370
+         $child_nums = [];
1371 1371
          $result_big_team_arr = [];
1372
-      $get_teams_comm_pv=0;
1372
+         $get_teams_per_pv = [];//获取当前用户在2.0中小部门的总业绩
1373
+         $get_teams_comm_pv=0;
1373 1374
         //1.0系统中有下级,需要在2.0中再加下级数据
1374 1375
         if($user_id < 611){
1375 1376
           
@@ -1391,53 +1392,50 @@ public function getbig_samll_datas($user_id) {
1391 1392
             foreach ($filteredData as $array) {
1392 1393
                 $result_big_team_arr = array_merge($result_big_team_arr, $array);
1393 1394
             }
1394
-             var_dump($result_big_team_arr);
1395
+            // var_dump($result_big_team_arr);
1395 1396
             //获取当前用户下面在2.0中的下级所有PV
1396 1397
             $get_teams_comm_pv = $this->getteampv($result_big_team_arr);
1397
-        }
1398 1398
 
1399
-    var_dump($get_teams_comm_pv);
1400
-return;
1401 1399
 
1402
-    // 单独写一个方法获取大小部门的数据
1403
-    $arr_team = [];
1404
-    foreach ($subordinate_members as $k => $v) {
1405
-        // 计算自己和旗下的业绩
1406
-        $arr_team[] = $this->calculatePerformance($v['uid']);
1407
-    }
1408 1400
 
1409
-    // 初始化变量
1410
-    $maxPerformance = 0;
1411
-    $maxIndex = -1;
1401
+            //获取当前用户在2.0中小区的业绩
1402
+            $person_nums = $this->getPersonageNums($user_id);
1403
+           
1404
+            $result_small_team_arr = [];
1405
+            //用户三峡所有在2.0系统下面的业绩和人数 start
1406
+            $child_nums_mix = [];
1407
+              //获取当前用户
1408
+            foreach($person_nums as $v){
1409
+                $child_nums_mix[] = $this->getRecursiveChildren($v);
1410
+            }
1411
+         
1412
+            //去除空数组,并重新组合有数据的数组
1413
+            $filteredData_1 = array_filter($child_nums_mix, function($array) {
1414
+                return !empty($array); // 如果数组不为空,则保留
1415
+            });
1416
+            
1417
+            // 合并所有非空数组
1418
+            $result_small_team_arr = [];
1419
+            foreach ($filteredData_1 as $array) {
1420
+                $result_small_team_arr = array_merge($result_small_team_arr, $array);
1421
+            }
1422
+             // var_dump($result_small_team_arr);
1423
+            //获取当前用户下面在2.0中的下级所有PV
1424
+            $get_teams_per_pv = $this->getteampv($result_small_team_arr);
1412 1425
 
1413
-    // 找出 total_performance 最高的记录
1414
-    foreach ($arr_team as $index => $item) {
1415
-        if ($item['total_performance'] > $maxPerformance) {
1416
-            $maxPerformance = $item['total_performance'];
1417
-            $maxIndex = $index;
1426
+            //获取当前用户在2.0中小区的业绩 end
1418 1427
         }
1419
-    }
1420 1428
 
1421
-    // 如果找到了最高记录
1422
-    if ($maxIndex !== -1) {
1423
-        // 提取最高记录
1424
-        $maxRecord = $arr_team[$maxIndex];
1425
-        // 从原数组中移除该记录
1426
-        unset($arr_team[$maxIndex]);
1427
-        // 重新索引数组
1428
-        $arr_team = array_values($arr_team);
1429
-    } else {
1430
-        // 如果没有找到记录,可以设置一个默认值
1431
-        $maxRecord = null;
1432
-    }
1429
+    //var_dump($get_teams_per_pv);
1430
+
1433 1431
 
1434 1432
     // 计算大部门和小部门的汇总信息
1435 1433
     $majorDepartmentSummary = [
1436
-        "total_performance" => $maxRecord ? $maxRecord['total_performance'] : 0,
1434
+        "total_performance" =>  $get_teams_comm_pv,
1437 1435
     ];
1438 1436
 
1439 1437
     $minorDepartmentSummary = [
1440
-        "total_performance" => array_sum(array_column($arr_team, 'total_performance')),
1438
+        "total_performance" => $get_teams_per_pv,
1441 1439
     ];
1442 1440
 
1443 1441
     // 返回所需的结果