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
+1 -1
View File
@@ -870,7 +870,7 @@ export default function AccountDetailPage() {
<Space wrap>
<span>商品兑换能力</span>
<Text type="secondary" style={{ fontSize: 12, fontWeight: 'normal' }}>
可兑换 {commoditySummary.fresh_available ?? 0} / 共 {commoditySummary.total ?? 0}
可兑换资格 {commoditySummary.fresh_eligible ?? 0} / 共 {commoditySummary.total ?? 0}
</Text>
</Space>
}
@@ -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) : [];
@@ -547,7 +547,7 @@ export default function AccountPlatformStatusPanel() {
<Row gutter={[16, 16]}>
<Col xs={12} md={6}><Statistic title="CK 有效" value={status ? status.accounts.ck_valid : '--'} /></Col>
<Col xs={12} md={6}><Statistic title="24h 预计到期" value={status ? status.accounts.ck_expiring_24h : '--'} /></Col>
<Col xs={12} md={6}><Statistic title="新鲜可兑换商品" value={status ? status.commodities.fresh_available : '--'} /></Col>
<Col xs={12} md={6}><Statistic title="新鲜兑换资格商品" value={status ? status.commodities.fresh_eligible : '--'} /></Col>
<Col xs={12} md={6}><Statistic title="待处理账号工作" value={status ? pendingWork : '--'} /></Col>
</Row>