feat: 商品导入修复 brand 字段命名 + 添加 unit 和错误日志
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
parent
ae72966766
commit
0a423af4d2
@ -63,7 +63,8 @@ export class ProductService {
|
||||
const item: any = {
|
||||
name: p.name, category_id: catId,
|
||||
price: p.price > 0 ? p.price : 0.01,
|
||||
brandName: p.brand || '', stock: p.quantity,
|
||||
brand: p.brand || '',
|
||||
unit: p.unit || '',
|
||||
sku: p.spec || p.name || '',
|
||||
}
|
||||
if (p.imageUrl) item.images = [p.imageUrl]
|
||||
@ -94,6 +95,9 @@ export class ProductService {
|
||||
const errors: Array<{ sku: string; name: string; error: string }> = items
|
||||
.filter(i => i.status === 'failed')
|
||||
.map(i => ({ sku: i.sku || '', name: i.name || '', error: i.error || '未知错误' }))
|
||||
if (errors.length > 0) {
|
||||
this.logger.warn(`B2B import_products 导入失败详情: ${errors.map(e => `[${e.sku}] ${e.name}: ${e.error}`).join(' | ')}`)
|
||||
}
|
||||
this.logger.log(`B2B import_products 完成: 导入 ${imported} 条, 失败 ${errors.length} 条, B2B IDs: ${b2bIds.join(',')}`)
|
||||
|
||||
if (b2bIds.length > 0) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user