cqpCow 1 년 전
부모
커밋
7872351848
1개의 변경된 파일6개의 추가작업 그리고 19개의 파일을 삭제
  1. 6 19
      app/Service/EmployeeService.php

+ 6 - 19
app/Service/EmployeeService.php

@@ -27,9 +27,6 @@ class EmployeeService extends Service
 
         $model = new Employee();
         $model = $model->where('id',$data['id'])->first();
-        $model->id_card = $data['id_card']??'';
-        $model->number = $data['number'] ;
-        $model->mobile = $data['mobile'];
         $model->emp_name = $data['emp_name'];
         $model->is_admin = $data['is_admin'];
         if($model->is_admin == 1){
@@ -47,16 +44,13 @@ class EmployeeService extends Service
         if(!$status) return [$status,$msg];
 
         $model = new Employee();
-        $model->id_card = $data['id_card']??'';
-        $model->number = $data['number'] ;
-        $model->mobile = $data['mobile'];
         $model->emp_name = $data['emp_name'];
         $model->state = 1;
         $model->crt_id = $user['id'];
         $model->is_admin = $data['is_admin'];
         if($model->is_admin == 1){
             $model->account = $data['account'];
-            $model->password   = Hash::make($data['password']);
+            $model->password = Hash::make($data['password']);
         }
         $model->save();
 
@@ -76,7 +70,7 @@ class EmployeeService extends Service
     public function employeeList($data,$user){
         $model = Employee::where('del_time',0)
             ->where('id','<>',Employee::SPECIAL_ADMIN)
-            ->select('account','upd_time','id','mark','crt_time','emp_name')
+            ->select('account','upd_time','id','crt_time','emp_name')
             ->orderBy('id','desc');
         if(! empty($data['account'])) $model->where('account', 'LIKE', '%'.$data['account'].'%');
         if(! empty($data['mark'])) $model->where('mark', 'LIKE', '%'.$data['mark'].'%');
@@ -122,26 +116,19 @@ class EmployeeService extends Service
         return $data;
     }
 
-
     public function employeeRule($data,$is_add = true){
-        if($this->isEmpty($data,'number')) return [false,'工号不存在!'];
-        if($this->isEmpty($data,'mobile')) return [false,'手机号不存在!'];
         if($this->isEmpty($data,'emp_name')) return [false,'姓名不存在!'];
+        if($this->isEmpty($data,'is_admin')) return [false,'是否登陆账号不能为空!'];
+
         if(! $is_add){
             if($this->isEmpty($data,'id')) return [false,'ID不能为空!'];
-            $bool = Employee::where('number',$data['number'])
-                ->where('id','<>',$data['id'])
-                ->where('del_time',0)->exists();
             $bool_account = Employee::where('account',$data['account'])
                 ->where('id','<>',$data['id'])
                 ->where('del_time',0)->exists();
         }else{
-            $bool = Employee::where('number',$data['number'])
-                ->where('del_time',0)->exists();
-            $bool_account = Employee::where('account',$data['account'])
-                ->where('del_time',0)->exists();
+            $bool_account = Employee::where('account',$data['account'])->where('del_time',0)->exists();
         }
-        if($bool) return [false,'工号已存在!'];
+
         if($bool_account) return [false,'账号已存在!'];
 
         return [true,''];