|
...
|
...
|
@@ -126,16 +126,29 @@ class ComController extends BaseController |
|
|
|
*/
|
|
|
|
public function edit_info(){
|
|
|
|
$this->request->validate([
|
|
|
|
'password'=>['required'],
|
|
|
|
'name'=>['required'],
|
|
|
|
],[
|
|
|
|
'password.required'=>'密码必须填写',
|
|
|
|
'name.required'=>'名称必须填写',
|
|
|
|
'oldPassword'=>'required',
|
|
|
|
'password' => 'required',
|
|
|
|
'confirm'=>'required',
|
|
|
|
], [
|
|
|
|
'oldPassword.required' => '请输入原密码',
|
|
|
|
'password.required' => '请输入新密码',
|
|
|
|
'confirm.required' => '请再次输入新密码',
|
|
|
|
]);
|
|
|
|
$userLogic = new UserLogic();
|
|
|
|
$this->param['id'] = $this->uid;
|
|
|
|
$userLogic->edits();
|
|
|
|
$this->response('编辑成功');
|
|
|
|
//查询员密码是否正确
|
|
|
|
$userModel = new User();
|
|
|
|
$info = $userModel->read(['id'=>$this->user['id']]);
|
|
|
|
if($info['password'] != base64_encode(md5($this->param['oldPassword']))){
|
|
|
|
$this->response('原密码错误',Code::USER_ERROR);
|
|
|
|
}
|
|
|
|
if($this->param['password'] != $this->param['confirm']){
|
|
|
|
$this->response('两次密码不一致');
|
|
|
|
}
|
|
|
|
$rs = $userModel->edit(['password'=>base64_encode(md5($this->param['password']))],['id'=>$this->user['id']]);
|
|
|
|
if($rs === false){
|
|
|
|
$this->response('系统错误',Code::SYSTEM_ERROR);
|
|
|
|
}
|
|
|
|
Cache::pull($info['token']);
|
|
|
|
$this->response('success',Code::USER_LOGIN_ERROE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
...
|
...
|
|