From bb4b857d9c90dd15521e70c87d0d61692798ea0f Mon Sep 17 00:00:00 2001 From: ziming Date: Thu, 27 Mar 2025 17:35:52 +0800 Subject: [PATCH] =?UTF-8?q?mock=20=E6=BB=A1=E8=B6=B3=E6=8B=9B=E8=A1=8C?= =?UTF-8?q?=E7=AC=AC=E4=B8=80=E6=AC=A1=E5=A4=B1=E8=B4=A5=EF=BC=8C=E4=BA=8C?= =?UTF-8?q?=E6=AC=A1=E6=88=90=E5=8A=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/biz/cmb.go | 2 +- internal/biz/order.go | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/internal/biz/cmb.go b/internal/biz/cmb.go index f9e4c2b..b2d8931 100644 --- a/internal/biz/cmb.go +++ b/internal/biz/cmb.go @@ -39,7 +39,7 @@ func (v *VoucherBiz) CmbOrder(ctx context.Context, req *bo.OrderCreateReqBo) (or } orderNo = order.OrderNo - return orderNo, nil + return orderNo, err } product, err3 := v.ProductRepo.GetByProductNo(ctx, req.ProductNo) diff --git a/internal/biz/order.go b/internal/biz/order.go index 991c6fe..8f17cf9 100644 --- a/internal/biz/order.go +++ b/internal/biz/order.go @@ -37,6 +37,13 @@ func (v *VoucherBiz) order(ctx context.Context, req *bo.OrderCreateReqBo, produc return nil, err } + // 模拟一次失败 + if err3 := v.fail(ctx, order, "mock 满足招行第一次失败,二次成功"); err3 != nil { + return nil, err3 + } + + return order, nil + return order, v.success(ctx, order, voucherNo) }