作者 Your Name

Merge branch 'dev' of http://47.244.231.31:8099/zhl/globalso-v6 into dev

@@ -35,11 +35,8 @@ class UserLogic extends BaseLogic @@ -35,11 +35,8 @@ class UserLogic extends BaseLogic
35 * @method 35 * @method
36 */ 36 */
37 public function user_add(){ 37 public function user_add(){
38 - $info = $this->model->read(['mobile'=>$this->param['mobile']]);  
39 - if($info !== false){  
40 - $this->fail('当前手机号码已存在');  
41 - }  
42 - //TODO::上传头像 38 + $this->verifyMobile();//验证手机号
  39 + $this->param['password'] = base64_encode(md5($this->param['password']));
43 $rs = $this->model->add($this->param); 40 $rs = $this->model->add($this->param);
44 if($rs === false){ 41 if($rs === false){
45 $this->fail('添加失败'); 42 $this->fail('添加失败');
@@ -54,12 +51,15 @@ class UserLogic extends BaseLogic @@ -54,12 +51,15 @@ class UserLogic extends BaseLogic
54 * @method 51 * @method
55 */ 52 */
56 public function user_edit(){ 53 public function user_edit(){
57 - $info = $this->model->read(['mobile'=>$this->param['mobile'],'id'=>['!=',$this->param['id']]]);  
58 - if($info !== false){  
59 - $this->fail('当前手机号码已存在'); 54 + $this->verifyMobile();//验证手机号
  55 + //验证密码是否更改
  56 + if(isset($this->param['password']) && !empty($this->param['password'])){
  57 + $info = $this->model->read(['id'=>$this->param['id']]);
  58 + if($info['password'] != $this->param['password']){
  59 + $this->param['password'] = base64_encode(md5($this->param['password']));
  60 + }
60 } 61 }
61 - //TODO::上传头像  
62 - $rs = $this->model->edits($this->param); 62 + $rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
63 if($rs === false){ 63 if($rs === false){
64 $this->fail('编辑失败'); 64 $this->fail('编辑失败');
65 } 65 }
@@ -80,4 +80,26 @@ class UserLogic extends BaseLogic @@ -80,4 +80,26 @@ class UserLogic extends BaseLogic
80 } 80 }
81 return $this->success(); 81 return $this->success();
82 } 82 }
  83 +
  84 + /**
  85 + * @remark :验证手机号
  86 + * @name :verifyMobile
  87 + * @author :lyh
  88 + * @method :post
  89 + * @time :2023/6/25 9:47
  90 + */
  91 + public function verifyMobile(){
  92 + if(isset($this->param['id']) && !empty($this->param['id'])){
  93 + $info = $this->model->read(['mobile'=>$this->param['mobile'],'id'=>['!=',$this->param['id']]]);
  94 + if($info !== false){
  95 + $this->fail('当前手机号码已存在');
  96 + }
  97 + }else{
  98 + $info = $this->model->read(['mobile'=>$this->param['mobile']]);
  99 + if($info !== false){
  100 + $this->fail('当前手机号码已存在');
  101 + }
  102 + }
  103 + return true;
  104 + }
83 } 105 }
@@ -26,6 +26,7 @@ class UserRequest extends FormRequest @@ -26,6 +26,7 @@ class UserRequest extends FormRequest
26 return [ 26 return [
27 'mobile'=>'required|string|max:11||unique:gl_project_user', 27 'mobile'=>'required|string|max:11||unique:gl_project_user',
28 'password'=>'required|string|min:5', 28 'password'=>'required|string|min:5',
  29 + 'project_id'=>'required',
29 'name'=>'required|max:20', 30 'name'=>'required|max:20',
30 'role_id'=>'required' 31 'role_id'=>'required'
31 ]; 32 ];
@@ -35,6 +36,7 @@ class UserRequest extends FormRequest @@ -35,6 +36,7 @@ class UserRequest extends FormRequest
35 { 36 {
36 return [ 37 return [
37 'mobile.required'=>'号码必须填写', 38 'mobile.required'=>'号码必须填写',
  39 + 'project_id.required'=>'所属项目必须填写',
38 'mobile.string'=>'号码中含有非法文字', 40 'mobile.string'=>'号码中含有非法文字',
39 'mobile.max' => '号码不大于11字符.', 41 'mobile.max' => '号码不大于11字符.',
40 'password.required'=>'密码必须填写', 42 'password.required'=>'密码必须填写',