diff --git a/internal/biz/register_tag.go b/internal/biz/register_tag.go index 5a4c902..54ffb52 100644 --- a/internal/biz/register_tag.go +++ b/internal/biz/register_tag.go @@ -31,6 +31,7 @@ func (this *VoucherBiz) RegisterTag(ctx context.Context, id int32) error { } } + _ = this.ProductRepo.DelCacheByProductNo(ctx, stock.ProductNo) _, err = this.ProductRepo.GetByProductNo(ctx, stock.ProductNo) return err diff --git a/internal/biz/repo/product.go b/internal/biz/repo/product.go index fbf75f2..ef01d26 100644 --- a/internal/biz/repo/product.go +++ b/internal/biz/repo/product.go @@ -12,5 +12,6 @@ type ProductRepo interface { GetByBatchNo(ctx context.Context, batchNo string) (*bo.ProductBo, error) GetByMchStockId(ctx context.Context, mchId, stockId string) (*bo.ProductBo, error) GetByProductNo(ctx context.Context, productNo string) (*bo.ProductBo, error) + DelCacheByProductNo(ctx context.Context, productNo string) error UpdateByWxResp(ctx context.Context, id int32, req *do.WxResp) error } diff --git a/internal/data/repoimpl/product.go b/internal/data/repoimpl/product.go index d1510b4..93e3592 100644 --- a/internal/data/repoimpl/product.go +++ b/internal/data/repoimpl/product.go @@ -131,6 +131,15 @@ func (r *ProductRepoImpl) GetByMchStockId(ctx context.Context, mchId, stockId st return r.ToBo(item), nil } +func (r *ProductRepoImpl) DelCacheByProductNo(ctx context.Context, productNo string) error { + + c := vo.ProductQueryKey.BuildCache([]string{productNo}) + + _, _ = r.rdb.Rdb.Del(ctx, c.Key).Result() + + return nil +} + func (r *ProductRepoImpl) GetByProductNo(ctx context.Context, productNo string) (*bo.ProductBo, error) { c := vo.ProductQueryKey.BuildCache([]string{productNo})