where('split_link_id', (int) $number['split_link_id']) ->where('ticket_name', (string) $number['ticket_name']) ->find(); if ($ticket === null) { return; } $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); // 自上次同步检查点以来进线未增长,则本次访问计入 streak if ($inboundCount <= $lastInbound) { $streak++; } else { $streak = 0; } $update = [ 'no_inbound_click_streak' => $streak, 'updatetime' => time(), ]; // 非手动号码且达到下号比率:触线降权,不关 status,等待同步确认 if ((int) $number['manual_manage'] === 0 && $assignRatio > 0 && $streak >= $assignRatio) { $update['ratio_deferred'] = 1; $update['ratio_deferred_at'] = time(); } Number::where('id', $numberId)->update($update); } }