From 6dc2375a793ed0e05d186cb923e50a35bea02a0b Mon Sep 17 00:00:00 2001 From: yml2213 Date: Mon, 14 Sep 2026 20:33:42 +0800 Subject: [PATCH] =?UTF-8?q?chore(catalog):=20=E6=B8=85=E7=90=86=20LEWAN=5F?= =?UTF-8?q?=20=E5=88=97=E8=A1=A8=E8=BF=87=E6=BB=A4=E4=B8=8E=E5=95=86?= =?UTF-8?q?=E5=93=81=E5=9B=BE=20UUID=20=E5=8E=86=E5=8F=B2=E5=9B=9E?= =?UTF-8?q?=E9=80=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 商品列表不再过滤镜像 SKU;图片只按英文 SKU 解析,修正 DLC 预设文案。 Co-authored-by: Cursor --- backend/internal/handler/merchant.go | 5 ++--- backend/internal/service/merchant_product.go | 15 +++++---------- frontend/src/pages/PlatformProducts.tsx | 4 ++-- frontend/src/utils/productImage.ts | 10 ++-------- 4 files changed, 11 insertions(+), 23 deletions(-) diff --git a/backend/internal/handler/merchant.go b/backend/internal/handler/merchant.go index a586c4c..74685d0 100644 --- a/backend/internal/handler/merchant.go +++ b/backend/internal/handler/merchant.go @@ -57,9 +57,8 @@ func mapKeys(values map[string]struct{}) []string { func (h *MerchantHandler) ListProducts(c *gin.Context) { page, size := pageParams(c) list, total, err := h.merchantSvc.ListMerchantProductsWithOptions(middleware.GetMerchantID(c), page, size, service.ListMerchantProductsOptions{ - Status: strings.TrimSpace(c.Query("status")), - Keyword: strings.TrimSpace(c.Query("keyword")), - ExcludeLegacyLewanSKU: true, // LEWAN_* 镜像已废弃,列表永不返回 + Status: strings.TrimSpace(c.Query("status")), + Keyword: strings.TrimSpace(c.Query("keyword")), }) if err != nil { if err.Error() == "无效的商品状态" { diff --git a/backend/internal/service/merchant_product.go b/backend/internal/service/merchant_product.go index 080f8e7..44c66b8 100644 --- a/backend/internal/service/merchant_product.go +++ b/backend/internal/service/merchant_product.go @@ -84,10 +84,9 @@ func (s *MerchantService) CreateMerchantProduct(merchantID uint, in CreateMercha } type ListMerchantProductsOptions struct { - ActiveOnly bool - ExcludeLegacyLewanSKU bool - Status string // active / inactive;空表示不限(ActiveOnly 优先) - Keyword string + ActiveOnly bool + Status string // active / inactive;空表示不限(ActiveOnly 优先) + Keyword string } func (s *MerchantService) ListMerchantProducts(merchantID uint, page, size int, activeOnly bool) ([]model.MerchantProduct, int64, error) { @@ -96,11 +95,10 @@ func (s *MerchantService) ListMerchantProducts(merchantID uint, page, size int, }) } -// ListMerchantProductsForClient 商户开放 API / 手工下单选品:排除 LEWAN_* 镜像,只返回英文主 sku。 +// ListMerchantProductsForClient 商户开放 API / 手工下单选品:只返回在售英文主 sku。 func (s *MerchantService) ListMerchantProductsForClient(merchantID uint, page, size int) ([]model.MerchantProduct, int64, error) { return s.ListMerchantProductsWithOptions(merchantID, page, size, ListMerchantProductsOptions{ - ActiveOnly: true, - ExcludeLegacyLewanSKU: true, + ActiveOnly: true, }) } @@ -116,9 +114,6 @@ func (s *MerchantService) ListMerchantProductsWithOptions(merchantID uint, page, } tx = tx.Where("status = ?", status) } - if opts.ExcludeLegacyLewanSKU { - tx = tx.Where("sku NOT ILIKE ?", "lewan_%") - } if keyword := strings.TrimSpace(opts.Keyword); keyword != "" { like := "%" + keyword + "%" tx = tx.Where("(sku ILIKE ? OR display_name ILIKE ?)", like, like) diff --git a/frontend/src/pages/PlatformProducts.tsx b/frontend/src/pages/PlatformProducts.tsx index ca9421e..307b080 100644 --- a/frontend/src/pages/PlatformProducts.tsx +++ b/frontend/src/pages/PlatformProducts.tsx @@ -879,9 +879,9 @@ export default function PlatformProducts() { - + diff --git a/frontend/src/utils/productImage.ts b/frontend/src/utils/productImage.ts index 26c4707..9ca49a1 100644 --- a/frontend/src/utils/productImage.ts +++ b/frontend/src/utils/productImage.ts @@ -7,7 +7,7 @@ export type ProductImageInput = { sku?: string | null - /** 上游缩略图 URL(乐玩/DLC);仅在无本地 SKU 图时作回退 */ + /** 上游缩略图 URL(乐玩/DLC);仅在无本地 SKU 图时作 image-proxy 回退 */ url?: string | null } @@ -25,8 +25,7 @@ export function resolveProductImageBySku(sku?: string | null): string { /** * 解析展示用商品图: * 1. 有 sku → `/images/products/{sku}.webp` - * 2. 否则从 url 提取乐玩 UUID → `/images/products/{uuid}.webp`(历史缓存) - * 3. 其它外链 → image-proxy(运行时落盘到 data/uploads/products,仅兜底) + * 2. 其它外链 → image-proxy(运行时落盘到 data/uploads/products,仅兜底) */ export function resolveProductImage(input?: string | ProductImageInput | null): string { if (input == null) return '' @@ -47,10 +46,5 @@ export function resolveProductImage(input?: string | ProductImageInput | null): if (!url) return '' if (url.startsWith('/')) return url - const uuidMatch = url.match(/\/products\/([a-zA-Z0-9-]+)(?:\/|\.|$)/) - if (uuidMatch?.[1]) { - return `/images/products/${uuidMatch[1]}.webp` - } - return `/api/delivery/v1/image-proxy?url=${encodeURIComponent(url)}` }