feat(api): 添加订阅模块和产品搜索功能
- 新增订阅模块相关接口和类型定义 - 添加产品搜索接口 - 更新产品类型定义,增加删除状态字段 - 添加openapi2ts依赖用于类型生成
This commit is contained in:
parent
50bbf309c9
commit
721ccac46f
|
|
@ -35,6 +35,7 @@
|
||||||
"code-inspector-plugin": "^1.2.10",
|
"code-inspector-plugin": "^1.2.10",
|
||||||
"husky": "^9",
|
"husky": "^9",
|
||||||
"lint-staged": "^13.2.0",
|
"lint-staged": "^13.2.0",
|
||||||
|
"openapi2ts": "^1.1.14",
|
||||||
"prettier": "^2.8.7",
|
"prettier": "^2.8.7",
|
||||||
"prettier-plugin-organize-imports": "^3.2.2",
|
"prettier-plugin-organize-imports": "^3.2.2",
|
||||||
"prettier-plugin-packagejson": "^2.4.3",
|
"prettier-plugin-packagejson": "^2.4.3",
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import * as product from './product';
|
||||||
import * as site from './site';
|
import * as site from './site';
|
||||||
import * as statistics from './statistics';
|
import * as statistics from './statistics';
|
||||||
import * as stock from './stock';
|
import * as stock from './stock';
|
||||||
|
import * as subscription from './subscription';
|
||||||
import * as user from './user';
|
import * as user from './user';
|
||||||
import * as webhook from './webhook';
|
import * as webhook from './webhook';
|
||||||
import * as wpProduct from './wpProduct';
|
import * as wpProduct from './wpProduct';
|
||||||
|
|
@ -20,6 +21,7 @@ export default {
|
||||||
site,
|
site,
|
||||||
statistics,
|
statistics,
|
||||||
stock,
|
stock,
|
||||||
|
subscription,
|
||||||
user,
|
user,
|
||||||
webhook,
|
webhook,
|
||||||
wpProduct,
|
wpProduct,
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
// @ts-ignore
|
||||||
|
/* eslint-disable */
|
||||||
|
import { request } from 'umi';
|
||||||
|
|
||||||
|
/** 此处后端没有提供注释 GET /subscription/list */
|
||||||
|
export async function subscriptioncontrollerList(
|
||||||
|
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||||
|
params: API.subscriptioncontrollerListParams,
|
||||||
|
options?: { [key: string]: any },
|
||||||
|
) {
|
||||||
|
return request<API.SubscriptionListRes>('/subscription/list', {
|
||||||
|
method: 'GET',
|
||||||
|
params: {
|
||||||
|
...params,
|
||||||
|
},
|
||||||
|
...(options || {}),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 此处后端没有提供注释 POST /subscription/sync/${param0} */
|
||||||
|
export async function subscriptioncontrollerSync(
|
||||||
|
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||||
|
params: API.subscriptioncontrollerSyncParams,
|
||||||
|
options?: { [key: string]: any },
|
||||||
|
) {
|
||||||
|
const { siteId: param0, ...queryParams } = params;
|
||||||
|
return request<API.BooleanRes>(`/subscription/sync/${param0}`, {
|
||||||
|
method: 'POST',
|
||||||
|
params: { ...queryParams },
|
||||||
|
...(options || {}),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
@ -235,7 +235,6 @@ declare namespace API {
|
||||||
total_tax?: number;
|
total_tax?: number;
|
||||||
customer_id?: number;
|
customer_id?: number;
|
||||||
customer_email?: string;
|
customer_email?: string;
|
||||||
billing_phone?: string;
|
|
||||||
order_key?: string;
|
order_key?: string;
|
||||||
billing?: OrderAddress;
|
billing?: OrderAddress;
|
||||||
shipping?: OrderAddress;
|
shipping?: OrderAddress;
|
||||||
|
|
@ -258,6 +257,8 @@ declare namespace API {
|
||||||
device_type?: string;
|
device_type?: string;
|
||||||
source_type?: string;
|
source_type?: string;
|
||||||
utm_source?: string;
|
utm_source?: string;
|
||||||
|
is_exchange?: boolean;
|
||||||
|
exchange_frequency?: number;
|
||||||
/** 创建时间 */
|
/** 创建时间 */
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
/** 更新时间 */
|
/** 更新时间 */
|
||||||
|
|
@ -333,9 +334,9 @@ declare namespace API {
|
||||||
| 'after_sale_pending'
|
| 'after_sale_pending'
|
||||||
| 'pending_reshipment'
|
| 'pending_reshipment'
|
||||||
| 'pending_refund'
|
| 'pending_refund'
|
||||||
| 'refund_requested'
|
| 'return-requested'
|
||||||
| 'refund_approved'
|
| 'return-approved'
|
||||||
| 'refund_cancelled';
|
| 'return-cancelled';
|
||||||
payment_method?: string;
|
payment_method?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -377,7 +378,6 @@ declare namespace API {
|
||||||
total_tax?: number;
|
total_tax?: number;
|
||||||
customer_id?: number;
|
customer_id?: number;
|
||||||
customer_email?: string;
|
customer_email?: string;
|
||||||
billing_phone?: string;
|
|
||||||
order_key?: string;
|
order_key?: string;
|
||||||
billing?: OrderAddress;
|
billing?: OrderAddress;
|
||||||
shipping?: OrderAddress;
|
shipping?: OrderAddress;
|
||||||
|
|
@ -400,6 +400,8 @@ declare namespace API {
|
||||||
device_type?: string;
|
device_type?: string;
|
||||||
source_type?: string;
|
source_type?: string;
|
||||||
utm_source?: string;
|
utm_source?: string;
|
||||||
|
is_exchange?: boolean;
|
||||||
|
exchange_frequency?: number;
|
||||||
/** 创建时间 */
|
/** 创建时间 */
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
/** 更新时间 */
|
/** 更新时间 */
|
||||||
|
|
@ -861,9 +863,9 @@ declare namespace API {
|
||||||
| 'after_sale_pending'
|
| 'after_sale_pending'
|
||||||
| 'pending_reshipment'
|
| 'pending_reshipment'
|
||||||
| 'pending_refund'
|
| 'pending_refund'
|
||||||
| 'refund_requested'
|
| 'return-requested'
|
||||||
| 'refund_approved'
|
| 'return-approved'
|
||||||
| 'refund_cancelled';
|
| 'return-cancelled';
|
||||||
payment_method?: string;
|
payment_method?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -946,6 +948,27 @@ declare namespace API {
|
||||||
name?: string;
|
name?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type QuerySubscriptionDTO = {
|
||||||
|
/** 页码 */
|
||||||
|
current?: number;
|
||||||
|
/** 每页大小 */
|
||||||
|
pageSize?: number;
|
||||||
|
/** 站点ID */
|
||||||
|
siteId?: string;
|
||||||
|
/** 订阅状态 */
|
||||||
|
status?:
|
||||||
|
| 'active'
|
||||||
|
| 'pending'
|
||||||
|
| 'on-hold'
|
||||||
|
| 'cancelled'
|
||||||
|
| 'expired'
|
||||||
|
| 'pending-cancel';
|
||||||
|
/** 客户邮箱 */
|
||||||
|
customer_email?: string;
|
||||||
|
/** 关键字(订阅ID、邮箱等) */
|
||||||
|
keyword?: string;
|
||||||
|
};
|
||||||
|
|
||||||
type QueryWpProductDTO = {
|
type QueryWpProductDTO = {
|
||||||
/** 页码 */
|
/** 页码 */
|
||||||
current?: number;
|
current?: number;
|
||||||
|
|
@ -1307,6 +1330,82 @@ declare namespace API {
|
||||||
items?: StockRecordDTO[];
|
items?: StockRecordDTO[];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type Subscription = {
|
||||||
|
id?: number;
|
||||||
|
/** 来源站点唯一标识 */
|
||||||
|
siteId?: string;
|
||||||
|
/** WooCommerce 订阅 ID */
|
||||||
|
externalSubscriptionId?: string;
|
||||||
|
status?: any;
|
||||||
|
currency?: string;
|
||||||
|
total?: number;
|
||||||
|
/** 计费周期 e.g. day/week/month/year */
|
||||||
|
billing_period?: string;
|
||||||
|
/** 计费周期间隔 e.g. 1/3/12 */
|
||||||
|
billing_interval?: number;
|
||||||
|
customer_id?: number;
|
||||||
|
customer_email?: string;
|
||||||
|
/** 父订单/父订阅ID(如有) */
|
||||||
|
parent_id?: number;
|
||||||
|
start_date?: string;
|
||||||
|
trial_end?: string;
|
||||||
|
next_payment_date?: string;
|
||||||
|
end_date?: string;
|
||||||
|
line_items?: any;
|
||||||
|
meta_data?: any;
|
||||||
|
/** 创建时间 */
|
||||||
|
createdAt: string;
|
||||||
|
/** 更新时间 */
|
||||||
|
updatedAt: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
type subscriptioncontrollerListParams = {
|
||||||
|
/** 页码 */
|
||||||
|
current?: number;
|
||||||
|
/** 每页大小 */
|
||||||
|
pageSize?: number;
|
||||||
|
/** 站点ID */
|
||||||
|
siteId?: string;
|
||||||
|
/** 订阅状态 */
|
||||||
|
status?:
|
||||||
|
| 'active'
|
||||||
|
| 'pending'
|
||||||
|
| 'on-hold'
|
||||||
|
| 'cancelled'
|
||||||
|
| 'expired'
|
||||||
|
| 'pending-cancel';
|
||||||
|
/** 客户邮箱 */
|
||||||
|
customer_email?: string;
|
||||||
|
/** 关键字(订阅ID、邮箱等) */
|
||||||
|
keyword?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
type subscriptioncontrollerSyncParams = {
|
||||||
|
siteId: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
type SubscriptionListRes = {
|
||||||
|
/** 状态码 */
|
||||||
|
code?: number;
|
||||||
|
/** 是否成功 */
|
||||||
|
success?: boolean;
|
||||||
|
/** 消息内容 */
|
||||||
|
message?: string;
|
||||||
|
/** 响应数据 */
|
||||||
|
data?: SubscriptionPaginatedResponse;
|
||||||
|
};
|
||||||
|
|
||||||
|
type SubscriptionPaginatedResponse = {
|
||||||
|
/** 当前页码 */
|
||||||
|
page?: number;
|
||||||
|
/** 每页大小 */
|
||||||
|
pageSize?: number;
|
||||||
|
/** 总记录数 */
|
||||||
|
total?: number;
|
||||||
|
/** 数据列表 */
|
||||||
|
items?: Subscription[];
|
||||||
|
};
|
||||||
|
|
||||||
type Surcharges = {
|
type Surcharges = {
|
||||||
type?: string;
|
type?: string;
|
||||||
amount?: Money;
|
amount?: Money;
|
||||||
|
|
@ -1415,6 +1514,8 @@ declare namespace API {
|
||||||
sale_price?: number;
|
sale_price?: number;
|
||||||
/** 是否促销中 */
|
/** 是否促销中 */
|
||||||
on_sale?: boolean;
|
on_sale?: boolean;
|
||||||
|
/** 是否删除 */
|
||||||
|
on_delete?: boolean;
|
||||||
/** 创建时间 */
|
/** 创建时间 */
|
||||||
createdAt: string;
|
createdAt: string;
|
||||||
/** 更新时间 */
|
/** 更新时间 */
|
||||||
|
|
@ -1448,6 +1549,10 @@ declare namespace API {
|
||||||
| 'inherit';
|
| 'inherit';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type wpproductcontrollerSearchproductsParams = {
|
||||||
|
name?: string;
|
||||||
|
};
|
||||||
|
|
||||||
type wpproductcontrollerSetconstitutionParams = {
|
type wpproductcontrollerSetconstitutionParams = {
|
||||||
id: number;
|
id: number;
|
||||||
};
|
};
|
||||||
|
|
@ -1500,6 +1605,8 @@ declare namespace API {
|
||||||
sale_price?: number;
|
sale_price?: number;
|
||||||
/** 是否促销中 */
|
/** 是否促销中 */
|
||||||
on_sale?: boolean;
|
on_sale?: boolean;
|
||||||
|
/** 是否删除 */
|
||||||
|
on_delete?: boolean;
|
||||||
/** 产品类型 */
|
/** 产品类型 */
|
||||||
type?: 'simple' | 'variable' | 'woosb';
|
type?: 'simple' | 'variable' | 'woosb';
|
||||||
/** 创建时间 */
|
/** 创建时间 */
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,21 @@ export async function wpproductcontrollerGetwpproducts(
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 此处后端没有提供注释 GET /wp_product/search */
|
||||||
|
export async function wpproductcontrollerSearchproducts(
|
||||||
|
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||||
|
params: API.wpproductcontrollerSearchproductsParams,
|
||||||
|
options?: { [key: string]: any },
|
||||||
|
) {
|
||||||
|
return request<API.ProductsRes>('/wp_product/search', {
|
||||||
|
method: 'GET',
|
||||||
|
params: {
|
||||||
|
...params,
|
||||||
|
},
|
||||||
|
...(options || {}),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/** 此处后端没有提供注释 PUT /wp_product/siteId/${param1}/products/${param0} */
|
/** 此处后端没有提供注释 PUT /wp_product/siteId/${param1}/products/${param0} */
|
||||||
export async function wpproductcontrollerUpdateproduct(
|
export async function wpproductcontrollerUpdateproduct(
|
||||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue