cqp 1 mês atrás
pai
commit
46b4f84ff3
1 arquivos alterados com 4 adições e 1 exclusões
  1. 4 1
      app/Service/EmployeeService.php

+ 4 - 1
app/Service/EmployeeService.php

@@ -72,6 +72,7 @@ class EmployeeService extends Service
 
             if(! empty($data['index_array'])){
                 EmployeeIndex::where('del_time',0)
+                    ->where('employee_id', $data['id'])
                     ->update(['del_time' => $time]);
                 EmployeeIndex::insert($data['index_array']);
             }
@@ -306,7 +307,7 @@ class EmployeeService extends Service
      * @param $is_add
      * @return array
      */
-    public function employeeRule($data,$is_add = true){
+    public function employeeRule(&$data, $is_add = true){
         if(! empty($data['index_array'])){
             $typeIntervals = []; // 用于收集每个 type 的时间区间,用于后续不相交校验
             foreach ($data['index_array'] as $key => $value){
@@ -318,6 +319,8 @@ class EmployeeService extends Service
                 $data['index_array'][$key]['start_time'] = $start_time;
                 $data['index_array'][$key]['end_time'] = $end_time;
                 $data['index_array'][$key]['employee_id'] = $data['id'];
+                $data['index_array'][$key]['mark'] = $value['mark'] ?? "";
+                unset($data['index_array'][$key]['crt_time']);
                 if ($start_time === null || $end_time === null || $start_time > $end_time) return [false, $name . ":时间区间无效"];
                 // 收集每个 type 的时间区间,用于后续不相交校验
                 $type = $value['type'];