过滤调该类型错误通知
This commit is contained in:
parent
fb4b094aed
commit
0add233ebe
|
|
@ -35,4 +35,5 @@ enum WechatErr{
|
|||
WechatNaturalPersonRuleBlocked = 25 [(errors.code) = 500];
|
||||
WechatResourceNotExists = 26 [(errors.code) = 500];
|
||||
WechatFrequencyLimited = 27 [(errors.code) = 500];
|
||||
WechatAccountFail = 28 [(errors.code) = 500];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ func (v *VoucherBiz) order(ctx context.Context, req *bo.OrderCreateReqBo, produc
|
|||
// 真实发放
|
||||
voucherNo, err := v.WechatCpnRepo.Order(ctx, order)
|
||||
if err != nil {
|
||||
if err3 := v.fail(ctx, order, err.Error()); err3 != nil {
|
||||
if err3 := v.fail(ctx, order, err); err3 != nil {
|
||||
return nil, err3
|
||||
}
|
||||
return nil, err
|
||||
|
|
@ -158,13 +158,17 @@ func (v *VoucherBiz) success(ctx context.Context, order *bo.OrderBo, voucherNo s
|
|||
return v.OrderRepo.Success(ctx, order.ID, voucherNo)
|
||||
}
|
||||
|
||||
func (v *VoucherBiz) fail(ctx context.Context, order *bo.OrderBo, remark string) error {
|
||||
func (v *VoucherBiz) fail(ctx context.Context, order *bo.OrderBo, errReq error) error {
|
||||
|
||||
if err := v.OrderRepo.Fail(ctx, order.ID, remark); err != nil {
|
||||
if err := v.OrderRepo.Fail(ctx, order.ID, errReq.Error()); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
//return v.alarm(ctx, order, remark)
|
||||
|
||||
if err2.IsWechatAccountFail(errReq) {
|
||||
return nil // 过滤调该类型错误通知
|
||||
}
|
||||
|
||||
return v.alarm(ctx, order, errReq.Error())
|
||||
}
|
||||
|
||||
func (v *VoucherBiz) alarm(ctx context.Context, order *bo.OrderBo, errMsg string) error {
|
||||
|
|
|
|||
|
|
@ -249,6 +249,7 @@ const (
|
|||
ErrorWechatNaturalPersonRuleBlocked = "被自然人规则拦截"
|
||||
ErrorWechatResourceNotExists = "批次不存在"
|
||||
ErrorWechatFrequencyLimited = "当前请求人数过多,请稍后重试"
|
||||
ErrorWechatAccountFail = "该用户账号异常,无法领券。商家可联系微信支付或让用户联系微信支付客服处理"
|
||||
)
|
||||
|
||||
// WechatError 映射错误描述到具体的错误处理
|
||||
|
|
@ -280,6 +281,7 @@ var WechatError = map[string]*errors.Error{
|
|||
ErrorWechatNaturalPersonRuleBlocked: err2.ErrorWechatNaturalPersonRuleBlocked(ErrorWechatNaturalPersonRuleBlocked),
|
||||
ErrorWechatResourceNotExists: err2.ErrorWechatResourceNotExists(ErrorWechatResourceNotExists),
|
||||
ErrorWechatFrequencyLimited: err2.ErrorWechatFrequencyLimited(ErrorWechatFrequencyLimited),
|
||||
ErrorWechatAccountFail: err2.ErrorWechatAccountFail(ErrorWechatAccountFail),
|
||||
}
|
||||
|
||||
type ErrBody struct {
|
||||
|
|
|
|||
Loading…
Reference in New Issue