|
@@ -99,6 +99,25 @@ class mratio_control
|
|
|
$cfg = unserialize($item['intercept_cfg']);
|
|
|
if(empty($cfg)) continue;
|
|
|
|
|
|
+ if(!empty($cfg['segment']))
|
|
|
+ {
|
|
|
+ $segment = $cfg['segment'];
|
|
|
+ $sitems = explode(',',$segment);
|
|
|
+
|
|
|
+ $tmp = [];
|
|
|
+ foreach ($sitems as $sitem)
|
|
|
+ {
|
|
|
+ $sitem = trim($sitem);
|
|
|
+ if(!empty($sitem)) {
|
|
|
+ $tmp[] = $sitem;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(!empty($tmp)) {
|
|
|
+ $cfg['segment'] = implode('|',$tmp);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
$result[$mchid] = $cfg;
|
|
|
}
|
|
|
}
|
|
@@ -515,8 +534,18 @@ class mratio_control
|
|
|
return !$can_next;
|
|
|
}
|
|
|
|
|
|
- public function need_intercept($mchid,$card_type,$card_state,$is_transfer) : bool
|
|
|
+ public function need_intercept($mchid,$card_type,$card_state,$is_transfer,$card_no) : bool
|
|
|
{
|
|
|
+ $start_with = function ($card_no,$segment)
|
|
|
+ {
|
|
|
+ $reg = "/^(?:{$segment})\d*$/";
|
|
|
+ if(preg_match($reg, $card_no, $matches)) {
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
$mintercepts = $this->mInterceptConfig;
|
|
|
if(array_key_exists($mchid,$mintercepts))
|
|
|
{
|
|
@@ -532,6 +561,10 @@ class mratio_control
|
|
|
if($mintercepts['is_transfer'] && $is_transfer) {
|
|
|
return true;
|
|
|
}
|
|
|
+
|
|
|
+ if (!empty($mintercepts['segment']) && $start_with($card_no,$mintercepts['segment'])) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
return false;
|