fix(douyu): 补全账号能力目录并回收失效租约

This commit is contained in:
yml
2026-11-22 20:36:40 +08:00
parent 1906f924bc
commit af05c54c3f
18 changed files with 839 additions and 121 deletions
@@ -144,6 +144,9 @@ const EVENT_LABELS: Record<string, string> = {
const ISSUE_LABELS: Record<string, string> = {
mapping_missing: '商品映射缺失',
no_eligible_account: '没有可分配账号',
capability_cache_miss: '账号商品能力待补货',
account_lease_conflict: '候选账号正被其他任务占用',
account_pool_busy: '资格账号暂时全部占用',
points_short: '积分不足',
elite_not_opened: '精英宝典未开通',
commodity_limit_reached: '商品已达限兑上限',
@@ -258,7 +261,24 @@ function eventDescription(event: { eventType: string; detail: Record<string, unk
const reasons = Array.isArray(row.reasons) ? row.reasons.map(String) : [];
return `${name}:${reasons.join('、') || '未满足分配条件'}`;
});
return lines.join(';') || '本批账号均不满足当前分配条件';
if (lines.length) return lines.join(';');
const counts =
detail.availabilityCounts && typeof detail.availabilityCounts === 'object'
? (detail.availabilityCounts as Record<string, unknown>)
: {};
const eligible = Number(counts['account:eligible'] || 0);
const roleCooldown = Number(counts['account:roleCooldown'] || 0);
const leased = Number(counts['account:leased'] || 0);
const collab = Number(counts['account:activeCollab'] || 0);
const summary = [
eligible ? `具备资格账号 ${eligible}` : '',
roleCooldown ? `换绑冷却 ${roleCooldown}` : '',
leased ? `任务租约占用 ${leased}` : '',
collab ? `协作单占用 ${collab}` : '',
].filter(Boolean);
return summary.length
? `${summary.join(';')},当前没有空闲账号`
: '本批账号均不满足当前分配条件';
}
if (event.eventType === 'account_allocated') {
const reasons = Array.isArray(detail.softReasons) ? detail.softReasons.map(String) : [];