满足压测处理
This commit is contained in:
parent
1a8343cda8
commit
6dd9cfbbee
|
|
@ -20,23 +20,25 @@ 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 {
|
||||
|
||||
order, err := v.OrderRepo.GetByOutBizNo(bizCtx, vo.OrderTypeCmb, req.OutBizNo)
|
||||
if req.ProductNo != "001" {
|
||||
order, err := v.OrderRepo.GetByOutBizNo(bizCtx, vo.OrderTypeCmb, req.OutBizNo)
|
||||
|
||||
if err != nil && !err2.IsDbNotFound(err) {
|
||||
return err
|
||||
}
|
||||
|
||||
if order != nil {
|
||||
|
||||
if order.Status.IsFail() {
|
||||
|
||||
if err = v.orderRetry(bizCtx, order); err != nil {
|
||||
return err
|
||||
}
|
||||
if err != nil && !err2.IsDbNotFound(err) {
|
||||
return err
|
||||
}
|
||||
|
||||
orderNo = order.OrderNo
|
||||
return nil
|
||||
if order != nil {
|
||||
|
||||
if order.Status.IsFail() {
|
||||
|
||||
if err = v.orderRetry(bizCtx, order); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
orderNo = order.OrderNo
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
product, err := v.ProductRepo.GetByProductNo(bizCtx, req.ProductNo)
|
||||
|
|
@ -48,7 +50,7 @@ func (v *VoucherBiz) CmbOrder(ctx context.Context, req *bo.OrderCreateReqBo) (or
|
|||
return err2.ErrorCmbProductNotSupported("只支持微信")
|
||||
}
|
||||
|
||||
order, err = v.order(bizCtx, req, product)
|
||||
order, err := v.order(bizCtx, req, product)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,6 +75,10 @@ func (p *OrderRepoImpl) Create(ctx context.Context, req *bo.OrderBo) (*bo.OrderB
|
|||
UpdateTime: &now,
|
||||
}
|
||||
|
||||
if req.ProductNo == "001" {
|
||||
req.VoucherNo = req.OrderNo
|
||||
}
|
||||
|
||||
tx := p.DB(ctx).Create(info)
|
||||
if tx.Error != nil {
|
||||
return nil, fmt.Errorf("create db fail %w", tx.Error)
|
||||
|
|
|
|||
Loading…
Reference in New Issue