forked from yoone/API
1
0
Fork 0

fix(product.service): 支持英文分号和逗号分隔siteSkus字段

修改siteSkus字段的分隔符处理逻辑,使其同时支持英文分号和逗号作为分隔符,提高数据兼容性
This commit is contained in:
tikkhun 2026-01-09 16:54:52 +08:00
parent a00a95c9a3
commit a8d12a695e
1 changed files with 6 additions and 1 deletions

View File

@ -1466,7 +1466,12 @@ export class ProductService {
price: num(rec.price), price: num(rec.price),
promotionPrice: num(rec.promotionPrice), promotionPrice: num(rec.promotionPrice),
type: val(rec.type), type: val(rec.type),
siteSkus: rec.siteSkus ? String(rec.siteSkus).split(',').map(s => s.trim()).filter(Boolean) : undefined, siteSkus: rec.siteSkus
? String(rec.siteSkus)
.split(/[;,]/) // 支持英文分号或英文逗号分隔
.map(s => s.trim())
.filter(Boolean)
: undefined,
category, // 添加分类字段 category, // 添加分类字段
attributes: attributes.length > 0 ? attributes : undefined, attributes: attributes.length > 0 ? attributes : undefined,