onlinetest %!s(int64=5) %!d(string=hai) anos
pai
achega
b73cff91ad

+ 3 - 5
app/Http/Controllers/QuickApp/User/UserController.php

@@ -143,7 +143,7 @@ class UserController extends BaseController
     public function sendCode(Request $request)
     {
         $phone = $request->post('phone');
-        if (($this->phone && $this->phone === $phone) || !$this->phone) {
+        if ($phone) {
             $code = random_int(1000, 9999);
             Redis::setex('quser_code:' . $phone, 120, $code);
             AliSMS::send($phone, 'quickapp_user_bind_phone', ['code' => $code]);
@@ -177,9 +177,7 @@ class UserController extends BaseController
         $old = Redis::get('quser_code:' . $phone);
         if ($old && $old == $code) {
             Redis::del('quser_code:' . $phone);
-            if ($this->phone == $phone) {
-                return response()->success();
-            } else if (!$this->phone) {
+            if (!$this->phone) {
                 $result = (new QappUserService)->bindPhone($this->uid, $phone);
                 if (!$result) {
                     return response()->success();
@@ -187,7 +185,7 @@ class UserController extends BaseController
                     return response()->error('WAP_BIND_PHONE_EXIST');
                 }
             } else {
-                return response()->error('WAP_BIND_PHONE_EXIST');
+                return response()->success();
             }
         } else {
             return response()->error('WAP_SEND_CODE_ERROR');

+ 1 - 0
app/Modules/User/Services/QappUserService.php

@@ -46,6 +46,7 @@ class QappUserService
 
     /**
      * 绑定手机号
+     * 多个账号可以绑定一个手机号
      */
     public function bindPhone(int $uid, string $phone)
     {