feat: 新增卡视角以及设备视角的实名同步时间,卡状态同步时间,流量同步时间
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 4m56s
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 4m56s
This commit is contained in:
@@ -20,6 +20,12 @@ type TrafficDisplaySource = {
|
||||
enable_virtual_data?: boolean | null
|
||||
}
|
||||
|
||||
const NULLABLE_REALTIME_CARD_FIELDS = new Set([
|
||||
'last_data_check_at',
|
||||
'last_real_name_check_at',
|
||||
'last_card_status_check_at'
|
||||
])
|
||||
|
||||
/**
|
||||
* 格式化数据大小(MB -> GB/MB)
|
||||
*/
|
||||
@@ -54,7 +60,7 @@ const mergeAssetBoundCards = (
|
||||
|
||||
const mergedCard = { ...existingCard } as unknown as Record<string, unknown>
|
||||
for (const [key, value] of Object.entries(realtimeCard)) {
|
||||
if (value !== null && value !== undefined) {
|
||||
if (value !== undefined && (value !== null || NULLABLE_REALTIME_CARD_FIELDS.has(key))) {
|
||||
mergedCard[key] = value
|
||||
}
|
||||
}
|
||||
@@ -304,6 +310,15 @@ export function useAssetInfo() {
|
||||
if (data.last_sync_time !== undefined) {
|
||||
cardInfo.value.last_sync_time = data.last_sync_time
|
||||
}
|
||||
if (data.last_data_check_at !== undefined) {
|
||||
cardInfo.value.last_data_check_at = data.last_data_check_at
|
||||
}
|
||||
if (data.last_real_name_check_at !== undefined) {
|
||||
cardInfo.value.last_real_name_check_at = data.last_real_name_check_at
|
||||
}
|
||||
if (data.last_card_status_check_at !== undefined) {
|
||||
cardInfo.value.last_card_status_check_at = data.last_card_status_check_at
|
||||
}
|
||||
if (data.current_month_usage_mb !== undefined) {
|
||||
cardInfo.value.current_month_usage_mb = data.current_month_usage_mb
|
||||
}
|
||||
@@ -320,6 +335,15 @@ export function useAssetInfo() {
|
||||
// 仅用实时接口中非 null/undefined 的字段覆盖,避免清掉 resolve 接口返回的静态数据
|
||||
cardInfo.value.cards = mergeAssetBoundCards(cardInfo.value.cards || [], data.cards)
|
||||
}
|
||||
if (data.last_data_check_at !== undefined) {
|
||||
cardInfo.value.last_data_check_at = data.last_data_check_at
|
||||
}
|
||||
if (data.last_real_name_check_at !== undefined) {
|
||||
cardInfo.value.last_real_name_check_at = data.last_real_name_check_at
|
||||
}
|
||||
if (data.last_card_status_check_at !== undefined) {
|
||||
cardInfo.value.last_card_status_check_at = data.last_card_status_check_at
|
||||
}
|
||||
if (data.online_status !== undefined) {
|
||||
cardInfo.value.online_status = data.online_status
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user