展示点券/10 正常了
This commit is contained in:
@@ -231,10 +231,21 @@ function goodsLabel(item: DouyuGoodsItem): string {
|
||||
return `${item.name || item.commodity_id}${item.score ? ` / ${item.score}积分` : ''}${stockText}`;
|
||||
}
|
||||
|
||||
// 道聚城 iPrice 为 10 倍点券单位(如 6800=680 点券),仅展示层换算,兑换请求仍传原值。
|
||||
const XPD_POINT_PRICE_SCALE = 10;
|
||||
|
||||
function xpdPointPrice(item: DouyuGoodsItem): number {
|
||||
const xpd = item as DouyuGoodsItem & { price?: number | null };
|
||||
const raw = item.raw?.raw as Record<string, unknown> | undefined;
|
||||
const rawPrice = Number(xpd.price ?? raw?.iPrice);
|
||||
if (!Number.isFinite(rawPrice) || rawPrice <= 0) return 0;
|
||||
return Math.round(rawPrice / XPD_POINT_PRICE_SCALE);
|
||||
}
|
||||
|
||||
function xpdGoodsLabel(item: DouyuGoodsItem): string {
|
||||
const xpd = item as DouyuGoodsItem & { price?: number | null; goods_left?: number | null };
|
||||
const raw = item.raw?.raw as Record<string, unknown> | undefined;
|
||||
const pointPrice = Number(xpd.price ?? raw?.iPrice);
|
||||
const pointPrice = xpdPointPrice(item);
|
||||
const fragmentPrice = Number(raw?.iJb2Price);
|
||||
const prices = [
|
||||
Number.isFinite(pointPrice) && pointPrice > 0 ? `${pointPrice}点券` : '',
|
||||
@@ -249,9 +260,8 @@ function xpdGoodsLabel(item: DouyuGoodsItem): string {
|
||||
|
||||
function xpdGoodsPaymentOptions(item: DouyuGoodsItem | undefined): Array<{ value: '1' | '5'; label: string }> {
|
||||
if (!item) return [];
|
||||
const xpd = item as DouyuGoodsItem & { price?: number | null };
|
||||
const raw = item.raw?.raw as Record<string, unknown> | undefined;
|
||||
const pointPrice = Number(xpd.price ?? raw?.iPrice);
|
||||
const pointPrice = xpdPointPrice(item);
|
||||
const fragmentPrice = Number(raw?.iJb2Price);
|
||||
return [
|
||||
Number.isFinite(pointPrice) && pointPrice > 0
|
||||
|
||||
Reference in New Issue
Block a user