chore(catalog): 清理 LEWAN_ 列表过滤与商品图 UUID 历史回退
商品列表不再过滤镜像 SKU;图片只按英文 SKU 解析,修正 DLC 预设文案。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -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)}`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user