展示封禁记录与每日消耗
列表详情与复制信息增加 ban_record(有/无)和 daily_loss_m 日耗。
This commit is contained in:
@@ -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 || "-"],
|
||||
|
||||
@@ -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}` : "",
|
||||
|
||||
Reference in New Issue
Block a user