This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user