feat: 补全网关停复机调用的关键日志(调用前/成功后均输出 INFO)
Some checks failed
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Has been cancelled

This commit is contained in:
2026-03-31 19:15:45 +08:00
parent 9d50424edc
commit 69ee754c19
4 changed files with 189 additions and 24 deletions

View File

@@ -835,6 +835,9 @@ func (s *Service) StopDevice(ctx context.Context, deviceID uint) (*dto.DeviceSus
}
if s.gatewayClient != nil {
log.Info("调用网关停机(设备)",
zap.Uint("device_id", deviceID),
zap.String("iccid", card.ICCID))
if gwErr := s.gatewayClient.StopCard(ctx, &gateway.CardOperationReq{CardNo: card.ICCID}); gwErr != nil {
log.Error("设备停机-调网关停机失败",
zap.Uint("device_id", deviceID),
@@ -846,6 +849,9 @@ func (s *Service) StopDevice(ctx context.Context, deviceID uint) (*dto.DeviceSus
})
continue
}
log.Info("网关停机成功(设备)",
zap.Uint("device_id", deviceID),
zap.String("iccid", card.ICCID))
}
now := time.Now()
@@ -936,6 +942,9 @@ func (s *Service) StartDevice(ctx context.Context, deviceID uint) error {
}
if s.gatewayClient != nil {
log.Info("调用网关复机(设备)",
zap.Uint("device_id", deviceID),
zap.String("iccid", card.ICCID))
if gwErr := s.gatewayClient.StartCard(ctx, &gateway.CardOperationReq{CardNo: card.ICCID}); gwErr != nil {
log.Error("设备复机-调网关复机失败",
zap.Uint("device_id", deviceID),
@@ -944,6 +953,9 @@ func (s *Service) StartDevice(ctx context.Context, deviceID uint) error {
lastErr = gwErr
continue
}
log.Info("网关复机成功(设备)",
zap.Uint("device_id", deviceID),
zap.String("iccid", card.ICCID))
}
now := time.Now()