Explorar o código

手机号登录bugfix

kevin hai 1 ano
pai
achega
7a9e49f8af
Modificáronse 1 ficheiros con 7 adicións e 6 borrados
  1. 7 6
      app/api/model/user/UserOpen.php

+ 7 - 6
app/api/model/user/UserOpen.php

@@ -380,6 +380,13 @@ class UserOpen extends UserModel
      */
     public function smsloginWx($data)
     {
+        // 判断会员号如果是手机号,则查询是否有有此会员号
+        $pattern = '/^1\d{10}$/';
+        if (!preg_match($pattern, $data['mobile'])) {
+            $this->error = '登录账号错误';
+            return false;
+        }
+
         $user = $this->where('user_no', $data['mobile'])->find();
         if (empty($user)) {
             $vall = [
@@ -401,12 +408,6 @@ class UserOpen extends UserModel
             $user = $this->where('user_no', $data['mobile'])->find();
         }
 
-        // 判断会员号如果是手机号,则查询是否有有此会员号
-        $pattern = '/^1\d{10}$/';
-        if (!preg_match($pattern, $data['mobile'])) {
-            $data['mobile'] = $user['mobile'];
-        }
-
         if (!$this->check($data)) {
             return false;
         }