Browse Source

小高薪

cqp 3 months ago
parent
commit
1e1e1b3363
1 changed files with 12 additions and 13 deletions
  1. 12 13
      app/Service/EmployeeService.php

+ 12 - 13
app/Service/EmployeeService.php

@@ -58,16 +58,16 @@ class EmployeeService extends Service
             DB::beginTransaction();
             DB::beginTransaction();
             $model = new Employee();
             $model = new Employee();
             $model = $model->where('id',$data['id'])->first();
             $model = $model->where('id',$data['id'])->first();
-            $model->number = $data['number'];
-            $model->title = $data['title'];
-            $model->mobile = $data['mobile'];
+            $model->number = $data['number'] ?? "";
+            $model->title = $data['title'] ?? "";
+            $model->mobile = $data['mobile'] ?? "";
             $model->sex = $data['sex'] ?? 0;
             $model->sex = $data['sex'] ?? 0;
             $model->education = $data['education'] ?? "";
             $model->education = $data['education'] ?? "";
-            $model->id_card = $data['id_card'];
+            $model->id_card = $data['id_card'] ?? "";
             $model->major = $data['major'] ?? "";
             $model->major = $data['major'] ?? "";
             $model->p_title = $data['p_title'] ?? "";
             $model->p_title = $data['p_title'] ?? "";
-            $model->state = $data['state'];
-            $model->is_admin = $data['is_admin'];
+            $model->state = $data['state'] ?? 0;
+            $model->is_admin = $data['is_admin'] ?? 0;
             if($model->is_admin && $data['password'] !== '******') {
             if($model->is_admin && $data['password'] !== '******') {
                 $model->password = Hash::make($data['password']);
                 $model->password = Hash::make($data['password']);
                 $model->p_version = $model->p_version + 1;
                 $model->p_version = $model->p_version + 1;
@@ -118,18 +118,17 @@ class EmployeeService extends Service
         try{
         try{
             DB::beginTransaction();
             DB::beginTransaction();
             $model = new Employee();
             $model = new Employee();
-
-            $model->number = $data['number'];
-            $model->title = $data['title'];
-            $model->mobile = $data['mobile'];
+            $model->number = $data['number'] ?? "";
+            $model->title = $data['title'] ?? "";
+            $model->mobile = $data['mobile'] ?? "";
             $model->sex = $data['sex'] ?? 0;
             $model->sex = $data['sex'] ?? 0;
             $model->education = $data['education'] ?? "";
             $model->education = $data['education'] ?? "";
-            $model->id_card = $data['id_card'];
+            $model->id_card = $data['id_card'] ?? "";
             $model->major = $data['major'] ?? "";
             $model->major = $data['major'] ?? "";
             $model->p_title = $data['p_title'] ?? "";
             $model->p_title = $data['p_title'] ?? "";
-            $model->state = $data['state'];
+            $model->state = $data['state'] ?? 0;
             $model->crt_id = $user['id'];
             $model->crt_id = $user['id'];
-            $model->is_admin = $data['is_admin'];
+            $model->is_admin = $data['is_admin'] ?? 0;
             $model->account = $data['account'] ?? "";
             $model->account = $data['account'] ?? "";
             if($model->is_admin) $model->password = Hash::make($data['password']);
             if($model->is_admin) $model->password = Hash::make($data['password']);
             $model->top_depart_id = $data['top_depart_id'];
             $model->top_depart_id = $data['top_depart_id'];