This commit is contained in:
parent
a8dae49f45
commit
a1750d6959
|
|
@ -36,7 +36,7 @@ func (v *VoucherBiz) CmbOrder(ctx context.Context, req *bo.OrderCreateReqBo) (or
|
|||
return nil
|
||||
}
|
||||
|
||||
product, err := v.ProductRepo.GetByPNO(ctx, req.ProductNo)
|
||||
product, err := v.ProductRepo.GetByProductNo(ctx, req.ProductNo)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -98,7 +98,7 @@ func (v *VoucherBiz) CmbProductQuery(ctx context.Context, productNo string) (rep
|
|||
|
||||
err = lock.NewMutex(v.rdb.Rdb, c.TTL).Lock(ctx, c.Key, func(ctx context.Context) error {
|
||||
|
||||
product, err := v.ProductRepo.GetByPNO(ctx, productNo)
|
||||
product, err := v.ProductRepo.GetByProductNo(ctx, productNo)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ func (v *VoucherBiz) notice(ctx context.Context, order *bo.OrderBo) error {
|
|||
Type: order.Type,
|
||||
}
|
||||
|
||||
if err := v.cmbNotice(ctx, order, orderNotify); err != nil {
|
||||
if err = v.cmbNotice(ctx, order, orderNotify); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,5 +6,5 @@ import (
|
|||
)
|
||||
|
||||
type ProductRepo interface {
|
||||
GetByPNO(ctx context.Context, PNO string) (*bo.ProductBo, error)
|
||||
GetByProductNo(ctx context.Context, productNo string) (*bo.ProductBo, error)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,11 +32,11 @@ func (p *ProductRepoImpl) DB(ctx context.Context) *gorm.DB {
|
|||
return p.db.DB(ctx).WithContext(ctx).Model(model.Product{})
|
||||
}
|
||||
|
||||
func (r *ProductRepoImpl) GetByPNO(ctx context.Context, PNO string) (*bo.ProductBo, error) {
|
||||
func (r *ProductRepoImpl) GetByProductNo(ctx context.Context, productNo string) (*bo.ProductBo, error) {
|
||||
|
||||
var item *model.Product
|
||||
|
||||
c := vo.ProductQueryKey.BuildCache([]string{PNO})
|
||||
c := vo.ProductQueryKey.BuildCache([]string{productNo})
|
||||
|
||||
cacheValue, err := r.rdb.Rdb.Get(ctx, c.Key).Result()
|
||||
|
||||
|
|
@ -51,7 +51,7 @@ func (r *ProductRepoImpl) GetByPNO(ctx context.Context, PNO string) (*bo.Product
|
|||
return r.ToBo(item), nil
|
||||
}
|
||||
|
||||
cl := vo.ProductQueryLockKey.BuildCache([]string{PNO})
|
||||
cl := vo.ProductQueryLockKey.BuildCache([]string{productNo})
|
||||
|
||||
err = lock.NewMutex(r.rdb.Rdb, cl.TTL).Lock(ctx, cl.Key, func(ctx context.Context) error {
|
||||
|
||||
|
|
@ -65,7 +65,7 @@ func (r *ProductRepoImpl) GetByPNO(ctx context.Context, PNO string) (*bo.Product
|
|||
return json.Unmarshal([]byte(cacheValue), &item)
|
||||
}
|
||||
|
||||
item, err = r.getByPNO(ctx, item, PNO)
|
||||
item, err = r.getByProductNo(ctx, item, productNo)
|
||||
|
||||
b, err := json.Marshal(item)
|
||||
if err != nil {
|
||||
|
|
@ -82,10 +82,10 @@ func (r *ProductRepoImpl) GetByPNO(ctx context.Context, PNO string) (*bo.Product
|
|||
return r.ToBo(item), err
|
||||
}
|
||||
|
||||
func (r *ProductRepoImpl) getByPNO(ctx context.Context, item *model.Product, PNO string) (*model.Product, error) {
|
||||
func (r *ProductRepoImpl) getByProductNo(ctx context.Context, item *model.Product, productNo string) (*model.Product, error) {
|
||||
|
||||
db := r.DB(ctx)
|
||||
tx := db.Where(model.Product{ProductNo: PNO}).First(&item)
|
||||
tx := db.Where(model.Product{ProductNo: productNo}).First(&item)
|
||||
|
||||
if tx.Error != nil {
|
||||
sqlDB, _ := db.DB()
|
||||
|
|
|
|||
Loading…
Reference in New Issue