fix(douyu): 按到期时间修正精英宝典状态

This commit is contained in:
yml
2026-11-19 18:01:41 +08:00
parent ea79339c30
commit 66a310ec98
13 changed files with 283 additions and 36 deletions
+1 -15
View File
@@ -4,6 +4,7 @@ import {
QrcodeOutlined, ReloadOutlined, SearchOutlined, ShoppingOutlined,
} from '@ant-design/icons';
import type { DouyuGoodsItem, DouyuTaskItem } from '../../api/modules';
export { eliteIsExpired, eliteStatusText } from '../../utils/douyuElite';
export type HandbookKind = 'elite' | 'esports' | 'peace';
@@ -159,21 +160,6 @@ export function taskQrUrl(task: DouyuTaskItem | null | undefined): string {
return '';
}
// 精英宝典开通状态展示:积分区分不了"开通后积分花完"和"从未开通",
// 以后端落库的 manualType(elite_opened)为准。
export function eliteStatusText(
account: { elite_opened?: boolean | null; elite_expire_time?: number | null },
): string {
if (account.elite_opened == null) return '';
if (!account.elite_opened) return '未开通';
const expire = account.elite_expire_time;
if (!expire || expire <= 0) return '已开通';
const at = new Date(expire * 1000);
if (Number.isNaN(at.getTime())) return '已开通';
const pad = (n: number) => String(n).padStart(2, '0');
return `已开通 ${at.getFullYear()}-${pad(at.getMonth() + 1)}-${pad(at.getDate())} 到期`;
}
export function bindReadyForConfirm(task: DouyuTaskItem | null | undefined): boolean {
if (!task) return false;
if (task.task_type === 'get_xpd_bind_qr') {