zksu
/
API
forked from yoone/API
1
0
Fork 0
API/src/dto/shopyy.dto.ts

434 lines
9.7 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Shopyy 平台原始数据类型定义
// 仅包含当前映射逻辑所需字段以保持简洁与类型安全
export interface ShopyyTag {
id?: number;
name?: string;
}
// 产品类型
export interface ShopyyProduct {
// 产品主键
id: number;
// 产品名称或标题
name?: string;
title?: string;
// 产品类型
product_type?: string | number;
// 产品状态数值 1为发布 其他为草稿
status: number;
// 变体信息
variant?: {
sku?: string;
price?: string;
};
// 价格
special_price?: string;
price?: string;
// 库存追踪标识 1表示跟踪
inventory_tracking?: number;
// 库存数量
inventory_quantity?: number;
// 图片列表
images?: Array<{
id?: number;
src: string;
alt?: string;
position?: string | number;
}>;
// 主图
image?: {
src: string;
file_name?: string;
alt?: string;
file_size?: number;
width?: number;
height?: number;
id?: number;
position?: number | string;
file_type?: string;
};
// 标签
tags?: ShopyyTag[];
// 变体列表
variants?: ShopyyVariant[];
// 分类集合
collections?: Array<{ id?: number; title?: string }>;
// 规格选项列表
options?: Array<{
id?: number;
position?: number | string;
option_name?: string;
values?: Array<{ option_value?: string; id?: number; position?: number }>;
}>;
// 发布与标识
published_at?: string;
handle?: string;
spu?: string;
// 创建与更新时间
created_at?: string | number;
updated_at?: string | number;
}
// 变体类型
export interface ShopyyVariant {
id: number;
sku?: string;
price?: string;
special_price?: string;
inventory_tracking?: number;
inventory_quantity?: number;
available?: number;
barcode?: string;
weight?: number;
image?: { src: string; id?: number; file_name?: string; alt?: string; position?: number | string };
position?: number | string;
sku_code?: string;
}
// 订单类型
export interface ShopyyOrder {
// 主键与外部ID
id?: number;
order_id?: number;
// 订单号
order_number?: string;
order_sn?: string;
// 状态
status?: number | string;
order_status?: number | string;
// 币种
currency_code?: string;
currency?: string;
// 金额
total_price?: string | number;
total_amount?: string | number;
current_total_price?: string | number;
current_subtotal_price?: string | number;
current_shipping_price?: string | number;
current_tax_price?: string | number;
current_coupon_price?: string | number;
current_payment_price?: string | number;
// 客户ID
customer_id?: number;
user_id?: number;
// 客户信息
customer_name?: string;
firstname?: string;
lastname?: string;
customer_email?: string;
email?: string;
// 地址字段
billing_address?: {
first_name?: string;
last_name?: string;
name?: string;
company?: string;
phone?: string;
address1?: string;
address2?: string;
city?: string;
province?: string;
zip?: string;
country_name?: string;
country_code?: string;
};
shipping_address?: {
first_name?: string;
last_name?: string;
name?: string;
company?: string;
phone?: string;
address1?: string;
address2?: string;
city?: string;
province?: string;
zip?: string;
country_name?: string;
country_code?: string;
} | string;
telephone?: string;
payment_address?: string;
payment_city?: string;
payment_zone?: string;
payment_postcode?: string;
payment_country?: string;
shipping_city?: string;
shipping_zone?: string;
shipping_postcode?: string;
shipping_country?: string;
// 订单项集合
products?: Array<{
id?: number;
name?: string;
product_title?: string;
product_id?: number;
quantity?: number;
price?: string | number;
sku?: string;
sku_code?: string;
}>;
// 支付方式
payment_method?: string;
payment_id?: number;
payment_cards?: Array<{
store_id?: number;
card_len?: number;
card_suffix?: number;
year?: number;
payment_status?: number;
created_at?: number;
month?: number;
updated_at?: number;
payment_id?: number;
payment_interface?: string;
card_prefix?: number;
id?: number;
order_id?: number;
card?: string;
transaction_no?: string;
}>;
fulfillments?: Array<{
payment_tracking_status?: number;
note?: string;
updated_at?: number;
courier_code?: string;
courier_id?: number;
created_at?: number;
tracking_number?: string;
id?: number;
tracking_company?: string;
payment_tracking_result?: string;
payment_tracking_at?: number;
products?: Array<{ order_product_id?: number; quantity?: number; updated_at?: number; created_at?: number; id?: number }>;
}>;
shipping_zone_plans?: Array<{
shipping_price?: number | string;
updated_at?: number;
created_at?: number;
id?: number;
shipping_zone_name?: string;
shipping_zone_id?: number;
shipping_zone_plan_id?: number;
shipping_zone_plan_name?: string;
}>;
transaction?: {
note?: string;
amount?: number | string;
created_at?: number;
merchant_id?: string;
payment_type?: string;
merchant_account?: string;
updated_at?: number;
payment_id?: number;
admin_id?: number;
admin_name?: string;
id?: number;
payment_method?: string;
transaction_no?: string;
};
coupon_code?: string;
coupon_name?: string;
store_id?: number;
visitor_id?: string;
currency_rate?: string | number;
landing_page?: string;
note?: string;
admin_note?: string;
source_device?: string;
checkout_type?: string;
version?: string;
brand_id?: number;
tags?: string[];
financial_status?: number;
fulfillment_status?: number;
// 创建与更新时间可能为时间戳
created_at?: number | string;
date_added?: string;
updated_at?: number | string;
date_updated?: string;
last_modified?: string;
// 支付时间
pay_at?: number | null;
ip?: string;
utm_source?: string;
// 配送方式
shipping_lines?: Array<ShopyyShippingLineDTO>;
// 费用项
fee_lines?: Array<ShopyyFeeLineDTO>;
// 优惠券项
coupon_lines?: Array<ShopyyCouponLineDTO>;
}
export class ShopyyShippingLineDTO {
// 配送方式DTO用于承载统一配送方式数据
id?: string | number;
method_title?: string;
method_id?: string;
total?: string;
total_tax?: string;
taxes?: any[];
meta_data?: any[];
}
export class ShopyyFeeLineDTO {
// 费用项DTO用于承载统一费用项数据
id?: string | number;
name?: string;
tax_class?: string;
tax_status?: string;
total?: string;
total_tax?: string;
taxes?: any[];
meta_data?: any[];
}
export class ShopyyCouponLineDTO {
// 优惠券项DTO用于承载统一优惠券项数据
id?: string | number;
code?: string;
discount?: string;
discount_tax?: string;
meta_data?: any[];
}
// 客户类型
export interface ShopyyCustomer {
// 主键与兼容ID
id?: number;
customer_id?: number;
// 姓名
first_name?: string;
firstname?: string;
last_name?: string;
lastname?: string;
fullname?: string;
customer_name?: string;
// 联系信息
email?: string;
customer_email?: string;
contact?: string;
phone?: string;
// 地址集合
addresses?: any[];
default_address?: any;
// 国家
country?: { country_name?: string };
// 统计字段
orders_count?: number;
order_count?: number;
orders?: number;
total_spent?: number | string;
total_spend_amount?: number | string;
total_spend_money?: number | string;
// 创建与更新时间可能为时间戳
created_at?: number | string;
date_added?: string;
updated_at?: number | string;
date_updated?: string;
}
// 评论类型
export interface ShopyyReview {
// 主键ID
id: number;
// 产品ID
product_id: number;
// 客户ID
customer_id: number;
// 国家ID
country_id: number;
// IP地址
ip: string;
// 评分星级
star: number;
// 客户名称
customer_name: string;
// 客户邮箱
customer_email: string;
// 回复内容
reply_content: string;
// 评论内容
content: string;
// 状态 1表示正常
status: number;
// 是否包含图片 0表示不包含
is_image: number;
// 图片列表
images: any[];
// 更新时间戳
updated_at: number;
// 创建时间戳
created_at: number;
}
export interface ShopyyWebhookEvent {
id: number;
'event_name': string;
'event_code': string;
"event_decript": string;
isemail_event: number;
email_event_file: string;
email_event_status: number;
is_webhook: number;
is_script_event: number;
created_at: number;
updated_at: number;
}
export interface ShopyyWebhook {
id: number;
"webhook_name": string;
"url": string;
event_id: number;
event_name: string;
event_code: string;
}
// 发货相关DTO
// 批量履行
// https://www.apizza.net/project/e114fb8e628e0f604379f5b26f0d8330/browse
export class ShopyyFulfillmentDTO {
"order_number": string;
"tracking_company": string;
"tracking_number": string;
"courier_code": number;
"note": string;
"mode": "replace" | 'cover' | null// 模式 replace替换 cover (覆盖) 空(新增)
}
// https://www.apizza.net/project/e114fb8e628e0f604379f5b26f0d8330/browse
export class ShopyPartFulfillmentDTO {
order_number: string;
note: string;
tracking_company: string;
tracking_number: string;
courier_code: string;
products: ({
quantity: number,
order_product_id: string
})[]
}
// https://www.apizza.net/project/e114fb8e628e0f604379f5b26f0d8330/browse
export class ShopyyCancelFulfillmentDTO {
order_id: string;
fullfillment_id: string;
}
export class ShopyyBatchFulfillmentItemDTO {
fullfillments: ShopyPartFulfillmentDTO[]
}