cqpCow преди 11 месеца
родител
ревизия
cb215d1822
променени са 1 файла, в които са добавени 3 реда и са изтрити 2 реда
  1. 3 2
      app/Service/EmployeeService.php

+ 3 - 2
app/Service/EmployeeService.php

@@ -814,7 +814,7 @@ class EmployeeService extends Service
         foreach ($data['data'] as $value){
             if(empty($value['parent_id']) && ! empty($value['is_main'])) $count ++;
         }
-        if($count > 1) return [false,'顶级总社只允许存在一个!'];
+        if($count > 1) return [false,'总社已存在!'];
         if($count == 1){
             $id = $data['id'] ?? 0;
             $bool = Depart::where('del_time',0)
@@ -824,7 +824,7 @@ class EmployeeService extends Service
                     return $query->where('id', '<>',$id);
                 })
                 ->exists();
-            if($bool) return [false,'顶级总社只允许存在一个!'];
+            if($bool) return [false,'总社已存在!'];
         }
 
         foreach ($data['data'] as $key => $value){
@@ -841,6 +841,7 @@ class EmployeeService extends Service
                     ->exists();
             }else{
                 if($this->isEmpty($data,'id')) return [false,'id不能为空!'];
+                if($data['id'] == $user['head']['id'] && empty($data['is_main'])) return [false,'总社不支持变更!'];
                 $bool = Depart::whereRaw("binary code = '{$value['code']}'")
                     ->where('id','<>',$data['id'])
                     ->where('del_time',0)