diff --git a/src/adapter/shopyy.adapter.ts b/src/adapter/shopyy.adapter.ts index 2843547..5e90320 100644 --- a/src/adapter/shopyy.adapter.ts +++ b/src/adapter/shopyy.adapter.ts @@ -227,8 +227,10 @@ export class ShopyyAdapter implements ISiteAdapter { // ========== 订单映射方法 ========== mapPlatformToUnifiedOrder(item: ShopyyOrder): UnifiedOrderDTO { + console.log(item) + if(!item) throw new Error('订单数据不能为空') // 提取账单和送货地址 如果不存在则为空对象 - const billing = (item as any).billing_address || {}; + const billing = (item).bill_address || {}; const shipping = (item as any).shipping_address || {}; // 构建账单地址对象 @@ -237,7 +239,7 @@ export class ShopyyAdapter implements ISiteAdapter { last_name: billing.last_name || item.lastname || '', fullname: billing.name || `${item.firstname} ${item.lastname}`.trim(), company: billing.company || '', - email: item.customer_email || item.email || '', + email: item.customer_email || item.email || '',√ phone: billing.phone || (item as any).telephone || '', address_1: billing.address1 || item.payment_address || '', address_2: billing.address2 || '', @@ -440,7 +442,7 @@ export class ShopyyAdapter implements ISiteAdapter { } // 更新账单地址 - params.billing_address = params.billing_address || {}; + params.billing_address = params?.billing_address || {}; if (data.billing.first_name !== undefined) { params.billing_address.first_name = data.billing.first_name; } diff --git a/src/dto/shopyy.dto.ts b/src/dto/shopyy.dto.ts index b434fa8..37bd5e7 100644 --- a/src/dto/shopyy.dto.ts +++ b/src/dto/shopyy.dto.ts @@ -200,7 +200,7 @@ export interface ShopyyOrder { customer_email?: string; email?: string; // 地址字段 - billing_address?: { + bill_address?: { first_name?: string; last_name?: string; name?: string;