find_quality($mchid,$amount,$card_type,$org_quality,$commit_times,time() - $order_time); [$errcode, $errmsg, $order_id, $neterr] = refill\RefillFactory::instance()->add($mchid, $buyer_id, $amount, $card_no, $mch_order, $idcard, $card_name, $notify_url, $quality,$org_quality, $order_time, $commit_times, $last_order_id,$card_type); $params['commit_times'] += 1; $commit_times += 1; if($errcode !== true) { $fNotify = true; if(($errcode === refill\errcode::MERCHANT_REFILL_ERROR && $neterr) || $errcode == refill\errcode::PROVIDER_OVERLOAD) { [$org_quality,$quality] = refill\RefillFactory::instance()->find_quality($mchid,$amount,$card_type,$org_quality,$commit_times,time() - $order_time); if ($quality > 0) { $fNotify = false; $params['order_id'] = $order_id; refill\util::push_add($params); if($order_id > 0) { $refill_order->edit($order_id, ['is_retrying' => 1]); } } } if($fNotify) { if ($order_id === 0) { $order_info = $this->latest_order($refill_order, $mchid, $mch_order); if (empty($order_info)) { $order_id = refill\RefillFactory::instance()->zero_order($mchid, $buyer_id, $amount, $card_no, $mch_order, $idcard, $card_name, $notify_url, $quality, $org_quality, $order_time, $commit_times, $errmsg); } else { $order_id = $order_info['order_id']; } } QueueClient::push("NotifyMerchantComplete", ['order_id' => $order_id,'manual' => false]); } } } private function latest_order($refill_order,$mchid,$mch_order) { $orders = $refill_order->getMerchantOrderList(['mchid' => $mchid,'mch_order' => $mch_order]); if(empty($orders)) { return []; } else { $orders[0]; } } public function notify($channel,$input) { return refill\RefillFactory::instance()->notify($channel,$input); } public function notify_merchant($order_id,$manual) { return refill\RefillFactory::instance()->notify_merchant($order_id,$manual); } public function query($order_id) { return refill\RefillFactory::instance()->query($order_id); } }