Browse Source

绑定手机号提示调整

zhangxiaobin 1 year ago
parent
commit
dcdce1c93f
1 changed files with 5 additions and 2 deletions
  1. 5 2
      application/api/controller/User.php

+ 5 - 2
application/api/controller/User.php

@@ -1135,8 +1135,11 @@ class User extends Api
         if (!Validate::regex($mobile, "^1\d{10}$")) {
             $this->error(__('Mobile is incorrect'));
         }
-        if (\app\common\model\User::where('mobile', $mobile)->find()) {
-            $this->error('该手机号已被其他用户绑定');
+        $userData = model('User')->where('mobile', $mobile)->find();
+        if (!empty($userData)) {
+            if ($userData['id'] != $this->auth->id) {
+                $this->error('该手机号已被其他用户绑定');
+            }
         }
         $result = Sms::check($mobile, $captcha, 'changemobile');
         if (!$result) {