From be2adefb91591b79e41980c239700f6049f59ae2 Mon Sep 17 00:00:00 2001 From: ziming Date: Fri, 27 Mar 2026 16:47:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=87=E6=8D=A2=E4=B8=BB=E4=BD=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/biz/register_tag.go | 1 + internal/biz/repo/product.go | 1 + internal/data/repoimpl/product.go | 9 +++++++++ 3 files changed, 11 insertions(+) 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})