|
@@ -26,8 +26,6 @@ use Swoole;
|
|
class RefillBase
|
|
class RefillBase
|
|
{
|
|
{
|
|
protected $mPolicy;
|
|
protected $mPolicy;
|
|
-
|
|
|
|
- protected $mLimits = [];
|
|
|
|
protected function __construct($policy)
|
|
protected function __construct($policy)
|
|
{
|
|
{
|
|
$this->mPolicy = $policy;
|
|
$this->mPolicy = $policy;
|
|
@@ -303,7 +301,7 @@ class RefillBase
|
|
$input['pd_pay'] = true;
|
|
$input['pd_pay'] = true;
|
|
|
|
|
|
$logic_buy_virtual = Logic('buy_virtual');
|
|
$logic_buy_virtual = Logic('buy_virtual');
|
|
- $result = $logic_buy_virtual->buyStep3($input, $buyer_id, [$calc, 'calc_vorder_amount'], true,false);
|
|
|
|
|
|
+ $result = $logic_buy_virtual->buyStep3($input, $buyer_id, [$calc, 'calc_vorder_amount'], true, true);
|
|
|
|
|
|
$mod_refill = Model('refill_order');
|
|
$mod_refill = Model('refill_order');
|
|
if ($result['state'] === true)
|
|
if ($result['state'] === true)
|
|
@@ -725,29 +723,18 @@ class RefillBase
|
|
|
|
|
|
public function query_net($order_id)
|
|
public function query_net($order_id)
|
|
{
|
|
{
|
|
- $query_handler = function ($order_id, $order_info)
|
|
|
|
|
|
+ $query_handler = function ($order_id, $order_info, $state, $order_state, $chname)
|
|
{
|
|
{
|
|
$mod_refill = Model('refill_order');
|
|
$mod_refill = Model('refill_order');
|
|
- $refill_info = $mod_refill->getOrderInfo(['order_id' => $order_id,'inner_status' => 0]);
|
|
|
|
- $chname = $refill_info['channel_name'];
|
|
|
|
-
|
|
|
|
- if($order_info['order_state'] == ORDER_STATE_PAY) {
|
|
|
|
|
|
+ if ($order_info['order_state'] == ORDER_STATE_PAY) {
|
|
$query_able = true;
|
|
$query_able = true;
|
|
- }
|
|
|
|
- else {
|
|
|
|
|
|
+ } else {
|
|
$query_able = false;
|
|
$query_able = false;
|
|
}
|
|
}
|
|
|
|
|
|
$can_try = false;
|
|
$can_try = false;
|
|
if($query_able)
|
|
if($query_able)
|
|
{
|
|
{
|
|
- if (empty($chname)) return [false, $can_try, $chname];
|
|
|
|
-
|
|
|
|
- $provider = $this->mPolicy->provider($chname);
|
|
|
|
- if(empty($provider)) return [false, $can_try, $chname];
|
|
|
|
-
|
|
|
|
- [$state, $order_state] = $provider->query($refill_info);
|
|
|
|
-
|
|
|
|
if(!$state) {
|
|
if(!$state) {
|
|
QueueClient::async_push("QueryOrderNeterr",['order_id' => $order_id],30);
|
|
QueueClient::async_push("QueryOrderNeterr",['order_id' => $order_id],30);
|
|
$neterr = true;
|
|
$neterr = true;
|
|
@@ -776,18 +763,26 @@ class RefillBase
|
|
util::monitor_netchk($chname,$neterr);
|
|
util::monitor_netchk($chname,$neterr);
|
|
}
|
|
}
|
|
|
|
|
|
- return [true,$can_try,$chname];
|
|
|
|
|
|
+ return [true,$can_try];
|
|
};
|
|
};
|
|
|
|
|
|
$mod_order = Model('vr_order');
|
|
$mod_order = Model('vr_order');
|
|
$order_info = $mod_order->getOrderInfo(['order_id' => $order_id]);
|
|
$order_info = $mod_order->getOrderInfo(['order_id' => $order_id]);
|
|
if (empty($order_info) || $order_info['order_state'] != ORDER_STATE_PAY) return false;
|
|
if (empty($order_info) || $order_info['order_state'] != ORDER_STATE_PAY) return false;
|
|
|
|
|
|
|
|
+ $mod_refill = Model('refill_order');
|
|
|
|
+ $refill_info = $mod_refill->getOrderInfo(['order_id' => $order_id,'inner_status' => 0]);
|
|
|
|
+ $chname = $refill_info['channel_name'];
|
|
|
|
+ $provider = $this->mPolicy->provider($chname);
|
|
|
|
+ if(empty($provider)) return false;
|
|
|
|
+
|
|
|
|
+ [$state, $order_state] = $provider->query($refill_info);
|
|
|
|
+
|
|
try {
|
|
try {
|
|
$can_try = false;
|
|
$can_try = false;
|
|
$tran = new trans_wapper($mod_order, 'query_net change order state trans');
|
|
$tran = new trans_wapper($mod_order, 'query_net change order state trans');
|
|
$order_info = $mod_order->getOrderInfo(['order_id' => $order_id], '*', true, true);
|
|
$order_info = $mod_order->getOrderInfo(['order_id' => $order_id], '*', true, true);
|
|
- [$ret, $can_try, $chname] = $query_handler($order_id, $order_info);
|
|
|
|
|
|
+ [$ret, $can_try] = $query_handler($order_id, $order_info, $state, $order_state, $chname);
|
|
$tran->commit();
|
|
$tran->commit();
|
|
$trans_succ = true;
|
|
$trans_succ = true;
|
|
}
|
|
}
|