|
@@ -307,12 +307,15 @@ class RefillFactory
|
|
|
$commit_times = $refill_info['commit_times'] + 1;
|
|
|
$order_time = $refill_info['order_time'];
|
|
|
|
|
|
- [$success,$err] = $this->add($mchid,$buyer_id,$amount,$card_no,$mch_order,$notify_url,$order_time,$commit_times);
|
|
|
+ $idcard = $refill_info['idcard'] ?? '';
|
|
|
+ $card_name = $refill_info['card_name'] ?? '';
|
|
|
+
|
|
|
+ [$success, $err] = $this->add($mchid, $buyer_id, $amount, $card_no, $mch_order, $idcard, $card_name, $notify_url, $order_time, $commit_times);
|
|
|
|
|
|
return ($success === true);
|
|
|
}
|
|
|
|
|
|
- public function add($mchid, $buyer_id, $amount, $card_no, $mch_order, $notify_url, $order_time = 0, $commit_times = 0)
|
|
|
+ public function add($mchid, $buyer_id, $amount, $card_no, $mch_order, $idcard, $card_name, $notify_url, $order_time = 0, $commit_times = 0)
|
|
|
{
|
|
|
$card_type = mtopcard\card_type($card_no);
|
|
|
$providers = $this->find_providers($amount, $card_type);
|
|
@@ -346,7 +349,8 @@ class RefillFactory
|
|
|
usort($providers, $ascending);
|
|
|
|
|
|
$refill_state = false;
|
|
|
- foreach ($providers as $provider) {
|
|
|
+ foreach ($providers as $provider)
|
|
|
+ {
|
|
|
$channel_name = $provider->name();
|
|
|
[$goods_id, $price] = $provider->goods($amount);
|
|
|
|
|
@@ -366,7 +370,8 @@ class RefillFactory
|
|
|
$result = $logic_buy_virtual->buyStep3($input, $buyer_id, [$calc, 'calc_vorder_amount'], true);
|
|
|
|
|
|
$mod_refill = Model('refill_order');
|
|
|
- if ($result['state'] === true) {
|
|
|
+ if ($result['state'] === true)
|
|
|
+ {
|
|
|
$order_sn = $result['data']['order_sn'];
|
|
|
$order_id = $result['data']['order_id'];
|
|
|
|
|
@@ -376,6 +381,7 @@ class RefillFactory
|
|
|
//虚拟订单表信息扩展
|
|
|
$orderext = ['order_id' => $order_id, 'order_sn' => $order_sn, 'mchid' => $mchid,
|
|
|
'refill_amount' => $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,
|
|
|
'order_time' => $order_time, 'commit_times' => $commit_times,
|
|
@@ -385,14 +391,19 @@ class RefillFactory
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
- $params = ['order_sn' => $order_sn];
|
|
|
+ $params = ['order_sn' => $order_sn, 'idcard' => $idcard, 'card_name' => $card_name];
|
|
|
[$state, $err] = $provider->add($card_no, $card_type, $amount, $params);
|
|
|
- if ($state) {
|
|
|
+ if ($state)
|
|
|
+ {
|
|
|
$trade_no = $err;
|
|
|
- $logic_vr_order = Logic("vr_order");
|
|
|
- $logic_vr_order->changeOrderStateSend($order_id);
|
|
|
+ if($provider->refill_type() == 'api') {
|
|
|
+ $logic_vr_order = Logic("vr_order");
|
|
|
+ $logic_vr_order->changeOrderStateSend($order_id);
|
|
|
+ }
|
|
|
+
|
|
|
$data = ['commit_time' => time(), 'ch_trade_no' => $trade_no];
|
|
|
$mod_refill->edit($order_id, $data);
|
|
|
+
|
|
|
$refill_state = true;
|
|
|
break;
|
|
|
} else {
|