/** 优先使用商品已有描述;缺失时按商品 id 补查,最多等待 5 秒,失败不阻塞配置页。 */ import { productId } from "~/lib/product-id.js"; async function e(e, t) { if (typeof t.description == `string`) return t.description; let n = productId(t.id); if (n === null) return ``; try { let t = await e.get( `/product`, { product_ids: [n], page: 1, limit: 1, }, !1, { timeoutMs: 5e3, }, ), r = Array.isArray(t?.list) ? t.list.find((e) => e && Number(e.id) === n) : void 0; // 返回值仍是后端富文本,展示端必须经过 HTML 清洗,不能直接视为可信 HTML。 return typeof r?.description == `string` ? r.description : ``; } catch { return ``; } } export { e as t };