|
@@ -37,6 +37,10 @@ require_once(BASE_HELPER_PATH . '/refill/zzx/RefillOil.php');
|
|
require_once(BASE_HELPER_PATH . '/refill/zzx/RefillPhone.php');
|
|
require_once(BASE_HELPER_PATH . '/refill/zzx/RefillPhone.php');
|
|
require_once(BASE_HELPER_PATH . '/refill/zzx/RefillCallBack.php');
|
|
require_once(BASE_HELPER_PATH . '/refill/zzx/RefillCallBack.php');
|
|
|
|
|
|
|
|
+require_once(BASE_HELPER_PATH . '/refill/lx/RefillOil.php');
|
|
|
|
+require_once(BASE_HELPER_PATH . '/refill/lx/RefillPhone.php');
|
|
|
|
+require_once(BASE_HELPER_PATH . '/refill/lx/RefillCallBack.php');
|
|
|
|
+
|
|
use Log;
|
|
use Log;
|
|
use mtopcard;
|
|
use mtopcard;
|
|
use QueueClient;
|
|
use QueueClient;
|
|
@@ -282,7 +286,7 @@ class RefillFactory
|
|
// }
|
|
// }
|
|
|
|
|
|
$period = time() - $refill['order_time'];
|
|
$period = time() - $refill['order_time'];
|
|
- if($period >= 15 * 60) {
|
|
|
|
|
|
+ if($period >= 10 * 60) {
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -303,12 +307,15 @@ class RefillFactory
|
|
$commit_times = $refill_info['commit_times'] + 1;
|
|
$commit_times = $refill_info['commit_times'] + 1;
|
|
$order_time = $refill_info['order_time'];
|
|
$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);
|
|
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);
|
|
$card_type = mtopcard\card_type($card_no);
|
|
$providers = $this->find_providers($amount, $card_type);
|
|
$providers = $this->find_providers($amount, $card_type);
|
|
@@ -342,7 +349,8 @@ class RefillFactory
|
|
usort($providers, $ascending);
|
|
usort($providers, $ascending);
|
|
|
|
|
|
$refill_state = false;
|
|
$refill_state = false;
|
|
- foreach ($providers as $provider) {
|
|
|
|
|
|
+ foreach ($providers as $provider)
|
|
|
|
+ {
|
|
$channel_name = $provider->name();
|
|
$channel_name = $provider->name();
|
|
[$goods_id, $price] = $provider->goods($amount);
|
|
[$goods_id, $price] = $provider->goods($amount);
|
|
|
|
|
|
@@ -362,7 +370,8 @@ class RefillFactory
|
|
$result = $logic_buy_virtual->buyStep3($input, $buyer_id, [$calc, 'calc_vorder_amount'], true);
|
|
$result = $logic_buy_virtual->buyStep3($input, $buyer_id, [$calc, 'calc_vorder_amount'], true);
|
|
|
|
|
|
$mod_refill = Model('refill_order');
|
|
$mod_refill = Model('refill_order');
|
|
- if ($result['state'] === true) {
|
|
|
|
|
|
+ if ($result['state'] === true)
|
|
|
|
+ {
|
|
$order_sn = $result['data']['order_sn'];
|
|
$order_sn = $result['data']['order_sn'];
|
|
$order_id = $result['data']['order_id'];
|
|
$order_id = $result['data']['order_id'];
|
|
|
|
|
|
@@ -372,6 +381,7 @@ class RefillFactory
|
|
//虚拟订单表信息扩展
|
|
//虚拟订单表信息扩展
|
|
$orderext = ['order_id' => $order_id, 'order_sn' => $order_sn, 'mchid' => $mchid,
|
|
$orderext = ['order_id' => $order_id, 'order_sn' => $order_sn, 'mchid' => $mchid,
|
|
'refill_amount' => $amount, 'mch_order' => $mch_order,
|
|
'refill_amount' => $amount, 'mch_order' => $mch_order,
|
|
|
|
+ 'idcard' => $idcard, 'card_name' => $card_name,
|
|
'notify_url' => $notify_url, 'channel_name' => $channel_name,
|
|
'notify_url' => $notify_url, 'channel_name' => $channel_name,
|
|
'mch_amount' => $mch_amount, 'channel_amount' => $price,
|
|
'mch_amount' => $mch_amount, 'channel_amount' => $price,
|
|
'order_time' => $order_time, 'commit_times' => $commit_times,
|
|
'order_time' => $order_time, 'commit_times' => $commit_times,
|
|
@@ -381,14 +391,19 @@ class RefillFactory
|
|
continue;
|
|
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);
|
|
[$state, $err] = $provider->add($card_no, $card_type, $amount, $params);
|
|
- if ($state) {
|
|
|
|
|
|
+ if ($state)
|
|
|
|
+ {
|
|
$trade_no = $err;
|
|
$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];
|
|
$data = ['commit_time' => time(), 'ch_trade_no' => $trade_no];
|
|
$mod_refill->edit($order_id, $data);
|
|
$mod_refill->edit($order_id, $data);
|
|
|
|
+
|
|
$refill_state = true;
|
|
$refill_state = true;
|
|
break;
|
|
break;
|
|
} else {
|
|
} else {
|