fix(poll): gatewayClient=nil 时停复机返回错误而非成功 POLL-02
- stopCardWithRetry: gatewayClient==nil 时返回业务错误而非 nil(静默跳过会假装停机成功) - resumeCardWithRetry: 同上修复
This commit is contained in:
@@ -176,9 +176,7 @@ func (s *StopResumeService) hasAvailablePackage(ctx context.Context, cardID uint
|
|||||||
// stopCardWithRetry 任务 24.5: 调用运营商停机接口(带重试机制)
|
// stopCardWithRetry 任务 24.5: 调用运营商停机接口(带重试机制)
|
||||||
func (s *StopResumeService) stopCardWithRetry(ctx context.Context, card *model.IotCard) error {
|
func (s *StopResumeService) stopCardWithRetry(ctx context.Context, card *model.IotCard) error {
|
||||||
if s.gatewayClient == nil {
|
if s.gatewayClient == nil {
|
||||||
s.logger.Warn("Gateway 客户端未配置,跳过调用运营商接口",
|
return errors.New(errors.CodeInternalError, "Gateway 未配置,停复机操作不可用")
|
||||||
zap.Uint("card_id", card.ID))
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var lastErr error
|
var lastErr error
|
||||||
@@ -209,9 +207,7 @@ func (s *StopResumeService) stopCardWithRetry(ctx context.Context, card *model.I
|
|||||||
// resumeCardWithRetry 任务 24.5: 调用运营商复机接口(带重试机制)
|
// resumeCardWithRetry 任务 24.5: 调用运营商复机接口(带重试机制)
|
||||||
func (s *StopResumeService) resumeCardWithRetry(ctx context.Context, card *model.IotCard) error {
|
func (s *StopResumeService) resumeCardWithRetry(ctx context.Context, card *model.IotCard) error {
|
||||||
if s.gatewayClient == nil {
|
if s.gatewayClient == nil {
|
||||||
s.logger.Warn("Gateway 客户端未配置,跳过调用运营商接口",
|
return errors.New(errors.CodeInternalError, "Gateway 未配置,停复机操作不可用")
|
||||||
zap.Uint("card_id", card.ID))
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var lastErr error
|
var lastErr error
|
||||||
|
|||||||
Reference in New Issue
Block a user