|
@@ -15,6 +15,8 @@ class card_crash extends IEventRefill
|
|
|
protected $mChannels = [];
|
|
|
protected $mSuccInterval = 900;
|
|
|
|
|
|
+ protected $mExMchids = [];
|
|
|
+
|
|
|
public function __construct()
|
|
|
{
|
|
|
}
|
|
@@ -30,6 +32,18 @@ class card_crash extends IEventRefill
|
|
|
}
|
|
|
|
|
|
$this->mSuccInterval = intval($cfgs['succ_interval'] ?? 900);
|
|
|
+
|
|
|
+ //读取撞单排除机构
|
|
|
+ $mchids = $cfgs['mchids'] ?? '';
|
|
|
+ $mchids = explode(',',$mchids);
|
|
|
+ $this->mExMchids = [];
|
|
|
+ foreach ($mchids as $item)
|
|
|
+ {
|
|
|
+ $mchid = intval($item);
|
|
|
+ if($mchid > 0) {
|
|
|
+ $this->mExMchids[] = $mchid;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public function onBeforeSubmit(order $order) : bool
|
|
@@ -49,10 +63,18 @@ class card_crash extends IEventRefill
|
|
|
$mod_refill = Model('refill_order');
|
|
|
$val = $mod_refill->get_detail($mchid, $mch_order);
|
|
|
|
|
|
- if(!empty($val)) {
|
|
|
+ if(!empty($val))
|
|
|
+ {
|
|
|
$params = json_decode($val['params'],true);
|
|
|
- util::async_add($params, 60);
|
|
|
- Log::record("card_crash mchid=$mchid,mch_order $mch_order sleep one minute.", Log::DEBUG);
|
|
|
+
|
|
|
+ //在排除队列,这时可以提单,后面需要尽快失败返回.
|
|
|
+ if (in_array($mchid, $this->mExMchids)) {
|
|
|
+ util::async_add_zero($params, 5);
|
|
|
+ Log::record("card_crash mchid=$mchid,mch_order $mch_order add zero order.", Log::DEBUG);
|
|
|
+ } else {
|
|
|
+ util::async_add($params, 60);
|
|
|
+ Log::record("card_crash mchid=$mchid,mch_order $mch_order sleep one minute.", Log::DEBUG);
|
|
|
+ }
|
|
|
|
|
|
return false;
|
|
|
}
|
|
@@ -79,6 +101,7 @@ class card_crash extends IEventRefill
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+ $mchid = $order->mchid();
|
|
|
$card_no = $order->card_no();
|
|
|
$oid = $order->unique_id();
|
|
|
|