cqpCow %!s(int64=2) %!d(string=hai) anos
pai
achega
ae4b4d988d
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  1. 2 1
      app/Service/EmployeeService.php

+ 2 - 1
app/Service/EmployeeService.php

@@ -185,7 +185,7 @@ class EmployeeService extends Service
 //        if($this->isEmpty($data,'title')) return [201,'名称不存在!'];
         list($status,$msg) = $this->departRule($data);
         if(!$status) return [$status,$msg];
-        $first = Depart::where('title',$data['title'])->where('id','<>',$data['id'])->where('del_time',0)->first();
+        $first = Depart::where('title',$data['title'])->where('del_time',0)->first();
         if(!empty($first))return [false,'名称已存在!'];
 
         $model = new Depart();
@@ -219,6 +219,7 @@ class EmployeeService extends Service
 
     public function departRule($data){
         if($this->isEmpty($data,'title')) return [false,'名称不存在!'];
+        if($this->isEmpty($data,'code')) return [false,'编码不存在!'];
 
         return [true,''];
     }