fix(overview): 纠正高价值套装以商城 status==1 为最高准入裁判
- 根因:斗鱼官方商城接口 status==1 代表「已达兑换上限」,历史代码误以为商品列表全为全局字段而单纯依赖常被官方清空的 exchange_records,导致已兑换账号被误判为可兑换 - 修复:extract_high_value_goods 结合商城完整列表 status==1 现场判定已兑换,exchange_records 作为历史展示与兜底 - 前端:优化工作台与一键查询展示,明确展示「已达上限 N 个: ...」与「未达上限」,消除反向歧义 - 文档:沉淀坑 #9 到 AGENTS.md,并更正设计-账号一键查询.md
This commit is contained in:
@@ -117,9 +117,14 @@ function formatTime(value: string | number | null | undefined): string {
|
||||
*/
|
||||
function goodsState(g: HighValueGoods): { text: string; color: string } {
|
||||
if (g.missing) return { text: '未查到该商品', color: 'default' };
|
||||
return g.owned
|
||||
? { text: '已兑换(价值降低)', color: 'orange' }
|
||||
: { text: '可兑换', color: 'green' };
|
||||
if (g.owned) {
|
||||
const isLimit = g.reason?.includes('已达兑换上限');
|
||||
return {
|
||||
text: isLimit ? '已达上限(不可兑)' : '已兑换(价值降低)',
|
||||
color: 'orange',
|
||||
};
|
||||
}
|
||||
return { text: '可兑换', color: 'green' };
|
||||
}
|
||||
|
||||
const goodsColumns: ColumnsType<HighValueGoods> = [
|
||||
@@ -130,20 +135,26 @@ const goodsColumns: ColumnsType<HighValueGoods> = [
|
||||
width: 200,
|
||||
render: (name: string, g) =>
|
||||
g.missing ? (
|
||||
<Tooltip title={g.reason || '限兑列表和官方兑换记录里都没有它'}>
|
||||
<Tooltip title={g.reason || '商品列表和官方兑换记录里都没有它'}>
|
||||
<Text type="secondary">{name}</Text>
|
||||
</Tooltip>
|
||||
) : (
|
||||
<Text strong>{name}</Text>
|
||||
<Tooltip title={g.reason || undefined}>
|
||||
<Text strong>{name}</Text>
|
||||
</Tooltip>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: '可兑换 / 已兑换',
|
||||
key: 'owned',
|
||||
width: 130,
|
||||
width: 150,
|
||||
render: (_, g) => {
|
||||
const state = goodsState(g);
|
||||
return <Tag color={state.color}>{state.text}</Tag>;
|
||||
return (
|
||||
<Tooltip title={g.reason || undefined}>
|
||||
<Tag color={state.color}>{state.text}</Tag>
|
||||
</Tooltip>
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -1260,8 +1260,10 @@ export default function DouyuTasksPage({ handbook }: { handbook: HandbookKind })
|
||||
return <Text type="secondary">{text}</Text>;
|
||||
}
|
||||
const count = resultNumber(latestLimitedTask.result, 'limited_count');
|
||||
if (count === 0 || text === '无限制商品') return <Tag color="green">无限制商品</Tag>;
|
||||
return <Text title={text}>{text}</Text>;
|
||||
if (count === 0 || text === '无限制商品' || text === '无受限商品(均可兑换)') {
|
||||
return <Tag color="green">未达上限</Tag>;
|
||||
}
|
||||
return <Tag color="orange" title={text}>{text}</Tag>;
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -327,12 +327,12 @@ export function limitedGoodsTaskText(task: DouyuTaskItem | null | undefined): st
|
||||
if (task.message?.trim()) return task.message.trim();
|
||||
const count = resultNumber(task.result, 'limited_count');
|
||||
if (count == null) return '';
|
||||
if (count <= 0) return '无限制商品';
|
||||
if (count <= 0) return '无受限商品(均可兑换)';
|
||||
const goods = task.result?.limited_goods;
|
||||
const names = Array.isArray(goods)
|
||||
? goods.map(limitedGoodsName).filter(Boolean).slice(0, 5)
|
||||
: [];
|
||||
return names.length ? `限兑 ${count} 个: ${names.join(', ')}` : `限兑 ${count} 个`;
|
||||
return names.length ? `已达上限 ${count} 个: ${names.join(', ')}` : `已达上限 ${count} 个`;
|
||||
}
|
||||
|
||||
export function savedPositiveInteger(key: string, fallback = 1): number {
|
||||
|
||||
Reference in New Issue
Block a user