作者 lyh

更新人事信息

@@ -39,7 +39,8 @@ class HrLogic extends BaseLogic @@ -39,7 +39,8 @@ class HrLogic extends BaseLogic
39 * @time :2023/9/6 10:17 39 * @time :2023/9/6 10:17
40 */ 40 */
41 public function hrSave(){ 41 public function hrSave(){
42 - //处理参数 42 + $this->handleParam();
  43 + //处理参数
43 foreach ($this->model::specieField() as $v){ 44 foreach ($this->model::specieField() as $v){
44 $this->param = $this->setJson($v,$this->param); 45 $this->param = $this->setJson($v,$this->param);
45 } 46 }
@@ -52,6 +53,22 @@ class HrLogic extends BaseLogic @@ -52,6 +53,22 @@ class HrLogic extends BaseLogic
52 } 53 }
53 54
54 /** 55 /**
  56 + * @remark :处理字段
  57 + * @name :handleParam
  58 + * @author :lyh
  59 + * @method :post
  60 + * @time :2024/7/10 16:32
  61 + */
  62 + public function handleParam(){
  63 + $this->param['status'] = empty($this->param['status']) ? 1 : $this->param['status'];
  64 + $this->param['education'] = empty($this->param['education']) ? 1 : $this->param['education'];
  65 + $this->param['entry_position'] = empty($this->param['entry_position']) ? 1 : $this->param['entry_position'];
  66 + $this->param['p_level'] = empty($this->param['p_level']) ? 1 : $this->param['p_level'];
  67 + $this->param['dept_id'] = empty($this->param['dept_id']) ? 1 : $this->param['dept_id'];
  68 + $this->param['belong_group'] = empty($this->param['belong_group']) ? 1 : $this->param['belong_group'];
  69 + }
  70 +
  71 + /**
55 * @remark :添加人事信息时 同步添加管理员账号 72 * @remark :添加人事信息时 同步添加管理员账号
56 * @name :addManager 73 * @name :addManager
57 * @author :lyh 74 * @author :lyh
@@ -70,18 +87,18 @@ class HrLogic extends BaseLogic @@ -70,18 +87,18 @@ class HrLogic extends BaseLogic
70 'password'=>Hash::make('globalsov6'), 87 'password'=>Hash::make('globalsov6'),
71 'gid'=>4, 88 'gid'=>4,
72 ]; 89 ];
73 -// DB::beginTransaction();  
74 -// try { 90 + DB::beginTransaction();
  91 + try {
75 $managerModel = new Manage(); 92 $managerModel = new Manage();
76 $this->param['manage_id'] = $managerModel->addReturnId($data); 93 $this->param['manage_id'] = $managerModel->addReturnId($data);
77 $this->model->add($this->param); 94 $this->model->add($this->param);
78 //同步到B端演示项目 95 //同步到B端演示项目
79 $this->syncBProjectUser($this->param['mobile'], $this->param['mobile'], $this->param['name'], $this->param['status']); 96 $this->syncBProjectUser($this->param['mobile'], $this->param['mobile'], $this->param['name'], $this->param['status']);
80 -// DB::commit();  
81 -// }catch (\Exception $e){  
82 -// DB::rollBack();  
83 -// $this->fail('系统错误请联系管理员');  
84 -// } 97 + DB::commit();
  98 + }catch (\Exception $e){
  99 + DB::rollBack();
  100 + $this->fail('系统错误请联系管理员');
  101 + }
85 return $this->success(); 102 return $this->success();
86 } 103 }
87 104
@@ -35,12 +35,12 @@ class ManagerHrRequest extends FormRequest @@ -35,12 +35,12 @@ class ManagerHrRequest extends FormRequest
35 return [ 35 return [
36 'name'=>'required', 36 'name'=>'required',
37 'mobile'=>'required', 37 'mobile'=>'required',
38 - 'status'=>'required',  
39 - 'education'=>'required',  
40 - 'entry_position'=>'required',  
41 - 'p_level'=>'required',  
42 - 'dept_id'=>'required',  
43 - 'belong_group'=>'required', 38 +// 'status'=>'required',
  39 +// 'education'=>'required',
  40 +// 'entry_position'=>'required',
  41 +// 'p_level'=>'required',
  42 +// 'dept_id'=>'required',
  43 +// 'belong_group'=>'required',
44 ]; 44 ];
45 } 45 }
46 46
@@ -49,12 +49,12 @@ class ManagerHrRequest extends FormRequest @@ -49,12 +49,12 @@ class ManagerHrRequest extends FormRequest
49 return [ 49 return [
50 'name.required' => '名称不能为空', 50 'name.required' => '名称不能为空',
51 'mobile.required' => '手机号码不能为空', 51 'mobile.required' => '手机号码不能为空',
52 - 'status.required' => '请选择用户状态',  
53 - 'education.required' => '请选择学历',  
54 - 'entry_position.required' => '请选择入职岗位',  
55 - 'belong_group.required' => '请选择小组',  
56 - 'p_level.required' => '请选择入职岗位级别',  
57 - 'dept_id.required' => '请选择部门', 52 +// 'status.required' => '请选择用户状态',
  53 +// 'education.required' => '请选择学历',
  54 +// 'entry_position.required' => '请选择入职岗位',
  55 +// 'belong_group.required' => '请选择小组',
  56 +// 'p_level.required' => '请选择入职岗位级别',
  57 +// 'dept_id.required' => '请选择部门',
58 ]; 58 ];
59 } 59 }
60 60