From 8fc3485061993adc6797176cd0bd2dcf2ff5ff37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E8=BF=9B?= Date: Sat, 24 Oct 2026 17:31:32 +0900 Subject: [PATCH] =?UTF-8?q?chore:=20=E6=BF=80=E6=B4=BB=E5=89=8D=E6=B5=81?= =?UTF-8?q?=E9=87=8F=E7=BB=93=E7=AE=97=E8=AE=B0=E5=BD=95=E5=BC=80=E5=A7=8B?= =?UTF-8?q?=E4=B8=8E=E5=AE=8C=E6=88=90=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cardobservation/pre_activation_settlement.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/infrastructure/cardobservation/pre_activation_settlement.go b/internal/infrastructure/cardobservation/pre_activation_settlement.go index 0373437a..e42d3fed 100644 --- a/internal/infrastructure/cardobservation/pre_activation_settlement.go +++ b/internal/infrastructure/cardobservation/pre_activation_settlement.go @@ -47,6 +47,7 @@ func (s *PreActivationSettler) SettleBeforeActivation(ctx context.Context, carri if hasMain { return } + s.logger.Info("激活前流量结算开始", zap.String("carrier_type", carrierType), zap.Uint("asset_id", carrierID)) cards, err := s.cardsOf(ctx, carrierType, carrierID) if err != nil { s.logger.Warn("激活前流量结算:查询载体下卡失败,跳过结算", zap.String("carrier_type", carrierType), zap.Uint("carrier_id", carrierID), zap.Error(err)) @@ -86,7 +87,7 @@ func (s *PreActivationSettler) settleCard(ctx context.Context, card *model.IotCa resetDay = s.carrier.GetDataResetDay(stepCtx, card.CarrierID) } observedAt := time.Now().UTC() - _, err = s.observation.ApplyTrafficObservation(stepCtx, carddomain.TrafficObservation{ + decision, err := s.observation.ApplyTrafficObservation(stepCtx, carddomain.TrafficObservation{ CardID: card.ID, GatewayReadingMB: float64(response.Used), ResetDay: resetDay, Metadata: carddomain.ObservationMetadata{ ObservationID: "pre-activation-" + card.ICCID + "-" + observedAt.Format("20060102150405.000"), @@ -96,7 +97,12 @@ func (s *PreActivationSettler) settleCard(ctx context.Context, card *model.IotCa }) if err != nil { s.alert(card, carrierType, carrierID, "流量结算入账失败") + return } + s.logger.Info("激活前流量结算完成", zap.Uint("card_id", card.ID), zap.String("iccid", card.ICCID), + zap.String("carrier_type", carrierType), zap.Uint("asset_id", carrierID), + zap.Float64("gateway_flow_mb", float64(response.Used)), zap.Float64("increment_mb", decision.IncrementMB), + zap.String("metric", "package.pre_activation_settlement.done")) } // alert 写激活前结算失败告警:该卡本月可能多计无套餐期间用量,由运营核对。