|
@@ -10,12 +10,28 @@ class proxy
|
|
|
{
|
|
|
private function onEerror(refill\order $order,$errmsg)
|
|
|
{
|
|
|
- $refill_order = Model('refill_order');
|
|
|
+ $get_mchamount = function ($mod_refill, $order_id)
|
|
|
+ {
|
|
|
+ $mod_refill = Model('refill_order');
|
|
|
+ $refill_info = $mod_refill->getOrderInfo(['order_id' => $order_id]);
|
|
|
+ if(empty($refill_info)) {
|
|
|
+ Log::record("onEerror cannot find order_id={$order_id}",Log::ERR);
|
|
|
+ return 0.0;
|
|
|
+ } else {
|
|
|
+ return $refill_info['mch_amount'];
|
|
|
+ }
|
|
|
+ };
|
|
|
|
|
|
+ $refill_order = Model('refill_order');
|
|
|
$mchid = $order->mchid();
|
|
|
$mch_order = $order->mch_order();
|
|
|
-
|
|
|
+ $commit_times = $order->commit_times();
|
|
|
$last_order_id = $order->last_order_id();
|
|
|
+
|
|
|
+ if($commit_times > 0 && $last_order_id > 0) {
|
|
|
+ $mch_amount = $get_mchamount($refill_order, $order->last_order_id());
|
|
|
+ }
|
|
|
+
|
|
|
if ($last_order_id === 0) {
|
|
|
$order_id = refill\RefillFactory::instance()->zero_order($order, $errmsg);
|
|
|
$last_order_id = $order_id;
|
|
@@ -26,6 +42,10 @@ class proxy
|
|
|
refill\util::pop_queue_order($mchid, $mch_order);
|
|
|
QueueClient::push("NotifyMerchantComplete", ['order_id' => $last_order_id, 'manual' => false]);
|
|
|
|
|
|
+ if($commit_times > 0 && $last_order_id > 0) {
|
|
|
+ refill\util::monitor_callback($mchid, $order->spec(), $order->card_type(), $mch_amount, 0, false, $order->order_time());
|
|
|
+ }
|
|
|
+
|
|
|
return true;
|
|
|
}
|
|
|
|