|
@@ -98,12 +98,17 @@ class UserLoginLogic |
|
@@ -98,12 +98,17 @@ class UserLoginLogic |
|
98
|
* @time :2023/6/12 15:31
|
98
|
* @time :2023/6/12 15:31
|
|
99
|
*/
|
99
|
*/
|
|
100
|
public function verifyAccount(){
|
100
|
public function verifyAccount(){
|
|
|
|
101
|
+ $info = $this->model->read(['mobile'=>$this->param['mobile']],['id','mobile','status','role_id','token','name','project_id']);
|
|
|
|
102
|
+ if($info === false){
|
|
|
|
103
|
+ $this->fail('当前用户不存在',Code::USER_REGISTER_ERROE);
|
|
|
|
104
|
+ }
|
|
|
|
105
|
+ if($info['status'] != self::USER_STATUS){
|
|
|
|
106
|
+ $this->fail('当前用户被禁用',Code::USER_REGISTER_ERROE);
|
|
|
|
107
|
+ }
|
|
101
|
//密码加密
|
108
|
//密码加密
|
|
102
|
$password = base64_encode(md5($this->param['password']));
|
109
|
$password = base64_encode(md5($this->param['password']));
|
|
103
|
- $info = $this->model->read(['mobile'=>$this->param['mobile'],'password'=>$password,'status'=>$this::USER_STATUS],
|
|
|
|
104
|
- ['id','mobile','role_id','token','name','project_id']);
|
|
|
|
105
|
- if($info === false){
|
|
|
|
106
|
- $info = $this->verifyCode($this->param['mobile'],$this->param['password']);
|
110
|
+ if($password != $info['password']){
|
|
|
|
111
|
+ $this->verifyCode($this->param['mobile'],$this->param['password']);
|
|
107
|
}
|
112
|
}
|
|
108
|
return $this->success($info);
|
113
|
return $this->success($info);
|
|
109
|
}
|
114
|
}
|
|
@@ -119,17 +124,14 @@ class UserLoginLogic |
|
@@ -119,17 +124,14 @@ class UserLoginLogic |
|
119
|
//账号密码没通过时,验证验证码
|
124
|
//账号密码没通过时,验证验证码
|
|
120
|
$smsModel = new SmsLog();
|
125
|
$smsModel = new SmsLog();
|
|
121
|
$smsInfo = $smsModel->formatQuery(['mobile'=>$mobile,'type'=>$smsModel::TYPE_LOGIN])->orderBy('id','desc')->first();
|
126
|
$smsInfo = $smsModel->formatQuery(['mobile'=>$mobile,'type'=>$smsModel::TYPE_LOGIN])->orderBy('id','desc')->first();
|
|
|
|
127
|
+ if(!empty($smsInfo)){
|
|
122
|
if(($password != $smsInfo['code']) || ($smsInfo['created_at'] < date('Y-m-d H:i:s',time() - 300))){
|
128
|
if(($password != $smsInfo['code']) || ($smsInfo['created_at'] < date('Y-m-d H:i:s',time() - 300))){
|
|
123
|
$this->fail('账号密码错误/验证码错误',Code::USER_REGISTER_ERROE);
|
129
|
$this->fail('账号密码错误/验证码错误',Code::USER_REGISTER_ERROE);
|
|
124
|
}
|
130
|
}
|
|
125
|
- $info = $this->model->read(['mobile'=>$this->param['mobile']],['id','mobile','status','role_id','token','name','project_id']);
|
|
|
|
126
|
- if($info === false){
|
|
|
|
127
|
- $this->fail('当前用户不存在',Code::USER_REGISTER_ERROE);
|
|
|
|
128
|
- }
|
|
|
|
129
|
- if($info['status'] != self::USER_STATUS){
|
|
|
|
130
|
- $this->fail('当前用户被禁用',Code::USER_REGISTER_ERROE);
|
131
|
+ }else{
|
|
|
|
132
|
+ $this->fail('账号密码错误/验证码错误',Code::USER_REGISTER_ERROE);
|
|
131
|
}
|
133
|
}
|
|
132
|
- return $info;
|
134
|
+ return true;
|
|
133
|
}
|
135
|
}
|
|
134
|
/**
|
136
|
/**
|
|
135
|
* @name :(验证角色是否禁用)verifyRole
|
137
|
* @name :(验证角色是否禁用)verifyRole
|