// WooCommerce 平台原始数据类型定义 // 仅包含当前映射逻辑所需字段以保持简洁与类型安全 // 产品类型 export interface WooProduct { // 产品主键 id: number; // 创建时间 date_created: string; // 创建时间(GMT) date_created_gmt: string; // 更新时间 date_modified: string; // 更新时间(GMT) date_modified_gmt: string; // 产品类型 simple grouped external variable type: string; // 产品状态 draft pending private publish status: string; // 是否为特色产品 featured: boolean; // 目录可见性选项:visible, catalog, search and hidden. Default is visible. catalog_visibility: string; // 常规价格 regular_price?: string; // 促销价格 sale_price?: string; // 当前价格 price?: string; price_html?: string; date_on_sale_from?: string; // Date the product is on sale from. date_on_sale_from_gmt?: string; // Date the product is on sale from (GMT). date_on_sale_to?: string; // Date the product is on sale to. date_on_sale_to_gmt?: string; // Date the product is on sale to (GMT). on_sale: boolean; // Whether the product is on sale. purchasable: boolean; // Whether the product is purchasable. total_sales: number; // Total sales for this product. virtual: boolean; // Whether the product is virtual. downloadable: boolean; // Whether the product is downloadable. downloads: Array<{ id?: number; name?: string; file?: string }>; // Downloadable files for the product. download_limit: number; // Download limit. download_expiry: number; // Download expiry days. external_url: string; // URL of the external product. global_unique_id: string; // GTIN, UPC, EAN or ISBN - a unique identifier for each distinct product and service that can be purchased. // 产品SKU sku: string; // 产品名称 name: string; // 产品描述 description: string; // 产品短描述 short_description: string; // 产品永久链接 permalink: string; // 产品URL路径 slug: string; // 库存状态 stock_status?: 'instock' | 'outofstock' | 'onbackorder'; // 库存数量 stock_quantity?: number; // 是否管理库存 manage_stock?: boolean; // 缺货预定设置 no notify yes backorders?: 'no' | 'notify' | 'yes'; // 是否允许缺货预定 只读 backorders_allowed?: boolean; // 是否处于缺货预定状态 只读 backordered?: boolean; // 是否单独出售 sold_individually?: boolean; // 重量 weight?: string; // 尺寸 dimensions?: { length?: string; width?: string; height?: string }; // 是否需要运输 只读 shipping_required?: boolean; // 运输是否计税 只读 shipping_taxable?: boolean; // 运输类别 slug shipping_class?: string; // 运输类别ID 只读 shipping_class_id?: number; // 图片列表 images?: Array<{ id: number; src: string; name?: string; alt?: string }>; // 属性列表 attributes?: Array<{ id?: number; name?: string; position?: number; visible?: boolean; variation?: boolean; options?: string[]; }>; // 变体列表 variations?: number[]; // 默认变体属性 default_attributes?: Array<{ id?: number; name?: string; option?: string }>; // 允许评论 reviews_allowed?: boolean; // 平均评分 只读 average_rating?: string; // 评分数量 只读 rating_count?: number; // 相关产品ID列表 只读 related_ids?: number[]; // 追加销售产品ID列表 upsell_ids?: number[]; // 交叉销售产品ID列表 cross_sell_ids?: number[]; // 父产品ID parent_id?: number; // 购买备注 purchase_note?: string; // 分类列表 categories?: Array<{ id: number; name?: string; slug?: string }>; // 标签列表 tags?: Array<{ id: number; name?: string; slug?: string }>; // 菜单排序 menu_order?: number; // 元数据 meta_data?: Array<{ id?: number; key: string; value: any }>; } export interface WooVariation{ } // 订单类型 export interface WooOrder { // 订单主键 id: number; // 父订单ID parent_id?: number; // 订单号 number: string; // 订单键 只读 order_key?: string; // 创建来源 created_via?: string; // WooCommerce版本 只读 version?: string; // 状态 status: string; // 币种 currency: string; // 价格是否含税 只读 prices_include_tax?: boolean; // 总金额 total: string; // 总税额 只读 total_tax?: string; // 折扣总额 只读 discount_total?: string; // 折扣税额 只读 discount_tax?: string; // 运费总额 只读 shipping_total?: string; // 运费税额 只读 shipping_tax?: string; // 购物车税额 只读 cart_tax?: string; // 客户ID customer_id: number; // 客户IP 只读 customer_ip_address?: string; // 客户UA 只读 customer_user_agent?: string; // 客户备注 customer_note?: string; // 账单信息 billing?: { first_name?: string; last_name?: string; email?: string; company?: string; address_1?: string; address_2?: string; city?: string; state?: string; postcode?: string; country?: string; phone?: string; fullname?: string; }; // 收货信息 shipping?: { first_name?: string; last_name?: string; company?: string; address_1?: string; address_2?: string; city?: string; state?: string; postcode?: string; country?: string; phone?: string; fullname?: string; }; // 订单项 line_items?: Array<{ product_id?: number; variation_id?: number; quantity?: number; subtotal?: string; subtotal_tax?: string; total?: string; total_tax?: string; name?: string; sku?: string; price?: number; meta_data?: Array<{ key: string; value: any }>; [key: string]: any; }>; // 税费行 只读 tax_lines?: Array<{ id?: number; rate_code?: string; rate_id?: number; label?: string; tax_total?: string; shipping_tax_total?: string; compound?: boolean; meta_data?: any[]; }>; // 物流费用行 shipping_lines?: Array<{ id?: number; method_title?: string; method_id?: string; total?: string; total_tax?: string; taxes?: any[]; meta_data?: any[]; }>; // 手续费行 fee_lines?: Array<{ id?: number; name?: string; tax_class?: string; tax_status?: string; total?: string; total_tax?: string; taxes?: any[]; meta_data?: any[]; }>; // 优惠券行 coupon_lines?: Array<{ id?: number; code?: string; discount?: string; discount_tax?: string; meta_data?: any[]; }>; // 退款列表 只读 refunds?: Array; // 支付方式标题 payment_method_title?: string; // 支付方式ID payment_method?: string; // 交易ID transaction_id?: string; // 已支付时间 date_paid?: string; date_paid_gmt?: string; // 完成时间 date_completed?: string; date_completed_gmt?: string; // 购物车hash 只读 cart_hash?: string; // 设置为已支付 写入专用 set_paid?: boolean; // 元数据 meta_data?: Array<{ id?: number; key: string; value: any }>; // 创建与更新时间 date_created: string; date_created_gmt?: string; date_modified?: string; date_modified_gmt?: string; } export interface WooOrderRefund { id?: number; reason?: string; total?: string; } // 订阅类型 export interface WooSubscription { // 订阅主键 id: number; // 订阅状态 status: string; // 客户ID customer_id: number; // 计费周期 billing_period?: string; // 计费间隔 billing_interval?: number; // 开始时间 start_date?: string; // 下次支付时间 next_payment_date?: string; // 订阅项 line_items?: any[]; // 创建时间 date_created?: string; // 更新时间 date_modified?: string; } // WordPress 媒体类型 export interface WpMedia { // 媒体主键 id: number; // 标题可能为字符串或包含rendered的对象 title?: { rendered?: string } | string; // 媒体类型 media_type?: string; // MIME类型 mime_type?: string; // 源地址 source_url?: string; // 创建时间兼容date字段 date_created?: string; date?: string; // 更新时间兼容modified字段 date_modified?: string; modified?: string; } // 评论类型 export interface WooReview { // 评论ID id: number; // 评论内容 review: string; // 评分 rating: number; // 评论者 reviewer: string; // 评论者邮箱 reviewer_email: string; // 状态 status: string; // 产品ID product_id: number; // 创建日期 date_created: string; // 更新日期 } // 客户类型 export interface WooCustomer { // 客户主键 id: number; // 头像URL avatar_url?: string; // 邮箱 email: string; // 订单总数 orders?: number; // 总花费 total_spent?: number | string; // 名 first_name?: string; // 姓 last_name?: string; // 用户名 username?: string; // 角色 只读 role?: string; // 密码 写入专用 password?: string; // 账单信息 billing?: { first_name?: string; last_name?: string; email?: string; company?: string; phone?: string; address_1?: string; address_2?: string; city?: string; state?: string; postcode?: string; country?: string; }; // 收货信息 shipping?: { first_name?: string; last_name?: string; company?: string; phone?: string; address_1?: string; address_2?: string; city?: string; state?: string; postcode?: string; country?: string; }; // 是否为付费客户 只读 is_paying_customer?: boolean; // 元数据 meta_data?: Array<{ id?: number; key: string; value: any }>; // 创建时间 date_created?: string; date_created_gmt?: string; // 更新时间 date_modified?: string; date_modified_gmt?: string; } // Webhook类型 export interface WooWebhook { id: number; name: string; status: string; topic: string; resource: string; event: string; hooks: string; delivery_url: string; secret: string; date_created: string; date_created_gmt: string; date_modified: string; date_modified_gmt: string; api_version: string; meta_data?: Array<{ id?: number; key: string; value: any }>; } export interface WooOrderSearchParams { context: WooContext; page: number; per_page: number; search: string; after: string; before: string; modified_after: string; modified_before: string; date_are_gmt: boolean; exclude: string[]; include: string[]; offset: number; order: string; orderby: string; parant: string[]; status: (WooOrderStatusSearchParams)[]; customer: number; product: number; dp: number; created_via: string; } export enum WooOrderStatusSearchParams { pending, processing, "on-hold", completed, cancelled, refunded, failed, trash, any } export interface WooProductSearchParams extends ListParams { slug: string; status: string[]; include_status: string; exclude_status: string; type: string; include_types: string; exclude_types: string; sku: string; featured: boolean; category: string; tag: string; shipping_class: string; attribute: string; attribute_term: string; tax_class: string; on_sale: boolean; min_price: string; max_price: string; stock_status: string; virtual: boolean; downloadable: boolean; } export interface ListParams { context: WooContext; page: number; per_page: number; search: string; search_fields: any[]; after: string; before: string; modified_after: string; modified_before: string; date_are_gmt: boolean; exclude: string[]; include: string[]; offset: number; order: string; orderby: string; parant: string[]; parent_exclude: string[]; } export enum WooContext { view, edit } export enum WooProductStatusSearchParams { any, draft, pending, private, publish } // 发货相关DTO export class WooShipOrderItemDTO { order_item_id: number; quantity: number; } export class WooShipOrderDTO { tracking_number?: string; shipping_provider?: string; shipping_method?: string; items?: WooShipOrderItemDTO[]; } export class WooCancelShipOrderDTO { reason?: string; shipment_id?: string; } export class WooBatchShipOrderItemDTO { order_id: string; tracking_number?: string; shipping_provider?: string; shipping_method?: string; items?: WooShipOrderItemDTO[]; } export class WooBatchShipOrdersDTO { orders: WooBatchShipOrderItemDTO[]; }