소스 검색

feat: 支付回调BUG

xiansin 2 년 전
부모
커밋
02a630333f

+ 6 - 2
mini/components/Recharge/index.vue

xqd
@@ -106,11 +106,15 @@ export default {
   watch: {
     show(val) {
       this.modal.show = val
+      if (val) {
+        this.getCombo()
+        this.getBuyNum()
+      }
     }
   },
   created() {
-    this.getCombo()
-    this.getBuyNum()
+    // this.getCombo()
+    // this.getBuyNum()
   },
   methods: {
     getCombo() {

+ 2 - 1
mini/components/SwiperBox/index.vue

xqd
@@ -14,7 +14,8 @@
       :list="list"
       :height="height"
       :radius="radius"
-      style="width: 100%"
+      style="width: 100%;"
+      :bg-color="$colors.bgColor"
       :indicator="true"
       :show-title="true"
       indicator-mode="dot"

+ 19 - 10
server/app/Helper/ByteDance.php

xqd xqd
@@ -135,21 +135,25 @@ class ByteDance extends BaseUniPlatform
             'access_token' => $this->accessToken,
             'open_id'      => $openid,
             'order_type'   => 0, // 0:普通小程序订单(非 POI 订单),
-            'order_detail' => [
+            'order_status' => 1,
+            'app_name'     => 'douyin',
+            'update_time'  => (int)Carbon::now()->getPreciseTimestamp(3),
+            'order_detail' => json_encode([
                 'order_id'    => $orderId,
                 'create_time' => (int)Carbon::now()->getPreciseTimestamp(3),
                 'status'      => $status, // 已支付 待支付
                 'amount'      => 1,
-                'total_price' => '',
+                'total_price' => $goods['price'] * 100,
                 'detail_url'  => 'pages/my/consume',
                 'item_list'   => [
-                    'item_code' => $goods['id'], // 商品ID,
-                    'img'       => $goods['img'],
-                    'title'     => $goods['title'],
-                    'price'     => $goods['price'],
+                    [
+                        'item_code' => (string)$goods['id'], // 商品ID,
+                        'img'       => 'https://zhengda.oss-cn-chengdu.aliyuncs.com/zhangsiye/images/26474488be1b83e2fcb0b9475508a9bb.png',
+                        'title'     => $goods['title'],
+                        'price'     => $goods['price'] * 100,
+                    ]
                 ]
-            ],
-            'update_time'  => (int)Carbon::now()->getPreciseTimestamp(3)
+            ],JSON_UNESCAPED_UNICODE),
         ];
         return $this->post($this->API::ORDER_PUSH, $data);
     }
@@ -186,13 +190,18 @@ class ByteDance extends BaseUniPlatform
                 'headers' => ['Content-Type' => 'application/json'],
                 'body'    => json_encode($data)
             ]);
+
             $stringBody = (string)$res->getBody();
             $res = json_decode($stringBody, true);
 
-            if(!empty($res['err_no'])){
+            if(isset($res['err_no']) && !empty($res['err_no'])){
                 throw new \Exception("请求字节跳动API接口错误,错误码:{$res['err_no']},错误信息:{$res['err_tips']}");
             }
-            return $res['data'];
+
+            if(isset($res['err_code']) && !empty($res['err_code'])){
+                throw new \Exception("请求字节跳动API接口错误,错误码:{$res['err_msg']},错误信息:{$res['err_msg']}");
+            }
+            return $res['data']?? [];
         } catch (GuzzleException $e) {
             \Log::error($e->getMessage());
             throw new \Exception($e->getMessage());

+ 4 - 2
server/app/Http/Controllers/V1/PayNoticeController.php

xqd xqd
@@ -129,7 +129,8 @@ class PayNoticeController extends Controller
         return [
             'id' => $record->combo_id,
             'title' => $record->combo->name,
-            'price' => $record->combo->price
+            'price' => $record->combo->price,
+            'img' => '',
         ];
 
     }
@@ -158,7 +159,8 @@ class PayNoticeController extends Controller
         return [
             'id' => $record->combo_id,
             'title' => $record->combo->name,
-            'price' => $record->combo->price
+            'price' => $record->combo->price,
+            'img' => '',
         ];
 
     }