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