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