Browse Source

手机号+区号防重复

lizhen_gitee 1 year ago
parent
commit
d7873aa965
1 changed files with 2 additions and 0 deletions
  1. 2 0
      application/api/controller/User.php

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

@@ -567,6 +567,7 @@ class User extends Api
         /*if (!Validate::regex($mobile, "^1\d{10}$")) {
             $this->error(__('Mobile is incorrect'));
         }*/
+        $simplemobile = $mobile;
         $mobile = $countrycode.$mobile;
         if($user->mobile == $mobile){
             $this->error('新手机号不能与旧手机号相同');
@@ -586,6 +587,7 @@ class User extends Api
         $verification->mobile = 1;
         $user->verification = $verification;
         $user->mobile = $mobile;
+        $user->simplemobile = $simplemobile;
         $user->save();
 
         Sms::flush($user->mobile, 'changemobile');