Forráskód Böngészése

Merge branch 'kuaiyingyong' of iqiyoo:zhuishuyun_wap into kuaiyingyong

fly 5 éve
szülő
commit
28920f54eb
1 módosított fájl, 9 hozzáadás és 7 törlés
  1. 9 7
      app/Http/Controllers/QuickApp/User/UserController.php

+ 9 - 7
app/Http/Controllers/QuickApp/User/UserController.php

@@ -144,13 +144,13 @@ class UserController extends BaseController
     public function sendCode(Request $request)
     {
         $phone = $request->post('phone');
-        if ($this->phone && $this->phone == $phone || !$this->phone) {
+        if (($this->phone && $this->phone === $phone) || !$this->phone) {
             $code = random_int(1000, 9999);
             Redis::setex('quser_code:' . $phone, 120, $code);
             AliSMS::send($phone, 'quickapp_user_bind_phone', ['code' => $code]);
             return response()->success();
         } else {
-            response()->error('WAP_BIND_PHONE_EXIST');
+            return response()->error('WAP_BIND_PHONE_EXIST');
         }
     }
 
@@ -177,16 +177,18 @@ class UserController extends BaseController
         $phone = $request->post('phone');
         $old = Redis::get('quser_code:' . $phone);
         if ($old && $old == $code) {
-            try {
-                Redis::del('quser_code:' . $phone);
+            Redis::del('quser_code:' . $phone);
+            if ($this->phone == $phone) {
+                return response()->success();
+            } else if (!$this->phone) {
                 $result = QappUserService::bindPhoneStatic($this->uid, $phone);
-                if ($result) {
+                if (!$result) {
                     return response()->success();
                 } else {
                     return response()->error('WAP_BIND_PHONE_EXIST');
                 }
-            } catch (Exception $e) {
-                return response()->error();
+            } else {
+                return response()->error('WAP_BIND_PHONE_EXIST');
             }
         } else {
             return response()->error('WAP_SEND_CODE_ERROR');