From 258344421d38846d1129e720c4e3bf6dd6bca186 Mon Sep 17 00:00:00 2001 From: ziming Date: Wed, 26 Mar 2025 14:12:59 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A6=81=E7=94=A8=E4=BA=8B=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/biz/cmb.go | 52 ++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/internal/biz/cmb.go b/internal/biz/cmb.go index 983707c..deaa656 100644 --- a/internal/biz/cmb.go +++ b/internal/biz/cmb.go @@ -24,44 +24,42 @@ func (v *VoucherBiz) GetByOutBizNo(ctx context.Context, req *bo.OrderCreateReqBo func (v *VoucherBiz) CmbOrder(ctx context.Context, req *bo.OrderCreateReqBo) (orderNo string, err error) { - c := vo.CmbOrderLockKey.BuildCache([]string{req.OutBizNo, req.Type.String()}) + //c := vo.CmbOrderLockKey.BuildCache([]string{req.OutBizNo, req.Type.String()}) - err = lock.NewMutex(v.rdb.Rdb, c.TTL).Lock(ctx, c.Key, func(ctx context.Context) error { + //err = lock.NewMutex(v.rdb.Rdb, c.TTL).Lock(ctx, c.Key, func(ctx context.Context) error { - order, err3 := v.GetByOutBizNo(ctx, req) - if err3 != nil { - return err3 - } + order, err3 := v.GetByOutBizNo(ctx, req) + if err3 != nil { + return orderNo, err3 + } - if order != nil { + if order != nil { - if order.ProductNo != "001" && order.Status.IsFail() { + if order.ProductNo != "001" && order.Status.IsFail() { - if err4 := v.orderRetry(ctx, order); err4 != nil { - return err4 - } + if err4 := v.orderRetry(ctx, order); err4 != nil { + return orderNo, err4 } - - orderNo = order.OrderNo - return nil - } - - product, err3 := v.ProductRepo.GetByProductNo(ctx, req.ProductNo) - if err3 != nil { - return err3 - } - - order, err3 = v.order(ctx, req, product) - if err3 != nil { - return err3 } orderNo = order.OrderNo + return orderNo, nil + } - return nil - }) + product, err3 := v.ProductRepo.GetByProductNo(ctx, req.ProductNo) + if err3 != nil { + return orderNo, err3 + } - return + order, err3 = v.order(ctx, req, product) + if err3 != nil { + return orderNo, err3 + } + + orderNo = order.OrderNo + + return orderNo, nil + //}) } func (v *VoucherBiz) CmbQuery(ctx context.Context, orderNo string) (resp *v1.CmbQueryReply, err error) {