From c979a70b3ac7cb9a3ce65733a3034718d937cd51 Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Mon, 20 Feb 2023 08:55:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E9=AA=8C=E8=AF=81=E7=A0=81?= =?UTF-8?q?=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/LoginService.php | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) 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();