feat(api): 添加订阅模块和产品搜索功能
- 新增订阅模块相关接口和类型定义 - 添加产品搜索接口 - 更新产品类型定义,增加删除状态字段 - 添加openapi2ts依赖用于类型生成
This commit is contained in:
parent
e845824d05
commit
b22e18f609
|
|
@ -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 || {}),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
@ -334,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;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -863,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;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -948,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;
|
||||||
|
|
@ -1309,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;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue