fix:bug
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 5m46s

This commit is contained in:
luo
2026-09-08 10:59:38 +08:00
parent a7b006076a
commit 01cddd7eda
15 changed files with 78 additions and 127 deletions

View File

@@ -30,6 +30,9 @@ const NULLABLE_REALTIME_CARD_FIELDS = new Set([
'last_card_status_check_at'
])
// 详情接口是绑定卡实名时间的唯一来源;实时状态接口不应覆盖或保留旧值。
const DETAIL_ONLY_BOUND_CARD_FIELDS = new Set(['real_name_at'])
/**
* 格式化数据大小(MB -> GB/MB)
*/
@@ -60,10 +63,13 @@ const mergeAssetBoundCards = (
): AssetBoundCard[] =>
realtimeCards.map((realtimeCard) => {
const existingCard = existingCards.find((card) => card.iccid === realtimeCard.iccid)
if (!existingCard) return realtimeCard
if (!existingCard) {
return { ...realtimeCard, real_name_at: null }
}
const mergedCard = { ...existingCard } as unknown as Record<string, unknown>
for (const [key, value] of Object.entries(realtimeCard)) {
if (DETAIL_ONLY_BOUND_CARD_FIELDS.has(key)) continue
if (value !== undefined && (value !== null || NULLABLE_REALTIME_CARD_FIELDS.has(key))) {
mergedCard[key] = value
}