xiaogang 4 anos atrás
pai
commit
43c0984dad

+ 1 - 1
app/Http/Controllers/Api/UserController.php

xqd
@@ -286,7 +286,7 @@ class UserController extends Controller
             $user = auth('api')->user();
             $param['id'] = $request->id;  //vip id
             $param['user_id'] = $user->id;
-            $param['payment'] = $request->payment; //支付方式 1微信  2支付宝
+            $param['payment'] = $request->post('payment',1); //支付方式 1微信  2支付宝
             $res = $this->userService->buy_vip($param);
             //throw new Exception(json_encode($res));
         }catch (\Exception $exception){

+ 3 - 1
app/Services/UserService.php

xqd
@@ -52,7 +52,9 @@ class UserService
      * 购买vip
      */
     public function buy_vip($param){
-
+        if($param['payment']!=1 || $param['payment']!=2){
+            throw new Exception("支付参数错误");
+        }
         if(empty($param['id'])){
             throw new Exception("参数错误");
         }