feat(订单): 添加父产品ID字段用于统计套餐

在订单服务和订单销售实体中添加 parentProductId 字段,用于区分套餐产品和单品。如果是套餐产品则记录父产品ID,单品则不记录该字段
This commit is contained in:
tikkhun 2026-01-17 09:31:41 +08:00
parent d39341d683
commit 8766cf4a4c
2 changed files with 8 additions and 2 deletions

View File

@ -37,11 +37,16 @@ export class OrderSale {
@Expose()
externalOrderItemId: string; // WooCommerce 订单item ID
@ApiProperty({name: "父产品 ID"})
@Column({ nullable: true })
@Expose()
parentProductId?: number; // 父产品 ID 用于统计套餐 如果是单品则不记录
@ApiProperty({name: "产品 ID"})
@Column()
@Expose()
productId: number;
@ApiProperty()
@Column()
@Expose()
@ -50,7 +55,7 @@ export class OrderSale {
@ApiProperty({ description: 'sku', type: 'string' })
@Expose()
@Column()
sku: string;
sku: string;// 库存产品sku
@ApiProperty()
@Column()

View File

@ -738,6 +738,7 @@ export class OrderService {
orderId: orderItem.orderId,
siteId: orderItem.siteId,
externalOrderItemId: orderItem.externalOrderItemId,
parentProductId: product.id, // 父产品 ID 用于统计套餐 如果是单品则不记录
productId: componentDetail.product.id,
name: componentDetail.product.name,
quantity: componentDetail.quantity * orderItem.quantity,