fix: 代码质量清理 — 统一C端支付枚举、修复静默错误、注入Worker回调、移除废弃同步代码
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m6s

- C端订单支付状态直接使用管理端统一枚举(1/2/3/4),移除冗余映射函数
- 资产查询绑定卡/套餐查询失败时记录Warn日志而非静默忽略
- Worker bootstrap注入停复机回调(流量耗尽停机、套餐激活复机)
- 删除废弃的SIM状态同步服务和任务处理器
- 新增开发环境数据清理脚本(full/soft/table三种模式)
This commit is contained in:
2026-03-28 15:27:59 +08:00
parent e81d3a58ad
commit 65e461eff7
10 changed files with 668 additions and 399 deletions

View File

@@ -133,7 +133,12 @@ func (s *Service) buildDeviceResolveResponse(ctx context.Context, device *model.
slotMap[b.IotCardID] = b.SlotPosition
isCurrentMap[b.IotCardID] = b.IsCurrent
}
cards, _ := s.iotCardStore.GetByIDs(ctx, cardIDs)
cards, err := s.iotCardStore.GetByIDs(ctx, cardIDs)
if err != nil {
logger.GetAppLogger().Warn("查询设备绑定卡信息失败,结果可能不完整",
zap.Uints("card_ids", cardIDs),
zap.Error(err))
}
for _, c := range cards {
resp.Cards = append(resp.Cards, dto.BoundCardInfo{
CardID: c.ID,
@@ -285,7 +290,12 @@ func (s *Service) GetRealtimeStatus(ctx context.Context, assetType string, id ui
slotMap[b.IotCardID] = b.SlotPosition
isCurrentMap[b.IotCardID] = b.IsCurrent
}
cards, _ := s.iotCardStore.GetByIDs(ctx, cardIDs)
cards, err := s.iotCardStore.GetByIDs(ctx, cardIDs)
if err != nil {
logger.GetAppLogger().Warn("查询设备绑定卡信息失败,结果可能不完整",
zap.Uints("card_ids", cardIDs),
zap.Error(err))
}
for _, c := range cards {
resp.Cards = append(resp.Cards, dto.BoundCardInfo{
CardID: c.ID,
@@ -533,7 +543,12 @@ func (s *Service) GetPackages(ctx context.Context, assetType string, id uint, pa
for id := range pkgIDSet {
pkgIDs = append(pkgIDs, id)
}
packages, _ := s.packageStore.GetByIDsUnscoped(ctx, pkgIDs)
packages, pkgErr := s.packageStore.GetByIDsUnscoped(ctx, pkgIDs)
if pkgErr != nil {
logger.GetAppLogger().Warn("批量查询套餐信息失败,套餐名称可能缺失",
zap.Uints("package_ids", pkgIDs),
zap.Error(pkgErr))
}
pkgMap := make(map[uint]*model.Package, len(packages))
for _, p := range packages {
pkgMap[p.ID] = p