修复随机号码前先按权重随机工单,并修复降权号码筛选与清理
This commit is contained in:
@@ -14,6 +14,13 @@ use app\admin\model\split\Ticket;
|
||||
*/
|
||||
class SplitNumberVisitRuleService
|
||||
{
|
||||
private SplitNumberRatioDeferredService $ratioDeferredService;
|
||||
|
||||
public function __construct(?SplitNumberRatioDeferredService $ratioDeferredService = null)
|
||||
{
|
||||
$this->ratioDeferredService = $ratioDeferredService ?? new SplitNumberRatioDeferredService();
|
||||
}
|
||||
|
||||
/**
|
||||
* 访问计数已递增后调用:累加 streak,达到 assign_ratio 时标记 ratio_deferred=1
|
||||
*/
|
||||
@@ -39,15 +46,11 @@ class SplitNumberVisitRuleService
|
||||
}
|
||||
|
||||
$assignRatio = (int) ($ticket['assign_ratio'] ?? 0);
|
||||
$inboundCount = (int) $number['inbound_count'];
|
||||
$lastInbound = (int) ($number['last_sync_inbound_count'] ?? 0);
|
||||
$streak = (int) ($number['no_inbound_click_streak'] ?? 0);
|
||||
$hasBaseline = $this->ratioDeferredService->hasLandingVisitBaseline($number);
|
||||
|
||||
// 自上次同步检查点以来进线未增长,则本次访问计入 streak
|
||||
if ($inboundCount <= $lastInbound) {
|
||||
$streak++;
|
||||
} else {
|
||||
$streak = 0;
|
||||
if ($hasBaseline) {
|
||||
$streak = $this->ratioDeferredService->computeStreakForVisit($number, $streak);
|
||||
}
|
||||
|
||||
$update = [
|
||||
@@ -55,8 +58,9 @@ class SplitNumberVisitRuleService
|
||||
'updatetime' => time(),
|
||||
];
|
||||
|
||||
// 非手动号码且达到下号比率:触线降权,不关 status,等待同步确认
|
||||
if ((int) $number['manual_manage'] === 0 && $assignRatio > 0 && $streak >= $assignRatio) {
|
||||
if ((int) $number['manual_manage'] === 0
|
||||
&& $this->ratioDeferredService->shouldMarkDeferred($streak, $assignRatio, $hasBaseline)
|
||||
) {
|
||||
$update['ratio_deferred'] = 1;
|
||||
$update['ratio_deferred_at'] = time();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user