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