|
@@ -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) {
|