|
@@ -70,9 +70,23 @@ class UserLoginLogic |
|
@@ -70,9 +70,23 @@ class UserLoginLogic |
|
70
|
$info = $this->model->read(['mobile'=>$this->param['mobile'],'password'=>$password,'status'=>$this::USER_STATUS],
|
70
|
$info = $this->model->read(['mobile'=>$this->param['mobile'],'password'=>$password,'status'=>$this::USER_STATUS],
|
|
71
|
['id','mobile','role_id','token','name','project_id']);
|
71
|
['id','mobile','role_id','token','name','project_id']);
|
|
72
|
if($info === false){
|
72
|
if($info === false){
|
|
73
|
- //账号密码没通过时,验证验证码验证验证码是否准备
|
|
|
|
74
|
- $last_sms = SmsLog::getLastLog($this->param['mobile'], SmsLog::TYPE_LOGIN);
|
|
|
|
75
|
- if($this->param['password'] != $last_sms->code){
|
73
|
+ $info = $this->verifyCode($this->param['mobile'],$this->param['password']);
|
|
|
|
74
|
+ }
|
|
|
|
75
|
+ return $this->success($info);
|
|
|
|
76
|
+ }
|
|
|
|
77
|
+
|
|
|
|
78
|
+ /**
|
|
|
|
79
|
+ * @remark :验证验证码是否正确或是否过期
|
|
|
|
80
|
+ * @name :verifyCode
|
|
|
|
81
|
+ * @author :lyh
|
|
|
|
82
|
+ * @method :post
|
|
|
|
83
|
+ * @time :2023/7/25 17:17
|
|
|
|
84
|
+ */
|
|
|
|
85
|
+ public function verifyCode($mobile,$password){
|
|
|
|
86
|
+ //账号密码没通过时,验证验证码
|
|
|
|
87
|
+ $smsModel = new SmsLog();
|
|
|
|
88
|
+ $smsInfo = $smsModel->formatQuery(['mobile'=>$mobile,'type'=>$smsModel::TYPE_LOGIN])->orderBy('id','desc')->first();
|
|
|
|
89
|
+ if(($password != $smsInfo['code']) || ($smsInfo['created_at'] < date('Y-m-d H:i:s',time() - 300))){
|
|
76
|
$this->fail('账号密码错误/验证码错误',Code::USER_REGISTER_ERROE);
|
90
|
$this->fail('账号密码错误/验证码错误',Code::USER_REGISTER_ERROE);
|
|
77
|
}
|
91
|
}
|
|
78
|
$info = $this->model->read(['mobile'=>$this->param['mobile']],['id','mobile','status','role_id','token','name','project_id']);
|
92
|
$info = $this->model->read(['mobile'=>$this->param['mobile']],['id','mobile','status','role_id','token','name','project_id']);
|
|
@@ -82,10 +96,8 @@ class UserLoginLogic |
|
@@ -82,10 +96,8 @@ class UserLoginLogic |
|
82
|
if($info['status'] != self::USER_STATUS){
|
96
|
if($info['status'] != self::USER_STATUS){
|
|
83
|
$this->fail('当前用户被禁用',Code::USER_REGISTER_ERROE);
|
97
|
$this->fail('当前用户被禁用',Code::USER_REGISTER_ERROE);
|
|
84
|
}
|
98
|
}
|
|
|
|
99
|
+ return $info;
|
|
85
|
}
|
100
|
}
|
|
86
|
- return $this->success($info);
|
|
|
|
87
|
- }
|
|
|
|
88
|
-
|
|
|
|
89
|
/**
|
101
|
/**
|
|
90
|
* @name :(验证角色是否禁用)verifyRole
|
102
|
* @name :(验证角色是否禁用)verifyRole
|
|
91
|
* @author :lyh
|
103
|
* @author :lyh
|