|
@@ -104,9 +104,23 @@ class UserLoginLogic |
|
@@ -104,9 +104,23 @@ class UserLoginLogic |
|
104
|
$info = $this->model->read(['mobile'=>$this->param['mobile'],'password'=>$password,'status'=>$this::USER_STATUS],
|
104
|
$info = $this->model->read(['mobile'=>$this->param['mobile'],'password'=>$password,'status'=>$this::USER_STATUS],
|
|
105
|
['id','mobile','role_id','token','name','project_id']);
|
105
|
['id','mobile','role_id','token','name','project_id']);
|
|
106
|
if($info === false){
|
106
|
if($info === false){
|
|
107
|
- //账号密码没通过时,验证验证码验证验证码是否准备
|
|
|
|
108
|
- $last_sms = SmsLog::getLastLog($this->param['mobile'], SmsLog::TYPE_LOGIN);
|
|
|
|
109
|
- if($this->param['password'] != $last_sms->code){
|
107
|
+ $info = $this->verifyCode($this->param['mobile'],$this->param['password']);
|
|
|
|
108
|
+ }
|
|
|
|
109
|
+ return $this->success($info);
|
|
|
|
110
|
+ }
|
|
|
|
111
|
+
|
|
|
|
112
|
+ /**
|
|
|
|
113
|
+ * @remark :验证验证码是否正确或是否过期
|
|
|
|
114
|
+ * @name :verifyCode
|
|
|
|
115
|
+ * @author :lyh
|
|
|
|
116
|
+ * @method :post
|
|
|
|
117
|
+ * @time :2023/7/25 17:17
|
|
|
|
118
|
+ */
|
|
|
|
119
|
+ public function verifyCode($mobile,$password){
|
|
|
|
120
|
+ //账号密码没通过时,验证验证码
|
|
|
|
121
|
+ $smsModel = new SmsLog();
|
|
|
|
122
|
+ $smsInfo = $smsModel->formatQuery(['mobile'=>$mobile,'type'=>$smsModel::TYPE_LOGIN])->orderBy('id','desc')->first();
|
|
|
|
123
|
+ if(($password != $smsInfo['code']) || ($smsInfo['created_at'] < date('Y-m-d H:i:s',time() - 300))){
|
|
110
|
$this->fail('账号密码错误/验证码错误',Code::USER_REGISTER_ERROE);
|
124
|
$this->fail('账号密码错误/验证码错误',Code::USER_REGISTER_ERROE);
|
|
111
|
}
|
125
|
}
|
|
112
|
$info = $this->model->read(['mobile'=>$this->param['mobile']],['id','mobile','status','role_id','token','name','project_id']);
|
126
|
$info = $this->model->read(['mobile'=>$this->param['mobile']],['id','mobile','status','role_id','token','name','project_id']);
|
|
@@ -116,10 +130,8 @@ class UserLoginLogic |
|
@@ -116,10 +130,8 @@ class UserLoginLogic |
|
116
|
if($info['status'] != self::USER_STATUS){
|
130
|
if($info['status'] != self::USER_STATUS){
|
|
117
|
$this->fail('当前用户被禁用',Code::USER_REGISTER_ERROE);
|
131
|
$this->fail('当前用户被禁用',Code::USER_REGISTER_ERROE);
|
|
118
|
}
|
132
|
}
|
|
|
|
133
|
+ return $info;
|
|
119
|
}
|
134
|
}
|
|
120
|
- return $this->success($info);
|
|
|
|
121
|
- }
|
|
|
|
122
|
-
|
|
|
|
123
|
/**
|
135
|
/**
|
|
124
|
* @name :(验证角色是否禁用)verifyRole
|
136
|
* @name :(验证角色是否禁用)verifyRole
|
|
125
|
* @author :lyh
|
137
|
* @author :lyh
|