fix(card_apple_order): 优化充值余额查询错误处理
- 使用gerror.New封装查询余额失败的错误信息 - 调整未知错误处理时传递的错误信息,替换为err.Error() - 改善日志中充值余额查询失败的错误表达方式 - 提升错误信息的准确性和可读性
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"github.com/gogf/gf/v2/net/gtrace"
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
@@ -65,7 +66,7 @@ func (h *sAppleOrder) queryBalance(ctx context.Context, orderInfo *entity.V1Card
|
||||
Operation: consts.AppleRechargeOperationQuery,
|
||||
Remark: fmt.Sprintf("账号【%s】,卡密【%s】查询充值余额失败,失败原因:网络错误", accountInfo.Account, orderInfo.CardPass),
|
||||
}, nil)
|
||||
return 0, err
|
||||
return 0, gerror.New("查询充值余额失败")
|
||||
}
|
||||
if queryResp.Code != apple.CodeSuccess {
|
||||
_ = h.AddHistory(ctx, &model.AppleCardRechargeHistoryInput{
|
||||
@@ -103,7 +104,7 @@ func (h *sAppleOrder) handleRedeemResult(ctx context.Context, orderInfo *entity.
|
||||
|
||||
balance, err := h.queryBalance(ctx, orderInfo, accountInfo, "前")
|
||||
if err != nil {
|
||||
return h.handleRedeemUnknown(ctx, orderInfo, accountInfo, apple.CodeProxyRequestFailed.String())
|
||||
return h.handleRedeemUnknown(ctx, orderInfo, accountInfo, err.Error())
|
||||
}
|
||||
|
||||
resp, err := apple.NewClient().Redeem(ctx, redeemReq)
|
||||
|
||||
Reference in New Issue
Block a user