forked from yoone/API
feat(订单): 添加父产品ID字段用于统计套餐
在订单服务和订单销售实体中添加 parentProductId 字段,用于区分套餐产品和单品。如果是套餐产品则记录父产品ID,单品则不记录该字段
This commit is contained in:
parent
d39341d683
commit
8766cf4a4c
|
|
@ -37,11 +37,16 @@ export class OrderSale {
|
||||||
@Expose()
|
@Expose()
|
||||||
externalOrderItemId: string; // WooCommerce 订单item ID
|
externalOrderItemId: string; // WooCommerce 订单item ID
|
||||||
|
|
||||||
|
@ApiProperty({name: "父产品 ID"})
|
||||||
|
@Column({ nullable: true })
|
||||||
|
@Expose()
|
||||||
|
parentProductId?: number; // 父产品 ID 用于统计套餐 如果是单品则不记录
|
||||||
|
|
||||||
@ApiProperty({name: "产品 ID"})
|
@ApiProperty({name: "产品 ID"})
|
||||||
@Column()
|
@Column()
|
||||||
@Expose()
|
@Expose()
|
||||||
productId: number;
|
productId: number;
|
||||||
|
|
||||||
@ApiProperty()
|
@ApiProperty()
|
||||||
@Column()
|
@Column()
|
||||||
@Expose()
|
@Expose()
|
||||||
|
|
@ -50,7 +55,7 @@ export class OrderSale {
|
||||||
@ApiProperty({ description: 'sku', type: 'string' })
|
@ApiProperty({ description: 'sku', type: 'string' })
|
||||||
@Expose()
|
@Expose()
|
||||||
@Column()
|
@Column()
|
||||||
sku: string;
|
sku: string;// 库存产品sku
|
||||||
|
|
||||||
@ApiProperty()
|
@ApiProperty()
|
||||||
@Column()
|
@Column()
|
||||||
|
|
|
||||||
|
|
@ -738,6 +738,7 @@ export class OrderService {
|
||||||
orderId: orderItem.orderId,
|
orderId: orderItem.orderId,
|
||||||
siteId: orderItem.siteId,
|
siteId: orderItem.siteId,
|
||||||
externalOrderItemId: orderItem.externalOrderItemId,
|
externalOrderItemId: orderItem.externalOrderItemId,
|
||||||
|
parentProductId: product.id, // 父产品 ID 用于统计套餐 如果是单品则不记录
|
||||||
productId: componentDetail.product.id,
|
productId: componentDetail.product.id,
|
||||||
name: componentDetail.product.name,
|
name: componentDetail.product.name,
|
||||||
quantity: componentDetail.quantity * orderItem.quantity,
|
quantity: componentDetail.quantity * orderItem.quantity,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue