满足压测处理

This commit is contained in:
李子铭 2025-03-21 15:14:00 +08:00
parent bab72020ad
commit a91114d8ae
1 changed files with 17 additions and 21 deletions

View File

@ -20,37 +20,33 @@ func (v *VoucherBiz) CmbOrder(ctx context.Context, req *bo.OrderCreateReqBo) (or
err = lock.NewMutex(v.rdb.Rdb, c.TTL).Lock(bizCtx, c.Key, func(bizCtx context.Context) error { err = lock.NewMutex(v.rdb.Rdb, c.TTL).Lock(bizCtx, c.Key, func(bizCtx context.Context) error {
// 压测商品直接过 order, err3 := v.OrderRepo.GetByOutBizNo(bizCtx, vo.OrderTypeCmb, req.OutBizNo)
if req.ProductNo != "001" {
order, err := v.OrderRepo.GetByOutBizNo(bizCtx, vo.OrderTypeCmb, req.OutBizNo) if err3 != nil && !err2.IsDbNotFound(err3) {
return err3
}
if err != nil && !err2.IsDbNotFound(err) { if order != nil {
return err
}
if order != nil { if order.Status.IsFail() {
if order.Status.IsFail() { if err4 := v.orderRetry(bizCtx, order); err4 != nil {
return err4
if err = v.orderRetry(bizCtx, order); err != nil {
return err
}
} }
orderNo = order.OrderNo
return nil
} }
orderNo = order.OrderNo
return nil
} }
product, err := v.ProductRepo.GetByProductNo(bizCtx, req.ProductNo) product, err3 := v.ProductRepo.GetByProductNo(bizCtx, req.ProductNo)
if err != nil { if err3 != nil {
return err return err3
} }
order, err := v.order(bizCtx, req, product) order, err3 = v.order(bizCtx, req, product)
if err != nil { if err3 != nil {
return err return err3
} }
orderNo = order.OrderNo orderNo = order.OrderNo