满足压测处理

This commit is contained in:
李子铭 2025-03-21 14:44:24 +08:00
parent 1a8343cda8
commit 6dd9cfbbee
2 changed files with 21 additions and 15 deletions

View File

@ -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 {
if req.ProductNo != "001" {
order, err := v.OrderRepo.GetByOutBizNo(bizCtx, vo.OrderTypeCmb, req.OutBizNo)
if err != nil && !err2.IsDbNotFound(err) {
@ -38,6 +39,7 @@ func (v *VoucherBiz) CmbOrder(ctx context.Context, req *bo.OrderCreateReqBo) (or
orderNo = order.OrderNo
return nil
}
}
product, err := v.ProductRepo.GetByProductNo(bizCtx, req.ProductNo)
if err != nil {
@ -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
}

View File

@ -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)