cmb
This commit is contained in:
parent
8ebf0127de
commit
d61cd68faa
|
|
@ -17,7 +17,7 @@ func (v *VoucherBiz) CmbOrder(ctx context.Context, req *bo.OrderCreateReqBo) (or
|
||||||
|
|
||||||
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, err := v.OrderRepo.GetByOutBizNo(ctx, req.OutBizNo)
|
order, err := v.OrderRepo.GetByOutBizNo(ctx, req.AppID, req.OutBizNo)
|
||||||
|
|
||||||
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||||
return err
|
return err
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type OrderRepo interface {
|
type OrderRepo interface {
|
||||||
GetByOutBizNo(ctx context.Context, outBizNo string) (*bo.OrderBo, error)
|
GetByOutBizNo(ctx context.Context, appId, outBizNo string) (*bo.OrderBo, error)
|
||||||
GetByOrderNo(ctx context.Context, orderNo string) (*bo.OrderBo, error)
|
GetByOrderNo(ctx context.Context, orderNo string) (*bo.OrderBo, error)
|
||||||
Create(ctx context.Context, req *bo.OrderBo) (*bo.OrderBo, error)
|
Create(ctx context.Context, req *bo.OrderBo) (*bo.OrderBo, error)
|
||||||
GetByID(ctx context.Context, id uint64) (*bo.OrderBo, error)
|
GetByID(ctx context.Context, id uint64) (*bo.OrderBo, error)
|
||||||
|
|
|
||||||
|
|
@ -52,10 +52,10 @@ func (p *OrderRepoImpl) Create(ctx context.Context, req *bo.OrderBo) (*bo.OrderB
|
||||||
return p.ToBo(info), nil
|
return p.ToBo(info), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *OrderRepoImpl) GetByOutBizNo(ctx context.Context, outBizNo string) (*bo.OrderBo, error) {
|
func (p *OrderRepoImpl) GetByOutBizNo(ctx context.Context, appId, outBizNo string) (*bo.OrderBo, error) {
|
||||||
info := &model.Order{}
|
info := &model.Order{}
|
||||||
|
|
||||||
tx := p.DB(ctx).Where(model.Order{OutBizNo: outBizNo}).Find(&info)
|
tx := p.DB(ctx).Where(model.Order{AppID: appId, OutBizNo: outBizNo}).Find(&info)
|
||||||
|
|
||||||
if tx.Error != nil {
|
if tx.Error != nil {
|
||||||
return nil, tx.Error
|
return nil, tx.Error
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue