fix
This commit is contained in:
parent
b9ca357448
commit
32fcdd7ad1
@ -112,7 +112,7 @@ func (l *PaySuccessNotifyUserHandler) ProcessTask(ctx context.Context, t *asynq.
|
||||
func (l *PaySuccessNotifyUserHandler) handleError(ctx context.Context, err error, order *model.Order, query *model.Query) error {
|
||||
logx.Errorf("处理任务失败,原因: %v", err)
|
||||
|
||||
if order.Status == "paid" && query.QueryState == model.QueryStatePending {
|
||||
if order.Status == "paid" && query.QueryState == model.QueryStateProcessing {
|
||||
// 更新查询状态为失败
|
||||
query.QueryState = model.QueryStateFailed
|
||||
updateQueryErr := l.svcCtx.QueryModel.UpdateWithVersion(ctx, nil, query)
|
||||
|
@ -894,14 +894,14 @@ func (a *ApiRequestService) ProcessCAR059Request(ctx context.Context, params []b
|
||||
logx.Infof("车辆维保记录查询任务,订单号: %s, 未查询到结果,需要重试", orderID.String())
|
||||
|
||||
// 检查重试次数
|
||||
maxRetries := 10
|
||||
maxRetries := 56
|
||||
if retryCount >= maxRetries {
|
||||
return nil, fmt.Errorf("车辆维保记录查询任务已达最大重试次数 %d,停止重试,订单号: %s",
|
||||
maxRetries, orderID.String())
|
||||
}
|
||||
|
||||
// 固定延迟时间为15秒
|
||||
fixedDelay := 15 * time.Second
|
||||
fixedDelay := 30 * time.Second
|
||||
|
||||
// 检查ctx是否已经有超时
|
||||
deadline, hasDeadline := ctx.Deadline()
|
||||
@ -946,8 +946,8 @@ func (a *ApiRequestService) ProcessCAR059Request(ctx context.Context, params []b
|
||||
}
|
||||
return nil, fmt.Errorf("车辆维保记录结果查询失败: %+v", err)
|
||||
}
|
||||
logx.Infof("车辆维保记录查询任务完成,订单号: %s, 结果数据长度: %d",
|
||||
orderID.String(), len(resp))
|
||||
logx.Infof("车辆维保记录查询任务完成,订单号: %s",
|
||||
orderID.String())
|
||||
return &APIInternalResult{
|
||||
Data: resp,
|
||||
}, nil
|
||||
@ -1415,7 +1415,7 @@ func (a *ApiRequestService) ProcessCOM187Request(ctx context.Context, params []b
|
||||
"keyword": name.String(),
|
||||
}
|
||||
resp, err := a.yushanService.request("COM187", request)
|
||||
if err != nil {
|
||||
if err != nil && err != ErrEmptyResult {
|
||||
return nil, fmt.Errorf("出境限制查询失败: %+v", err)
|
||||
}
|
||||
return &APIInternalResult{
|
||||
|
@ -4,7 +4,6 @@ import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/pkg/errors"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
@ -12,6 +11,8 @@ import (
|
||||
"qnc-server/pkg/lzkit/crypto"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
type WestResp struct {
|
||||
@ -99,7 +100,6 @@ func (w *WestDexService) CallAPI(code string, reqData map[string]interface{}) (r
|
||||
return nil, DecryptErr
|
||||
}
|
||||
return decryptedData, errors.New(westDexResp.Message)
|
||||
log.Println(string(decryptedData))
|
||||
}
|
||||
if westDexResp.Data == "" {
|
||||
return nil, errors.New(westDexResp.Message)
|
||||
|
@ -8,6 +8,7 @@ import (
|
||||
"encoding/base64"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
@ -28,6 +29,11 @@ func NewYushanService(c config.Config) *YushanService {
|
||||
}
|
||||
}
|
||||
|
||||
var (
|
||||
// ErrEmptyResult 表示查询结果为空
|
||||
ErrEmptyResult = errors.New("查询结果为空")
|
||||
)
|
||||
|
||||
func (y *YushanService) request(prodID string, params map[string]interface{}) ([]byte, error) {
|
||||
// 获取当前时间戳
|
||||
unixMilliseconds := time.Now().UnixNano() / int64(time.Millisecond)
|
||||
@ -98,7 +104,7 @@ func (y *YushanService) request(prodID string, params map[string]interface{}) ([
|
||||
|
||||
if retCode == "100000" {
|
||||
// retcode 为 100000,表示查询为空
|
||||
return respData, fmt.Errorf("羽山请求查空: %s", string(respData))
|
||||
return json.RawMessage("{}"), ErrEmptyResult
|
||||
} else if retCode == "000000" || retCode == "000001" || retCode == "000002" || retCode == "000003" {
|
||||
// retcode 为 000000,表示有数据,返回 retdata
|
||||
retData := gjson.GetBytes(respData, "retdata")
|
||||
|
Loading…
Reference in New Issue
Block a user