feat: 资产解析接口新增实名时间字段
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m5s
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m5s
- AssetResolveResponse 新增 real_name_at 字段:card 类型取 first_realname_at,device 类型取绑定卡中最小的实名时间 - BoundCardInfo 新增 real_name_at 字段:各卡自己的 first_realname_at - RefreshCardDataFromGateway 手动刷新路径补写实名时间:检测到 0→1 变化时同步写入 first_realname_at - 同步更新 asset-resolve 规格文档 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -191,10 +191,24 @@ func (s *Service) buildDeviceResolveResponse(ctx context.Context, device *model.
|
||||
MSISDN: c.MSISDN,
|
||||
NetworkStatus: c.NetworkStatus,
|
||||
RealNameStatus: c.RealNameStatus,
|
||||
RealNameAt: c.FirstRealnameAt,
|
||||
SlotPosition: slotMap[c.ID],
|
||||
IsCurrent: isCurrentMap[c.ID],
|
||||
})
|
||||
}
|
||||
|
||||
// 聚合设备级 RealNameAt:取所有绑定卡 FirstRealnameAt 中的最小值(跳过 nil)
|
||||
var minRealNameAt *time.Time
|
||||
for _, c := range cards {
|
||||
if c.FirstRealnameAt == nil {
|
||||
continue
|
||||
}
|
||||
if minRealNameAt == nil || c.FirstRealnameAt.Before(*minRealNameAt) {
|
||||
t := *c.FirstRealnameAt
|
||||
minRealNameAt = &t
|
||||
}
|
||||
}
|
||||
resp.RealNameAt = minRealNameAt
|
||||
}
|
||||
|
||||
// 查当前主套餐
|
||||
@@ -228,6 +242,7 @@ func (s *Service) buildCardResolveResponse(ctx context.Context, card *model.IotC
|
||||
CreatedAt: card.CreatedAt,
|
||||
UpdatedAt: card.UpdatedAt,
|
||||
RealNameStatus: card.RealNameStatus,
|
||||
RealNameAt: card.FirstRealnameAt,
|
||||
NetworkStatus: card.NetworkStatus,
|
||||
ICCID: card.ICCID,
|
||||
CarrierID: card.CarrierID,
|
||||
|
||||
@@ -853,6 +853,10 @@ func (s *Service) RefreshCardDataFromGateway(ctx context.Context, iccid string)
|
||||
} else {
|
||||
realNameStatus := parseGatewayRealnameStatus(realnameResp.RealStatus)
|
||||
updates["real_name_status"] = realNameStatus
|
||||
// 检测 0→1 变化:旧状态非已实名且新状态为已实名,补写 first_realname_at
|
||||
if card.RealNameStatus != constants.RealNameStatusVerified && realNameStatus == constants.RealNameStatusVerified {
|
||||
updates["first_realname_at"] = syncTime
|
||||
}
|
||||
}
|
||||
|
||||
// 3. 查询本月流量用量 — 使用增量计算(与轮询 calculateFlowUpdates 逻辑一致)
|
||||
|
||||
Reference in New Issue
Block a user