|
@@ -80,12 +80,12 @@ class RefillBase
|
|
|
if ($order_id !== false) {
|
|
|
return $this->proc_notify($order_id, $success, $can_try, $chname, $input, $official_sn);
|
|
|
} else {
|
|
|
- Log::record("{$chname} callback 系统无此订单ID:{$order_id}", Log::ERR);
|
|
|
+ Log::record("$chname callback 系统无此订单ID.", Log::WARING);
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
$orgdata = json_encode($input);
|
|
|
- Log::record("{$chname} 签名失败:input={$orgdata}",Log::ERR);
|
|
|
+ Log::record("$chname 签名失败:input=$orgdata",Log::WARING);
|
|
|
}
|
|
|
|
|
|
return true;
|
|
@@ -108,7 +108,7 @@ class RefillBase
|
|
|
};
|
|
|
|
|
|
$card_type = intval($refill_info['card_type']);
|
|
|
- $chk_types = [mtopcard\ChinaMobileCard , mtopcard\ChinaUnicomCard , mtopcard\ChinaTelecomCard];
|
|
|
+ $chk_types = [mtopcard\ChinaMobileCard, mtopcard\ChinaUnicomCard, mtopcard\ChinaTelecomCard];
|
|
|
|
|
|
$store_id = intval($order_info['store_id']);
|
|
|
if($in_exclude($store_id)) {
|
|
@@ -158,7 +158,7 @@ class RefillBase
|
|
|
|
|
|
private function proc_notify($order_id, $success, $can_try, $chname, $input = [], $official_sn = false)
|
|
|
{
|
|
|
- $monitor = function ($order_info,$state)
|
|
|
+ $monitor_notify = function ($order_info,$state)
|
|
|
{
|
|
|
$card_type = intval($order_info['card_type']);
|
|
|
if (!in_array($card_type, [mtopcard\ChinaMobileCard, mtopcard\ChinaUnicomCard, mtopcard\ChinaTelecomCard])) {
|
|
@@ -168,12 +168,8 @@ class RefillBase
|
|
|
$card_no = $order_info['card_no'];
|
|
|
$ch_name = $order_info['channel_name'];
|
|
|
|
|
|
- $mon = new sending_monitor();
|
|
|
- if($state) {
|
|
|
- $mon->success($card_no,$ch_name);
|
|
|
- } else {
|
|
|
- $mon->fail($card_no,$ch_name);
|
|
|
- }
|
|
|
+ $monitor = new sending_monitor();
|
|
|
+ $monitor->notify($card_no, $ch_name, $state);
|
|
|
};
|
|
|
|
|
|
$mod_order = Model('vr_order');
|
|
@@ -242,20 +238,19 @@ class RefillBase
|
|
|
$period = time() - $commit_time;
|
|
|
|
|
|
util::monitor_notify($chname,$spec,$card_type,$refill_info['channel_amount'],$period,$success,$commit_time,$refill_info['mch_amount']);
|
|
|
+ $monitor_notify($order_info,$success);
|
|
|
|
|
|
if ($success) {
|
|
|
$logic_vr_order->changeOrderStateSuccess($order_id,true);
|
|
|
$tran->commit();
|
|
|
util::onOrderSuccess($refill_info,$order_info);
|
|
|
util::monitor_callback($mchid, $spec, $card_type, $refill_info['mch_amount'], $refill_info['channel_amount'], true, $order_time);
|
|
|
- $monitor($order_info, true);
|
|
|
}
|
|
|
elseif ($can_try)
|
|
|
{
|
|
|
$logic_vr_order->changeOrderStateCancel($order_info, '', "{$chname}接口回调通知失败,正在重试", true, true);
|
|
|
$mod_refill->partition(util::part_refill($order_time))->edit($order_id, ['is_retrying' => 1,'notify_time' => time()]);
|
|
|
$tran->commit();
|
|
|
- $monitor($order_info, false);
|
|
|
|
|
|
if ($card_type == mtopcard\ThirdRefillCard) {
|
|
|
$thrid_refill = Model('thrid_refill');
|
|
@@ -285,7 +280,6 @@ class RefillBase
|
|
|
$logic_vr_order->changeOrderStateCancel($order_info, '', "{$chname}接口回调通知失败,不可重试.",true,true);
|
|
|
$tran->commit();
|
|
|
util::monitor_callback($mchid, $spec, $card_type, $refill_info['mch_amount'], 0, false, $order_time);
|
|
|
- $monitor($order_info, false);
|
|
|
}
|
|
|
|
|
|
$mod_refill->partition(util::part_refill($order_time))->edit($order_id, ['notify_time' => time(), 'is_retrying' => 0,'notify_state' => 1]);
|
|
@@ -503,7 +497,7 @@ class RefillBase
|
|
|
foreach ($providers as $provider)
|
|
|
{
|
|
|
$channel_name = $provider->name();
|
|
|
- if ($order->is_phone() and $monitor->can_add($order->card_no(), $channel_name) == false) {
|
|
|
+ if ($order->is_phone() and $monitor->can_commit($order->card_no(), $channel_name) == false) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
@@ -549,7 +543,7 @@ class RefillBase
|
|
|
$commit_time = time();
|
|
|
$chfilters->add_channel($channel_name,true);
|
|
|
util::monitor_commit($channel_name, $spec, $card_type, $channel_amount, $commit_time);
|
|
|
- $monitor->add($card_no,$channel_name);
|
|
|
+ $monitor->commit($card_no,$channel_name);
|
|
|
|
|
|
$trade_no = $errmsg;
|
|
|
$refill_type = $provider->refill_type();
|
|
@@ -589,7 +583,6 @@ class RefillBase
|
|
|
if(!empty($neterr) && util::need_check($net_errno)) {
|
|
|
$mod_refill->partition(util::part_refill($order_time))->edit($order_id, ['commit_time' => time(),'neterr' => 1,'err_msg' => "neterr=$net_errno"]);
|
|
|
util::monitor_netchk($channel_name,false);
|
|
|
- $monitor->add($card_no,$channel_name);
|
|
|
return [errcode::MERCHANT_REFILL_NETERROR, "充值失败", $last_orderid, $neterr, $net_errno];
|
|
|
}
|
|
|
|