Browse Source

fix 福禄订单没有插入详情表

stanley-king 2 years ago
parent
commit
9af1673d7a
1 changed files with 14 additions and 7 deletions
  1. 14 7
      helper/rbridge/fulu/Bridge.php

+ 14 - 7
helper/rbridge/fulu/Bridge.php

@@ -54,22 +54,29 @@ class Bridge implements IBridge
         $userid = intval($mchinfo['admin_id']);
 
         $order_time = time();
+        $mch_order = $params['Id'];
+        $card_no = $params['ChargeAccount'];
         $input = [ 'mchid' => $mchid,
             'buyer_id' => $userid,
             'amount' => $params['SupProductFaceValue'],
-            'card_no' => $params['ChargeAccount'],
-            'mch_order' => $params['Id'],
+            'card_no' => $card_no,
+            'mch_order' => $mch_order,
             'mch_card_types' => $mch_card_types,
             'notify_url' => config::MCH_NOTIFY_URL,
             'order_time' => $order_time
         ];
 
-        $code = refill\util::push_add($input);
-        if($code) {
-            refill\util::push_queue_order($mchid,$params['Id'],ORDER_STATE_QUEUE);
+        refill\util::push_queue_order($mchid,$mch_order,ORDER_STATE_QUEUE);
+        Model('refill_order')->add_detail($mchid,$mch_order,$order_time,$params,ORDER_STATE_QUEUE);
+
+        $state = refill\util::push_add($input);
+        if ($state === true) {
+            Log::record("refill::util::push_add success mchid={$mchid} mch_order={$mch_order} state={$state}",Log::DEBUG);
             return [true, '提交成功'];
-        }
-        else {
+        } else {
+            refill\util::del_queue_order($mchid,$mch_order);
+            Model('refill_order')->del_detail($mchid,$mch_order);
+            Log::record("refill::util::push_add error mchid={$mchid} mch_order={$mch_order} state={$state}",Log::DEBUG);
             return [false, '提交失败'];
         }
     }