diff --git a/internal/biz/cmb.go b/internal/biz/cmb.go index 33805a0..ca63772 100644 --- a/internal/biz/cmb.go +++ b/internal/biz/cmb.go @@ -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 } diff --git a/internal/biz/cron_notice.go b/internal/biz/cron_notice.go index 088de0a..ab2d3aa 100644 --- a/internal/biz/cron_notice.go +++ b/internal/biz/cron_notice.go @@ -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 } diff --git a/internal/biz/repo/product.go b/internal/biz/repo/product.go index 8d9f031..a06caf6 100644 --- a/internal/biz/repo/product.go +++ b/internal/biz/repo/product.go @@ -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) } diff --git a/internal/data/repoimpl/product.go b/internal/data/repoimpl/product.go index cdfddce..02095f4 100644 --- a/internal/data/repoimpl/product.go +++ b/internal/data/repoimpl/product.go @@ -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()