Silent 6 лет назад
Родитель
Сommit
cc2f517992
2 измененных файлов с 6 добавлено и 7 удалено
  1. 5 6
      app/Http/Controllers/WeChat/ApiController.php
  2. 1 1
      wechat/pages/form/index.js

+ 5 - 6
app/Http/Controllers/WeChat/ApiController.php

xqd
@@ -620,17 +620,16 @@ class ApiController extends Controller
             return response()->json(['status' => 'fail', 'info' => '保存失败']);
         }
 
-        if($type == 'pay') {
-            return $this->makeOrder($request);
+        $money = $form_set->money;
+
+        if($type == 'pay' && !empty($money)) {
+            return $this->makeOrder($request, $money);
         }
         return response()->json(['status' => 'success', 'info' => '提交成功']);
     }
 
-    public function makeOrder(Request $request)
+    public function makeOrder(Request $request, $money)
     {
-        if(empty($request->input('money'))) {
-            return response()->json(['status' => 'fail', 'info' => '金额错误']);
-        }
         if(empty($request->input('id')) || empty($we_chat_user = WeChatUser::find($request->input('id')))) {
             return response()->json(['status' => 'fail', 'info' => '找不到用户']);
         }

+ 1 - 1
wechat/pages/form/index.js

xqd
@@ -99,7 +99,7 @@ Page({
     }
     wx.request({
       url: api.submitFormUrl,
-      method: 'GET',
+      method: 'POST',
       data: {
         data: value
       },