From 11814a7c39eda0911da10697bacea5babf65711a Mon Sep 17 00:00:00 2001 From: tikkhun Date: Tue, 18 Nov 2025 17:25:47 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E8=AE=A2=E5=8D=95):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E8=AE=A2=E5=8D=95=E9=A1=B9=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=92=8C=E6=89=A9=E5=B1=95=E8=AE=A2=E5=8D=95=E9=A1=B9=E5=AE=9E?= =?UTF-8?q?=E4=BD=93=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加获取订单项列表的接口/getOrderItems 扩展OrderItem实体字段以支持更多订单项信息,包括税类、税明细、元数据、全局ID、商品图片等 --- src/controller/order.controller.ts | 10 +++++++ src/entity/order_item.entity.ts | 45 ++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/src/controller/order.controller.ts b/src/controller/order.controller.ts index aa71e46..79f1a61 100644 --- a/src/controller/order.controller.ts +++ b/src/controller/order.controller.ts @@ -97,6 +97,16 @@ export class OrderController { } } + @ApiOkResponse() + @Get('/getOrderItems') + async getOrderItems(@Query() param: QueryOrderSalesDTO) { + try { + return successResponse(await this.orderService.getOrderItems(param)); + } catch (error) { + return errorResponse(error?.message || '获取失败'); + } + } + @ApiOkResponse({ type: OrderDetailRes, }) diff --git a/src/entity/order_item.entity.ts b/src/entity/order_item.entity.ts index d41eef2..0a3fd5b 100644 --- a/src/entity/order_item.entity.ts +++ b/src/entity/order_item.entity.ts @@ -76,16 +76,61 @@ export class OrderItem { @Expose() total_tax: number; + @ApiProperty() + @Column({ nullable: true }) + @Expose() + tax_class?: string; // 税类(来自 line_items.tax_class) + + @ApiProperty() + @Column({ type: 'json', nullable: true }) + @Expose() + taxes?: any[]; // 税明细(来自 line_items.taxes,数组) + + @ApiProperty() + @Column({ type: 'json', nullable: true }) + @Expose() + meta_data?: any[]; // 行项目元数据(包含订阅相关键值) + @ApiProperty() @Column({ nullable: true }) @Expose() sku?: string; + @ApiProperty() + @Column({ nullable: true }) + @Expose() + global_unique_id?: string; // 全局唯一ID(部分主题/插件会提供) + @ApiProperty() @Column('decimal', { precision: 10, scale: 2 }) @Expose() price: number; + @ApiProperty() + @Column({ type: 'json', nullable: true }) + @Expose() + image?: { id?: string | number; src?: string }; // 商品图片(对象,包含 id/src) + + @ApiProperty() + @Column({ nullable: true }) + @Expose() + parent_name?: string; // 父商品名称(组合/捆绑时可能使用) + + @ApiProperty() + @Column({ nullable: true }) + @Expose() + bundled_by?: string; // 捆绑来源标识(bundled_by) + + @ApiProperty() + @Column({ nullable: true }) + @Expose() + bundled_item_title?: string; // 捆绑项标题 + + @ApiProperty() + @Column({ type: 'json', nullable: true }) + @Expose() + bundled_items?: any[]; // 捆绑项列表(数组) + @ApiProperty({ example: '2022-12-12 11:11:11', description: '创建时间',