This commit is contained in:
2026-05-29 12:37:38 +08:00
21 changed files with 2964 additions and 156 deletions

View File

@@ -156,7 +156,7 @@ func (s *NuoerService) CallAPI(ctx context.Context, apiKey, apiPath string, body
nuoerErr := NewNuoerError(nuoerResp.Code, nuoerResp.Msg)
err = errors.Join(GetErrByPlatformCode(nuoerResp.Code), nuoerErr)
if s.logger != nil {
s.logger.LogError(requestID, transactionID, apiKey, nuoerErr, requestPayload)
s.logger.LogErrorWithResponseID(requestID, transactionID, apiKey, nuoerErr, requestPayload, nuoerResp.SeqNo)
}
return nil, err
}
@@ -164,7 +164,7 @@ func (s *NuoerService) CallAPI(ctx context.Context, apiKey, apiPath string, body
if nuoerResp.Data == nil {
err = errors.Join(ErrSystem, errors.New("响应 data 为空"))
if s.logger != nil {
s.logger.LogError(requestID, transactionID, apiKey, err, requestPayload)
s.logger.LogErrorWithResponseID(requestID, transactionID, apiKey, err, requestPayload, nuoerResp.SeqNo)
}
return nil, err
}
@@ -173,7 +173,7 @@ func (s *NuoerService) CallAPI(ctx context.Context, apiKey, apiPath string, body
if !ok {
err = errors.Join(ErrSystem, errors.New("响应 data 无法解析 busiCode"))
if s.logger != nil {
s.logger.LogError(requestID, transactionID, apiKey, err, requestPayload)
s.logger.LogErrorWithResponseID(requestID, transactionID, apiKey, err, requestPayload, nuoerResp.SeqNo)
}
return nil, err
}
@@ -182,7 +182,7 @@ func (s *NuoerService) CallAPI(ctx context.Context, apiKey, apiPath string, body
busiErr := NewNuoerBusiError(busiCode, busiMsg)
err = errors.Join(GetErrByBusiCode(busiCode), busiErr)
if s.logger != nil {
s.logger.LogError(requestID, transactionID, apiKey, busiErr, requestPayload)
s.logger.LogErrorWithResponseID(requestID, transactionID, apiKey, busiErr, requestPayload, nuoerResp.SeqNo)
}
return nil, err
}
@@ -191,7 +191,7 @@ func (s *NuoerService) CallAPI(ctx context.Context, apiKey, apiPath string, body
if err != nil {
err = errors.Join(ErrSystem, fmt.Errorf("响应 data 清理失败: %w", err))
if s.logger != nil {
s.logger.LogError(requestID, transactionID, apiKey, err, requestPayload)
s.logger.LogErrorWithResponseID(requestID, transactionID, apiKey, err, requestPayload, nuoerResp.SeqNo)
}
return nil, err
}