diff --git a/src/App.tsx b/src/App.tsx index feaee40..4126ba1 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -23,7 +23,9 @@ import { type PublicListingQuery, } from "./api"; import { + formatBanRecord, formatCoin, + formatDailyLoss, formatEstimatedRentalDuration, formatListingCode, formatListingInfoText, @@ -704,6 +706,8 @@ function ListingRow({ codeCopied, infoCopied, item, onCopyCode, onCopyInfo }: Li ["AW子弹", String(getResourceQuantity(item, "awmAmmo") || "-")], ["绝密KD", String(readAssetNumber(item, "secret_kd") || "0.00")], ["比例", formatRatio(item)], + ["每日消耗", formatDailyLoss(item)], + ["封禁记录", formatBanRecord(item)], ["红皮", skinNames.slice(0, 2).join("、") || "-"], ["登录方式", item.login_platform || "-"], ["IP", regions[0] || item.server_region || "-"], diff --git a/src/listingDisplay.ts b/src/listingDisplay.ts index f1e8742..7b8ecb1 100644 --- a/src/listingDisplay.ts +++ b/src/listingDisplay.ts @@ -50,6 +50,27 @@ export function getDailyLossM(item: Listing) { return configuredLoss > 0 ? configuredLoss : 0; } +/** 每日消耗展示文案,如 10M/天 */ +export function formatDailyLoss(item: Listing) { + const loss = getDailyLossM(item); + if (loss <= 0) return "-"; + const rounded = Math.round(loss * 10) / 10; + return `${Number.isInteger(rounded) ? rounded : rounded.toFixed(1)}M/天`; +} + +/** + * 封禁记录有/无(asset_summary.ban_record) + * 后端常见值:无封禁记录 / 有封禁记录 / 其它文案 + */ +export function formatBanRecord(item: Listing) { + const raw = readAssetString(item, "ban_record").trim(); + if (!raw) return "无"; + if (/^无/.test(raw) || raw === "否" || raw === "没有") return "无"; + if (/^有/.test(raw) || raw === "是") return "有"; + // 其它非空文案视为有封禁 + return "有"; +} + /** 预计租期(天)= 哈夫币M / 日耗M */ export function getEstimatedRentalDays(item: Listing) { const coinM = getCoinM(item); @@ -146,6 +167,8 @@ export function formatListingInfoText(item: Listing) { `红皮:${skinNames.slice(0, 2).join("、") || "-"}`, `登录方式:${item.login_platform || "-"}`, `IP:${regions[0] || item.server_region || "-"}`, + `封禁记录:${formatBanRecord(item)}`, + `每日消耗:${formatDailyLoss(item)}`, online ? `上号时间:${online}` : "", fireLevel ? `烽火:${fireLevel}` : "", item.rank_level ? `段位:${item.rank_level}` : "",