切换主体

This commit is contained in:
ziming 2026-03-27 16:47:13 +08:00
parent 0e1ed3b426
commit be2adefb91
3 changed files with 11 additions and 0 deletions

View File

@ -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

View File

@ -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
}

View File

@ -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})