|
@@ -344,8 +344,10 @@ class RefillBase
|
|
|
$input['order_from'] = 1;
|
|
|
$input['pd_pay'] = true;
|
|
|
|
|
|
+ $start = microtime(true);
|
|
|
$logic_buy_virtual = Logic('buy_virtual');
|
|
|
$result = $logic_buy_virtual->buyStep3($input, $buyer_id, [$calc, 'calc_vorder_amount'], true);
|
|
|
+ Log::record(sprintf("buyStep3 request time=%.6f", microtime(true) - $start), Log::DEBUG);
|
|
|
|
|
|
$mod_refill = Model('refill_order');
|
|
|
if ($result['state'] === true)
|
|
@@ -370,28 +372,38 @@ class RefillBase
|
|
|
$refill_amount = $amount;
|
|
|
}
|
|
|
|
|
|
- //虚拟订单表信息扩展
|
|
|
- $orderext = ['order_id' => $order_id, 'order_sn' => $order_sn, 'mchid' => $mchid,
|
|
|
- 'refill_amount' => $refill_amount, 'mch_order' => $mch_order,
|
|
|
- 'idcard' => $idcard, 'card_name' => $card_name,
|
|
|
- 'notify_url' => $notify_url, 'channel_name' => $channel_name,
|
|
|
- 'mch_amount' => $mch_amount, 'channel_amount' => $price * $quantity,
|
|
|
- 'order_time' => $order_time, 'commit_times' => $commit_times,
|
|
|
- 'card_type' => $card_type, 'regin_no' => $regin_no,
|
|
|
- 'card_no' => $card_no, 'quality' => $quality, 'org_quality' => $org_quality];
|
|
|
- $mod_refill->add_refill($orderext);
|
|
|
-
|
|
|
- if($card_type == mtopcard\ThirdRefillCard) {
|
|
|
-
|
|
|
- $ext = ['order_id' => $order_id,
|
|
|
- 'order_sn' => $order_sn,
|
|
|
- 'account_type' => $third_params['third_card_type'],
|
|
|
- 'quantity' => $quantity,
|
|
|
- 'user_account' => $card_no,
|
|
|
- 'pcode' => $third_params['product_code']
|
|
|
- ];
|
|
|
- $thrid_refill->addExt($ext);
|
|
|
+ $start = microtime(true);
|
|
|
+ try {
|
|
|
+ $trans = new trans_wapper($mod_refill, __METHOD__);
|
|
|
+ //虚拟订单表信息扩展
|
|
|
+ $orderext = ['order_id' => $order_id, 'order_sn' => $order_sn, 'mchid' => $mchid,
|
|
|
+ 'refill_amount' => $refill_amount, 'mch_order' => $mch_order,
|
|
|
+ 'idcard' => $idcard, 'card_name' => $card_name,
|
|
|
+ 'notify_url' => $notify_url, 'channel_name' => $channel_name,
|
|
|
+ 'mch_amount' => $mch_amount, 'channel_amount' => $price * $quantity,
|
|
|
+ 'order_time' => $order_time, 'commit_times' => $commit_times,
|
|
|
+ 'card_type' => $card_type, 'regin_no' => $regin_no,
|
|
|
+ 'card_no' => $card_no, 'quality' => $quality, 'org_quality' => $org_quality];
|
|
|
+ $mod_refill->add_refill($orderext);
|
|
|
+
|
|
|
+ if($card_type == mtopcard\ThirdRefillCard) {
|
|
|
+
|
|
|
+ $ext = ['order_id' => $order_id,
|
|
|
+ 'order_sn' => $order_sn,
|
|
|
+ 'account_type' => $third_params['third_card_type'],
|
|
|
+ 'quantity' => $quantity,
|
|
|
+ 'user_account' => $card_no,
|
|
|
+ 'pcode' => $third_params['product_code']
|
|
|
+ ];
|
|
|
+ $thrid_refill->addExt($ext);
|
|
|
+ }
|
|
|
+ $trans->commit();
|
|
|
+ }
|
|
|
+ catch (Exception $ex) {
|
|
|
+ Log::record($ex->getMessage(),Log::ERR);
|
|
|
+ $trans->rollback();
|
|
|
}
|
|
|
+ Log::record(sprintf("insert:refill_order request time=%.6f", microtime(true) - $start), Log::DEBUG);
|
|
|
|
|
|
if(!$this->pay_completed($order_sn)) {
|
|
|
$logic_vr_order = Logic("vr_order");
|