feat: 资产标识符标准化、资产历史订单查询及导入虚拟号强制验证
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m21s
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m21s
主要变更: - 新增 AssetIdentifier 模型及 Store,统一管理资产标识符(ICCID/IMEI/SN 等) - 新增迁移:asset_identifier 表、order 表新增 asset_identifier 字段、iot_card.virtual_no NOT NULL 约束 - 资产 Handler/Service/Route 全面重构,支持标识符路由查询与解析 - 新增资产历史订单查询接口,支持跨设备/卡/钱包维度的订单聚合 - 设备与物联卡导入任务强制校验虚拟号,缺失时直接拒绝 - Excel 工具函数优化,前端导入指引文档同步更新 - 归档三个 OpenSpec 提案:asset-identifier-standardization、asset-historical-orders、import-mandatory-virtual-no - 更新 OpenAPI 文档及相关 DTO Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -48,8 +48,9 @@ type Service struct {
|
||||
packageSeriesStore *postgres.PackageSeriesStore
|
||||
gatewayClient *gateway.Client
|
||||
logger *zap.Logger
|
||||
pollingCallback PollingCallback // 轮询回调,可选
|
||||
dataDeductor DataDeductor // 流量扣减回调,可选
|
||||
pollingCallback PollingCallback
|
||||
dataDeductor DataDeductor
|
||||
assetIdentifierStore *postgres.AssetIdentifierStore
|
||||
}
|
||||
|
||||
func New(
|
||||
@@ -77,11 +78,15 @@ func New(
|
||||
}
|
||||
|
||||
// SetPollingCallback 设置轮询回调
|
||||
// 在应用启动时由 bootstrap 调用,注入轮询调度器
|
||||
func (s *Service) SetPollingCallback(callback PollingCallback) {
|
||||
s.pollingCallback = callback
|
||||
}
|
||||
|
||||
// SetAssetIdentifierStore 设置资产标识符注册表存储
|
||||
func (s *Service) SetAssetIdentifierStore(store *postgres.AssetIdentifierStore) {
|
||||
s.assetIdentifierStore = store
|
||||
}
|
||||
|
||||
// SetDataDeductor 设置流量扣减回调
|
||||
// 在应用启动时由 bootstrap 调用,注入套餐扣减服务
|
||||
func (s *Service) SetDataDeductor(deductor DataDeductor) {
|
||||
@@ -1073,14 +1078,16 @@ func (s *Service) DeleteCard(ctx context.Context, cardID uint) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// 执行软删除
|
||||
if err := s.iotCardStore.Delete(ctx, cardID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if s.assetIdentifierStore != nil {
|
||||
_ = s.assetIdentifierStore.DeleteByAsset(ctx, model.AssetTypeIotCard, cardID)
|
||||
}
|
||||
|
||||
s.logger.Info("删除卡", zap.Uint("card_id", cardID), zap.String("iccid", card.ICCID))
|
||||
|
||||
// 通知轮询调度器
|
||||
if s.pollingCallback != nil {
|
||||
s.pollingCallback.OnCardDeleted(ctx, cardID)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user