diff --git a/app/Services/LoginService.php b/app/Services/LoginService.php index 3f27b53..ad67bbc 100644 --- a/app/Services/LoginService.php +++ b/app/Services/LoginService.php @@ -218,22 +218,28 @@ class LoginService extends BaseService } } - // 手机号登陆 - public function mobileLogin(){ + /** + * 手机号登陆 + * @return array + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface + */ + public function mobileLogin(): array + { $code = $this->request->input('code'); $phone = $this->request->input('phone'); $user_type = $this->request->input('user_type'); $redis = $this->container->get(Redis::class); // 验证验证码 -// $sms_code = $redis->get("login_code" . $phone); -// if (empty($sms_code)){ -// return fail(HttpEnumCode::CODE_EXPIRED); -// } -// -// if ($sms_code != $code){ -// return fail(HttpEnumCode::CODE_ERROR); -// } + $sms_code = $redis->get("login_code" . $phone); + if (empty($sms_code)){ + return fail(HttpEnumCode::CODE_EXPIRED); + } + + if ($sms_code != $code){ + return fail(HttpEnumCode::CODE_ERROR); + } Db::beginTransaction();