feat: 兑换商品下拉框增加库存显示
goodsLabel 从 raw.count 取剩余库存并拼接到标签末尾, 格式变为「套装-浪漫天命 / 360积分 / 库存8144」。 精英宝典和电竞手册两处下拉框共用该函数,一次改动两处生效。
This commit is contained in:
@@ -160,7 +160,10 @@ function bindPhaseText(phase: string, polling: boolean): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function goodsLabel(item: DouyuGoodsItem): string {
|
function goodsLabel(item: DouyuGoodsItem): string {
|
||||||
return `${item.name || item.commodity_id}${item.score ? ` / ${item.score}积分` : ''}`;
|
const stock = item.raw?.count;
|
||||||
|
const stockText =
|
||||||
|
stock != null && Number.isFinite(Number(stock)) ? ` / 库存${stock}` : '';
|
||||||
|
return `${item.name || item.commodity_id}${item.score ? ` / ${item.score}积分` : ''}${stockText}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatWaitSeconds(seconds: number | null | undefined): string {
|
function formatWaitSeconds(seconds: number | null | undefined): string {
|
||||||
|
|||||||
Reference in New Issue
Block a user