diff --git a/apps/api/src/product/product.service.ts b/apps/api/src/product/product.service.ts index 71d5334..8dfe105 100644 --- a/apps/api/src/product/product.service.ts +++ b/apps/api/src/product/product.service.ts @@ -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) {