323 lines
8.5 KiB
TypeScript
323 lines
8.5 KiB
TypeScript
import { ApiProperty } from '@midwayjs/swagger';
|
|
|
|
export class UnifiedPaginationDTO<T> {
|
|
// 分页DTO用于承载统一分页信息与列表数据
|
|
@ApiProperty({ description: '列表数据' })
|
|
items: T[];
|
|
|
|
@ApiProperty({ description: '总数', example: 100 })
|
|
total: number;
|
|
|
|
@ApiProperty({ description: '当前页', example: 1 })
|
|
page: number;
|
|
|
|
@ApiProperty({ description: '每页数量', example: 20 })
|
|
per_page: number;
|
|
|
|
@ApiProperty({ description: '每页数量别名', example: 20 })
|
|
page_size?: number;
|
|
|
|
@ApiProperty({ description: '总页数', example: 5 })
|
|
totalPages: number;
|
|
}
|
|
|
|
export class UnifiedImageDTO {
|
|
// 图片DTO用于承载统一图片数据
|
|
@ApiProperty({ description: '图片ID' })
|
|
id: number | string;
|
|
|
|
@ApiProperty({ description: '图片URL' })
|
|
src: string;
|
|
|
|
@ApiProperty({ description: '图片名称' })
|
|
name?: string;
|
|
|
|
@ApiProperty({ description: '替代文本' })
|
|
alt?: string;
|
|
}
|
|
|
|
export class UnifiedProductDTO {
|
|
// 产品DTO用于承载统一产品数据
|
|
@ApiProperty({ description: '产品ID' })
|
|
id: string | number;
|
|
|
|
@ApiProperty({ description: '产品名称' })
|
|
name: string;
|
|
|
|
@ApiProperty({ description: '产品类型' })
|
|
type: string;
|
|
|
|
@ApiProperty({ description: '产品状态' })
|
|
status: string;
|
|
|
|
@ApiProperty({ description: '产品SKU' })
|
|
sku: string;
|
|
|
|
@ApiProperty({ description: '常规价格' })
|
|
regular_price: string;
|
|
|
|
@ApiProperty({ description: '销售价格' })
|
|
sale_price: string;
|
|
|
|
@ApiProperty({ description: '当前价格' })
|
|
price: string;
|
|
|
|
@ApiProperty({ description: '库存状态' })
|
|
stock_status: string;
|
|
|
|
@ApiProperty({ description: '库存数量' })
|
|
stock_quantity: number;
|
|
|
|
@ApiProperty({ description: '产品图片', type: [UnifiedImageDTO] })
|
|
images: UnifiedImageDTO[];
|
|
|
|
@ApiProperty({ description: '产品标签', type: 'json' })
|
|
tags?: string[];
|
|
|
|
@ApiProperty({ description: '产品属性', type: 'json' })
|
|
attributes: any[];
|
|
|
|
@ApiProperty({ description: '产品变体', type: 'json' })
|
|
variations?: any[];
|
|
|
|
@ApiProperty({ description: '创建时间' })
|
|
date_created: string;
|
|
|
|
@ApiProperty({ description: '更新时间' })
|
|
date_modified: string;
|
|
|
|
@ApiProperty({ description: '原始数据(保留备用)', type: 'json' })
|
|
raw?: any;
|
|
}
|
|
|
|
export class UnifiedOrderDTO {
|
|
// 订单DTO用于承载统一订单数据
|
|
@ApiProperty({ description: '订单ID' })
|
|
id: string | number;
|
|
|
|
@ApiProperty({ description: '订单号' })
|
|
number: string;
|
|
|
|
@ApiProperty({ description: '订单状态' })
|
|
status: string;
|
|
|
|
@ApiProperty({ description: '货币' })
|
|
currency: string;
|
|
|
|
@ApiProperty({ description: '总金额' })
|
|
total: string;
|
|
|
|
@ApiProperty({ description: '客户ID' })
|
|
customer_id: number;
|
|
|
|
@ApiProperty({ description: '客户姓名' })
|
|
customer_name: string;
|
|
|
|
@ApiProperty({ description: '客户邮箱' })
|
|
email: string;
|
|
|
|
@ApiProperty({ description: '订单项', type: 'json' })
|
|
line_items: any[];
|
|
|
|
@ApiProperty({ description: '销售项(兼容前端)', type: 'json' })
|
|
sales?: any[];
|
|
|
|
@ApiProperty({ description: '账单地址', type: 'json' })
|
|
billing: any;
|
|
|
|
@ApiProperty({ description: '收货地址', type: 'json' })
|
|
shipping: any;
|
|
|
|
@ApiProperty({ description: '账单地址全称' })
|
|
billing_full_address?: string;
|
|
|
|
@ApiProperty({ description: '收货地址全称' })
|
|
shipping_full_address?: string;
|
|
|
|
@ApiProperty({ description: '支付方式' })
|
|
payment_method: string;
|
|
|
|
@ApiProperty({ description: '创建时间' })
|
|
date_created: string;
|
|
|
|
@ApiProperty({ description: '更新时间' })
|
|
date_modified?: string;
|
|
|
|
@ApiProperty({ description: '原始数据', type: 'json' })
|
|
raw?: any;
|
|
}
|
|
|
|
export class UnifiedCustomerDTO {
|
|
// 客户DTO用于承载统一客户数据
|
|
@ApiProperty({ description: '客户ID' })
|
|
id: string | number;
|
|
|
|
@ApiProperty({ description: '头像URL' })
|
|
avatar?: string;
|
|
|
|
@ApiProperty({ description: '邮箱' })
|
|
email: string;
|
|
|
|
@ApiProperty({ description: '订单总数' })
|
|
orders?: number;
|
|
|
|
@ApiProperty({ description: '总花费' })
|
|
total_spend?: number;
|
|
|
|
@ApiProperty({ description: '创建时间' })
|
|
date_created?: string;
|
|
|
|
@ApiProperty({ description: '更新时间' })
|
|
date_modified?: string;
|
|
|
|
@ApiProperty({ description: '名' })
|
|
first_name?: string;
|
|
|
|
@ApiProperty({ description: '姓' })
|
|
last_name?: string;
|
|
|
|
@ApiProperty({ description: '名字' })
|
|
fullname?: string;
|
|
|
|
@ApiProperty({ description: '用户名' })
|
|
username?: string;
|
|
|
|
@ApiProperty({ description: '电话' })
|
|
phone?: string;
|
|
|
|
@ApiProperty({ description: '账单地址', type: 'json' })
|
|
billing?: any;
|
|
|
|
@ApiProperty({ description: '收货地址', type: 'json' })
|
|
shipping?: any;
|
|
|
|
@ApiProperty({ description: '原始数据', type: 'json' })
|
|
raw?: any;
|
|
}
|
|
|
|
export class UnifiedSubscriptionDTO {
|
|
// 订阅DTO用于承载统一订阅数据
|
|
@ApiProperty({ description: '订阅ID' })
|
|
id: string | number;
|
|
|
|
@ApiProperty({ description: '订阅状态' })
|
|
status: string;
|
|
|
|
@ApiProperty({ description: '客户ID' })
|
|
customer_id: number;
|
|
|
|
@ApiProperty({ description: '计费周期' })
|
|
billing_period: string;
|
|
|
|
@ApiProperty({ description: '计费间隔' })
|
|
billing_interval: number;
|
|
|
|
@ApiProperty({ description: '创建时间' })
|
|
date_created?: string;
|
|
|
|
@ApiProperty({ description: '更新时间' })
|
|
date_modified?: string;
|
|
|
|
@ApiProperty({ description: '开始时间' })
|
|
start_date: string;
|
|
|
|
@ApiProperty({ description: '下次支付时间' })
|
|
next_payment_date: string;
|
|
|
|
@ApiProperty({ description: '订单项', type: 'json' })
|
|
line_items: any[];
|
|
|
|
@ApiProperty({ description: '原始数据', type: 'json' })
|
|
raw?: any;
|
|
}
|
|
|
|
export class UnifiedMediaDTO {
|
|
// 媒体DTO用于承载统一媒体数据
|
|
@ApiProperty({ description: '媒体ID' })
|
|
id: number;
|
|
|
|
@ApiProperty({ description: '标题' })
|
|
title: string;
|
|
|
|
@ApiProperty({ description: '媒体类型' })
|
|
media_type: string;
|
|
|
|
@ApiProperty({ description: 'MIME类型' })
|
|
mime_type: string;
|
|
|
|
@ApiProperty({ description: '源URL' })
|
|
source_url: string;
|
|
|
|
@ApiProperty({ description: '创建时间' })
|
|
date_created: string;
|
|
|
|
@ApiProperty({ description: '更新时间' })
|
|
date_modified?: string;
|
|
}
|
|
|
|
export class UnifiedProductPaginationDTO extends UnifiedPaginationDTO<UnifiedProductDTO> {
|
|
// 产品分页DTO用于承载产品列表分页数据
|
|
@ApiProperty({ description: '列表数据', type: [UnifiedProductDTO] })
|
|
items: UnifiedProductDTO[];
|
|
}
|
|
|
|
export class UnifiedOrderPaginationDTO extends UnifiedPaginationDTO<UnifiedOrderDTO> {
|
|
// 订单分页DTO用于承载订单列表分页数据
|
|
@ApiProperty({ description: '列表数据', type: [UnifiedOrderDTO] })
|
|
items: UnifiedOrderDTO[];
|
|
}
|
|
|
|
export class UnifiedCustomerPaginationDTO extends UnifiedPaginationDTO<UnifiedCustomerDTO> {
|
|
// 客户分页DTO用于承载客户列表分页数据
|
|
@ApiProperty({ description: '列表数据', type: [UnifiedCustomerDTO] })
|
|
items: UnifiedCustomerDTO[];
|
|
}
|
|
|
|
export class UnifiedSubscriptionPaginationDTO extends UnifiedPaginationDTO<UnifiedSubscriptionDTO> {
|
|
// 订阅分页DTO用于承载订阅列表分页数据
|
|
@ApiProperty({ description: '列表数据', type: [UnifiedSubscriptionDTO] })
|
|
items: UnifiedSubscriptionDTO[];
|
|
}
|
|
|
|
export class UnifiedMediaPaginationDTO extends UnifiedPaginationDTO<UnifiedMediaDTO> {
|
|
// 媒体分页DTO用于承载媒体列表分页数据
|
|
@ApiProperty({ description: '列表数据', type: [UnifiedMediaDTO] })
|
|
items: UnifiedMediaDTO[];
|
|
}
|
|
|
|
export class UnifiedSearchParamsDTO {
|
|
// 统一查询参数DTO用于承载分页与筛选与排序参数
|
|
@ApiProperty({ description: '页码', example: 1 })
|
|
page?: number;
|
|
|
|
@ApiProperty({ description: '每页数量', example: 20 })
|
|
per_page?: number;
|
|
|
|
@ApiProperty({ description: '每页数量别名', example: 20 })
|
|
page_size?: number;
|
|
|
|
@ApiProperty({ description: '搜索关键词' })
|
|
search?: string;
|
|
|
|
@ApiProperty({ description: '状态' })
|
|
status?: string;
|
|
|
|
@ApiProperty({ description: '客户ID,用于筛选订单' })
|
|
customer_id?: number;
|
|
|
|
@ApiProperty({ description: '过滤条件对象' })
|
|
where?: Record<string, any>;
|
|
|
|
@ApiProperty({ description: '排序对象,例如 { "sku": "desc" }' })
|
|
order?: Record<string, 'asc' | 'desc'> | string;
|
|
|
|
@ApiProperty({ description: '排序字段(兼容旧入参)' })
|
|
orderby?: string;
|
|
|
|
@ApiProperty({ description: '排序方式(兼容旧入参)' })
|
|
orderDir?: 'asc' | 'desc';
|
|
|
|
@ApiProperty({ description: '选中ID列表,逗号分隔', required: false })
|
|
ids?: string;
|
|
}
|