소스 검색

改一下bug

gogs 2 달 전
부모
커밋
4b1d1096f1
1개의 변경된 파일8개의 추가작업 그리고 4개의 파일을 삭제
  1. 8 4
      app/Service/StatisticService.php

+ 8 - 4
app/Service/StatisticService.php

@@ -1175,11 +1175,15 @@ class StatisticService extends Service
 
             // 如果不是最后一条
             $key = $item['employee_id'] . '_' . $item['month'];
-            if (--$employee_count[$key] > 0) {
-                $all_salary[$key] -= $item['allocated_salary'];
-            } else {
-                $item['allocated_salary'] = $all_salary[$key];
+            if(!isset($employee_count[$key]))  $item['allocated_salary'] = 0;
+            else {
+                if (--$employee_count[$key] > 0) {
+                    $all_salary[$key] -= $item['allocated_salary'];
+                } else {
+                    $item['allocated_salary'] = $all_salary[$key];
+                }
             }
+
             return $item;
         })->all();
         $return_item_list = [];