|
@@ -54,39 +54,34 @@ class transfer
|
|
|
$mchid = intval($item['mchid']);
|
|
|
$opened = intval($transfer_cfg['transfer_opened']);
|
|
|
$tmchid = intval($transfer_cfg['transfer_mchid']);
|
|
|
- $lower_time = intval($transfer_cfg['transfer_lowertime']);
|
|
|
- $upper_time = intval($transfer_cfg['transfer_uppertime']);
|
|
|
+ $lowestratio = round($transfer_cfg['transfer_lowestratio'], 3);
|
|
|
+
|
|
|
$card_types = $transfer_cfg['card_types'] ?? [];
|
|
|
|
|
|
- if ($opened == 1 && $tmchid > 0 && $tmchid != $mchid && $lower_time > 0 && $upper_time > $lower_time)
|
|
|
+ if ($opened == 1 and $tmchid > 0 and $tmchid != $mchid and $lowestratio > 0.001)
|
|
|
{
|
|
|
$admin_id = $mch_checker($tmchid);
|
|
|
- if($admin_id > 0) {
|
|
|
- $this->mMchid2Infos[$mchid] = ['transfer_mchid' => $tmchid, 'admin_id' => $admin_id,
|
|
|
- 'lower_time' => $lower_time, 'upper_time' => $upper_time,'card_types' => $card_types];
|
|
|
+ if ($admin_id > 0) {
|
|
|
+ $this->mMchid2Infos[$mchid] = ['transfer_mchid' => $tmchid,
|
|
|
+ 'admin_id' => $admin_id,
|
|
|
+ 'lowestratio' => $lowestratio,
|
|
|
+ 'card_types' => $card_types];
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public function need_transfer($mchid,$order_time,$card_type)
|
|
|
+ public function need_transfer($mchid,$card_type,&$lowestratio)
|
|
|
{
|
|
|
if(array_key_exists($mchid,$this->mMchid2Infos))
|
|
|
{
|
|
|
$transfer_cfg = $this->mMchid2Infos[$mchid];
|
|
|
-
|
|
|
- $lower_time = $transfer_cfg['lower_time'];
|
|
|
- $upper_time = $transfer_cfg['upper_time'];
|
|
|
+ $lowestratio = $transfer_cfg['lowestratio'];
|
|
|
$card_types = $transfer_cfg['card_types'];
|
|
|
|
|
|
- $elpse_secs = time() - $order_time;
|
|
|
- if ($elpse_secs >= $lower_time && $elpse_secs < $upper_time) {
|
|
|
+ if (!in_array($card_type, $card_types)) {
|
|
|
return true;
|
|
|
- } elseif (in_array($card_type, $card_types)) {
|
|
|
- return false;
|
|
|
- } else {
|
|
|
- return false;
|
|
|
}
|
|
|
}
|
|
|
|