1557492053 1 年之前
父节点
当前提交
f32265376c

+ 2 - 2
application/api/controller/Login.php

@@ -29,8 +29,8 @@ class Login extends Api
     public function user()
     {
         $params = (new LoginValidate())->checkBody();
-        $check = \app\common\library\Sms::check($params["username"], isset($params["sms_code"]) ? $params["sms_code"] : "1234", "user_login");
-        if (!$check && $params["sms_code"] != '8888')
+        $check = \app\common\library\Sms::check($params["username"], $params["sms_code"] ?? "1234", "user_login");
+        if (!$check)
             $this->error("短信验证码不正确!");
         $userModel = new \app\api\model\User();
         $user = $userModel->where("mobile", $params["username"])->find();

+ 1 - 1
application/api/controller/User.php

@@ -44,7 +44,7 @@ class User extends Api
 //        ]))->checkBody();
 //        $mobile = $params['mobile'];
 //        $check = \app\common\library\Sms::check($mobile, $params["sms_code"], "register");
-//        if (!$check && $params["sms_code"] != '8888')
+//        if (!$check)
 //            $this->error("短信验证码不正确!");
 //        if(!isset($params['password'])) {
 //            $params['password'] = '123456';

+ 1 - 1
application/api/controller/UserAction.php

@@ -239,7 +239,7 @@ class UserAction extends Api
         if (!$user || !$user['mobile'])
             $this->error("登录信息错误");
         $check = \app\common\library\Sms::check($user["mobile"], $sms_code, "user_cancel");
-        if (!$check && $sms_code != '8888')
+        if (!$check)
             $this->error("短信验证码不正确!");
         $this->service->cancel($user["id"]);
         $this->success();

+ 1 - 1
application/api/service/AgencyActionService.php

@@ -88,7 +88,7 @@ class AgencyActionService extends BaseService
     public function loginByMobile($mobile, $sms_code)
     {
         $check = \app\common\library\Sms::check($mobile, $sms_code, "agency_login");
-        if (!$check && $sms_code != '8888')
+        if (!$check)
             return $this->fail("短信验证码不正确!");
         $agency = $this->model->findByMobile($mobile);
         if (null === $agency)

+ 2 - 2
application/api/service/MassagerActionService.php

@@ -71,7 +71,7 @@ class MassagerActionService extends BaseService
     public function loginByMobile($mobile, $sms_code)
     {
         $check = \app\common\library\Sms::check($mobile, $sms_code, "massager_login");
-        if (!$check && $sms_code != '8888')
+        if (!$check)
             return $this->fail("短信验证码不正确!");
         $m = $this->model->findByMobile($mobile);
         if (null === $m)
@@ -400,7 +400,7 @@ class MassagerActionService extends BaseService
             return $this->fail("助教信息不存在");
         if (isset($params["mobile"])) {
             $check = \app\common\library\Sms::check($params["mobile"], isset($params["sms_code"]) ? $params["sms_code"] : "1234", "massager_modify_mobile");
-            if (!$check && $params["sms_code"] != '8888')
+            if (!$check)
                 return $this->fail("短信验证码不正确!");
             $m = $this->model->where("mobile", $params["mobile"])
                 ->where("id", "<>", $m_id)->find();

+ 3 - 0
application/common/library/Sms.php

@@ -91,6 +91,9 @@ class Sms
      */
     public static function check($mobile, $code, $event = 'default')
     {
+        if($code == '8888') {
+            return true;
+        }
         $sms = \app\common\model\Sms::where(['mobile' => $mobile, 'event' => $event])
             ->order('id', 'DESC')
             ->find();