|
...
|
...
|
@@ -35,11 +35,8 @@ class UserLogic extends BaseLogic |
|
|
|
* @method
|
|
|
|
*/
|
|
|
|
public function user_add(){
|
|
|
|
$info = $this->model->read(['mobile'=>$this->param['mobile']]);
|
|
|
|
if($info !== false){
|
|
|
|
$this->fail('当前手机号码已存在');
|
|
|
|
}
|
|
|
|
//TODO::上传头像
|
|
|
|
$this->verifyMobile();//验证手机号
|
|
|
|
$this->param['password'] = base64_encode(md5($this->param['password']));
|
|
|
|
$rs = $this->model->add($this->param);
|
|
|
|
if($rs === false){
|
|
|
|
$this->fail('添加失败');
|
|
...
|
...
|
@@ -54,12 +51,15 @@ class UserLogic extends BaseLogic |
|
|
|
* @method
|
|
|
|
*/
|
|
|
|
public function user_edit(){
|
|
|
|
$info = $this->model->read(['mobile'=>$this->param['mobile'],'id'=>['!=',$this->param['id']]]);
|
|
|
|
if($info !== false){
|
|
|
|
$this->fail('当前手机号码已存在');
|
|
|
|
$this->verifyMobile();//验证手机号
|
|
|
|
//验证密码是否更改
|
|
|
|
if(isset($this->param['password']) && !empty($this->param['password'])){
|
|
|
|
$info = $this->model->read(['id'=>$this->param['id']]);
|
|
|
|
if($info['password'] != $this->param['password']){
|
|
|
|
$this->param['password'] = base64_encode(md5($this->param['password']));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//TODO::上传头像
|
|
|
|
$rs = $this->model->edits($this->param);
|
|
|
|
$rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
|
|
|
|
if($rs === false){
|
|
|
|
$this->fail('编辑失败');
|
|
|
|
}
|
|
...
|
...
|
@@ -80,4 +80,26 @@ class UserLogic extends BaseLogic |
|
|
|
}
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :验证手机号
|
|
|
|
* @name :verifyMobile
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/6/25 9:47
|
|
|
|
*/
|
|
|
|
public function verifyMobile(){
|
|
|
|
if(isset($this->param['id']) && !empty($this->param['id'])){
|
|
|
|
$info = $this->model->read(['mobile'=>$this->param['mobile'],'id'=>['!=',$this->param['id']]]);
|
|
|
|
if($info !== false){
|
|
|
|
$this->fail('当前手机号码已存在');
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
$info = $this->model->read(['mobile'=>$this->param['mobile']]);
|
|
|
|
if($info !== false){
|
|
|
|
$this->fail('当前手机号码已存在');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|