|
@@ -64,10 +64,12 @@ use QueueClient;
|
|
|
use member_info;
|
|
|
use Exception;
|
|
|
use rbridge\RBridgeFactory;
|
|
|
+use trans_wapper;
|
|
|
|
|
|
class RefillFactory
|
|
|
{
|
|
|
private static $stInstance = null;
|
|
|
+ private $trans_wapper;
|
|
|
|
|
|
public static function instance()
|
|
|
{
|
|
@@ -262,13 +264,16 @@ class RefillFactory
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- if ($caller->verify($input)) {
|
|
|
+ $this->trans_wapper = trans_wapper;
|
|
|
+ if ($caller->verify($input))
|
|
|
+ {
|
|
|
[$order_id, $success, $can_try, $need_handle] = $caller->notify($input);
|
|
|
if (!$need_handle) {
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- if ($order_id !== false) {
|
|
|
+ if ($order_id !== false)
|
|
|
+ {
|
|
|
$mod_order = Model('vr_order');
|
|
|
$order_info = $mod_order->getOrderInfo(['order_id' => $order_id]);
|
|
|
$order_state = intval($order_info['order_state']);
|
|
@@ -277,22 +282,38 @@ class RefillFactory
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- $mod_refill = Model('refill_order');
|
|
|
- $refill_info = $mod_refill->getOrderInfo(['order_id' => $order_id]);
|
|
|
-
|
|
|
$logic_vr_order = Logic("vr_order");
|
|
|
if ($success) {
|
|
|
$logic_vr_order->changeOrderStateSuccess($order_id);
|
|
|
- } elseif ($can_try) {
|
|
|
- $logic_vr_order->changeOrderStateCancel($order_info, '', "{$chname}接口回调通知失败,正在重试");
|
|
|
- if ($this->retry($refill_info, $order_info) !== false) {
|
|
|
- $mod_refill->edit($order_id, ['inner_status' => 1, 'notify_time' => time(), 'notify_state' => 1]);
|
|
|
- return true;
|
|
|
+ }
|
|
|
+ elseif ($can_try)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ $mod_refill = Model('refill_order');
|
|
|
+ $trans = new trans_wapper($mod_refill, __METHOD__);
|
|
|
+ $refill_info = $mod_refill->getOrderInfo(['order_id' => $order_id,'inner_status' => 0]);
|
|
|
+ if(!empty($refill_info))
|
|
|
+ {
|
|
|
+ $logic_vr_order->changeOrderStateCancel($order_info, '', "{$chname}接口回调通知失败,正在重试");
|
|
|
+ if ($this->retry($refill_info, $order_info)) {
|
|
|
+ $mod_refill->edit($order_id, ['inner_status' => 1, 'notify_time' => time(), 'notify_state' => 1]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $trans->commit();
|
|
|
}
|
|
|
- } else {
|
|
|
+ catch (Exception $ex) {
|
|
|
+ $trans->rollback();
|
|
|
+ Log::record("Error:" . $ex->getMessage(),Log::ERR);
|
|
|
+ }
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ else {
|
|
|
$logic_vr_order->changeOrderStateCancel($order_info, '', "{$chname}接口回调通知失败,不可重试.");
|
|
|
}
|
|
|
|
|
|
+ $mod_refill = Model('refill_order');
|
|
|
$mod_refill->edit($order_id, ['notify_time' => time(), 'notify_state' => 1]);
|
|
|
QueueClient::push("NotifyMerchantComplete", ['order_id' => $order_id]);
|
|
|
} else {
|