禁用事务

This commit is contained in:
ziming 2025-03-26 14:12:59 +08:00
parent 0d4a5e3528
commit 258344421d
1 changed files with 25 additions and 27 deletions

View File

@ -24,13 +24,13 @@ func (v *VoucherBiz) GetByOutBizNo(ctx context.Context, req *bo.OrderCreateReqBo
func (v *VoucherBiz) CmbOrder(ctx context.Context, req *bo.OrderCreateReqBo) (orderNo string, err error) { 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) order, err3 := v.GetByOutBizNo(ctx, req)
if err3 != nil { if err3 != nil {
return err3 return orderNo, err3
} }
if order != nil { if order != nil {
@ -38,30 +38,28 @@ func (v *VoucherBiz) CmbOrder(ctx context.Context, req *bo.OrderCreateReqBo) (or
if order.ProductNo != "001" && order.Status.IsFail() { if order.ProductNo != "001" && order.Status.IsFail() {
if err4 := v.orderRetry(ctx, order); err4 != nil { if err4 := v.orderRetry(ctx, order); err4 != nil {
return err4 return orderNo, err4
} }
} }
orderNo = order.OrderNo orderNo = order.OrderNo
return nil return orderNo, nil
} }
product, err3 := v.ProductRepo.GetByProductNo(ctx, req.ProductNo) product, err3 := v.ProductRepo.GetByProductNo(ctx, req.ProductNo)
if err3 != nil { if err3 != nil {
return err3 return orderNo, err3
} }
order, err3 = v.order(ctx, req, product) order, err3 = v.order(ctx, req, product)
if err3 != nil { if err3 != nil {
return err3 return orderNo, err3
} }
orderNo = order.OrderNo orderNo = order.OrderNo
return nil return orderNo, nil
}) //})
return
} }
func (v *VoucherBiz) CmbQuery(ctx context.Context, orderNo string) (resp *v1.CmbQueryReply, err error) { func (v *VoucherBiz) CmbQuery(ctx context.Context, orderNo string) (resp *v1.CmbQueryReply, err error) {