fix(card_apple_order): 优化查询订单失败时的错误处理与日志记录
- 修改网络错误处理逻辑,增加充值历史记录记录失败详情 - 删除原有的特定错误码处理,简化错误判断流程 - 在订单查询异常时,添加详细的账号和卡密失败原因备注 - 保留其他错误情况下的历史记录添加功能,增强可追溯性
This commit is contained in:
@@ -57,14 +57,16 @@ func (h *sAppleOrder) queryBalance(ctx context.Context, orderInfo *entity.V1Card
|
||||
})
|
||||
span.AddEvent("查询订单")
|
||||
if err != nil {
|
||||
_ = h.handleRedeemUnknown(ctx, orderInfo, accountInfo, "订单查询网络错误"+err.Error())
|
||||
_ = h.AddHistory(ctx, &model.AppleCardRechargeHistoryInput{
|
||||
RechargeId: int(orderInfo.Id),
|
||||
OrderNo: orderInfo.OrderNo,
|
||||
AccountID: accountInfo.Id,
|
||||
AccountName: accountInfo.Account,
|
||||
Operation: consts.AppleRechargeOperationQuery,
|
||||
Remark: fmt.Sprintf("账号【%s】,卡密【%s】查询充值余额失败,失败原因:网络错误", accountInfo.Account, orderInfo.CardPass),
|
||||
}, nil)
|
||||
return 0, err
|
||||
}
|
||||
// 3. 苹果账户原因错误(8001-8005)
|
||||
if queryResp.Code >= 8001 && queryResp.Code <= 8005 {
|
||||
_ = h.handleAccountError(ctx, orderInfo, accountInfo, queryResp.Code)
|
||||
return 0, errors.New(queryResp.Code.String())
|
||||
}
|
||||
if queryResp.Code != apple.CodeSuccess {
|
||||
_ = h.AddHistory(ctx, &model.AppleCardRechargeHistoryInput{
|
||||
RechargeId: int(orderInfo.Id),
|
||||
|
||||
Reference in New Issue
Block a user