forked from yoone/API
540 lines
13 KiB
TypeScript
540 lines
13 KiB
TypeScript
// Shopyy 平台原始数据类型定义
|
||
// 仅包含当前映射逻辑所需字段以保持简洁与类型安全
|
||
export interface ShopyyTag {
|
||
id?: number;
|
||
name?: string;
|
||
}
|
||
export interface ShopyyProductQuery {
|
||
page: string;
|
||
limit: string;
|
||
}
|
||
/**
|
||
* Shopyy 全量商品查询参数类
|
||
* 用于封装获取 Shopyy 商品列表时的各种筛选和分页条件
|
||
* 参考文档: https://www.apizza.net/project/e114fb8e628e0f604379f5b26f0d8330/browse
|
||
*/
|
||
export class ShopyyAllProductQuery {
|
||
/** 分页大小,限制返回的商品数量 */
|
||
limit?: string;
|
||
/** 起始ID,用于分页,返回ID大于该值的商品 */
|
||
since_id?: string;
|
||
/** 商品ID,精确匹配单个商品 */
|
||
id?: string;
|
||
/** 商品标题,支持模糊查询 */
|
||
title?: string;
|
||
/** 商品状态,例如:上架、下架、删除等(具体值参考 Shopyy 接口文档) */
|
||
status?: string;
|
||
/** 商品SKU编码,库存保有单位,精确或模糊匹配 */
|
||
sku?: string;
|
||
/** 商品SPU编码,标准化产品单元,用于归类同款商品 */
|
||
spu?: string;
|
||
/** 商品分类ID,筛选指定分类下的商品 */
|
||
collection_id?: string;
|
||
/** 变体价格最小值,筛选变体价格大于等于该值的商品 */
|
||
variant_price_min?: string;
|
||
/** 变体价格最大值,筛选变体价格小于等于该值的商品 */
|
||
variant_price_max?: string;
|
||
/** 变体划线价(原价)最小值,筛选变体划线价大于等于该值的商品 */
|
||
variant_compare_at_price_min?: string;
|
||
/** 变体划线价(原价)最大值,筛选变体划线价小于等于该值的商品 */
|
||
variant_compare_at_price_max?: string;
|
||
/** 变体重量最小值,筛选变体重量大于等于该值的商品(单位参考接口文档) */
|
||
variant_weight_min?: string;
|
||
/** 变体重量最大值,筛选变体重量小于等于该值的商品(单位参考接口文档) */
|
||
variant_weight_max?: string;
|
||
/** 商品创建时间最小值,格式参考接口文档(如:YYYY-MM-DD HH:mm:ss) */
|
||
created_at_min?: string;
|
||
/** 商品创建时间最大值,格式参考接口文档(如:YYYY-MM-DD HH:mm:ss) */
|
||
created_at_max?: string;
|
||
/** 商品更新时间最小值,格式参考接口文档(如:YYYY-MM-DD HH:mm:ss) */
|
||
updated_at_min?: string;
|
||
/** 商品更新时间最大值,格式参考接口文档(如:YYYY-MM-DD HH:mm:ss) */
|
||
updated_at_max?: 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 ShopyyOrderQuery {
|
||
// 订单ID集合 多个ID用','联接 例:1,2,3
|
||
ids?: string;
|
||
// 订单状态 100 未完成;110 待处理;180 已完成(确认收货); 190 取消;
|
||
status?: string;
|
||
// 物流状态 300 未发货;310 部分发货;320 已发货;330(确认收货)
|
||
fulfillment_status?: string;
|
||
// 支付状态 200 待支付;210 支付中;220 部分支付;230 已支付;240 支付失败;250 部分退款;260 已退款 ;290 已取消;
|
||
financial_status?: string;
|
||
// 支付时间 下限值
|
||
pay_at_min?: string;
|
||
// 支付时间 上限值
|
||
pay_at_max?: string;
|
||
// 创建开始时间
|
||
created_at_min?: number;
|
||
// 创建结束时间
|
||
created_at_max?: number;
|
||
// 更新时间开始
|
||
updated_at_min?: string;
|
||
// 更新时间结束
|
||
updated_at_max?: string;
|
||
// 起始ID
|
||
since_id?: string;
|
||
// 页码
|
||
page?: string;
|
||
// 每页条数
|
||
limit?: string;
|
||
// 排序字段(默认id) id=订单ID updated_at=最后更新时间 pay_at=支付时间
|
||
order_field?: string;
|
||
// 排序方式(默认desc) desc=降序 asc=升序
|
||
order_by?: string;
|
||
// 订单列表类型
|
||
group?: 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;
|
||
// 物流公司 id
|
||
courier_id?: number;
|
||
// 创建时间
|
||
created_at?: number;
|
||
id?: number;
|
||
// 物流单号
|
||
tracking_number?: string;
|
||
// 物流公司名称
|
||
tracking_company?: string;
|
||
// 物流回传结果
|
||
payment_tracking_result?: string;
|
||
// 物流回传时间
|
||
payment_tracking_at?: number;
|
||
// 商品
|
||
products?: Array<{
|
||
// 订单商品表 id
|
||
order_product_id?: number;
|
||
// 数量
|
||
quantity?: number;
|
||
// 更新时间
|
||
updated_at?: number;
|
||
// 创建时间
|
||
created_at?: number;
|
||
// 发货商品表 id
|
||
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;
|
||
// 创建与更新时间可能为时间戳
|
||
date_paid?: number | string;
|
||
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;
|
||
fulfillment_id: string;
|
||
}
|
||
|
||
export class ShopyyBatchFulfillmentItemDTO {
|
||
fulfillments: ShopyPartFulfillmentDTO[]
|
||
}
|