✨ feat(subscription): Refactor subscription handling and update imports for better organization
This commit is contained in:
@@ -58,17 +58,6 @@ export async function getStat(options?: { [key: string]: any }) {
|
||||
});
|
||||
}
|
||||
|
||||
/** Get Subscription GET /v1/common/site/subscribe */
|
||||
export async function getSubscription(options?: { [key: string]: any }) {
|
||||
return request<API.Response & { data?: API.GetSubscriptionResponse }>(
|
||||
'/v1/common/site/subscribe',
|
||||
{
|
||||
method: 'GET',
|
||||
...(options || {}),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/** Get Tos Content GET /v1/common/site/tos */
|
||||
export async function getTos(options?: { [key: string]: any }) {
|
||||
return request<API.Response & { data?: API.GetTosResponse }>('/v1/common/site/tos', {
|
||||
|
||||
+40
-16
@@ -90,17 +90,6 @@ declare namespace API {
|
||||
enabled: boolean;
|
||||
};
|
||||
|
||||
type CheckoutOrderRequest = {
|
||||
orderNo: string;
|
||||
returnUrl?: string;
|
||||
};
|
||||
|
||||
type CheckoutOrderResponse = {
|
||||
type: string;
|
||||
checkout_url?: string;
|
||||
stripe?: StripePayment;
|
||||
};
|
||||
|
||||
type CheckUserParams = {
|
||||
email: string;
|
||||
};
|
||||
@@ -175,7 +164,7 @@ declare namespace API {
|
||||
};
|
||||
|
||||
type GetAvailablePaymentMethodsResponse = {
|
||||
list: PaymentConfig[];
|
||||
list: PaymenMethod[];
|
||||
};
|
||||
|
||||
type GetGlobalConfigResponse = {
|
||||
@@ -196,14 +185,24 @@ declare namespace API {
|
||||
protocol: string[];
|
||||
};
|
||||
|
||||
type GetSubscriptionResponse = {
|
||||
list: Subscribe[];
|
||||
};
|
||||
|
||||
type GetTosResponse = {
|
||||
tos_content: string;
|
||||
};
|
||||
|
||||
type GetUserSubscribeTrafficLogsRequest = {
|
||||
page: number;
|
||||
size: number;
|
||||
user_id: number;
|
||||
subscribe_id: number;
|
||||
start_time: number;
|
||||
end_time: number;
|
||||
};
|
||||
|
||||
type GetUserSubscribeTrafficLogsResponse = {
|
||||
list: TrafficLog[];
|
||||
total: number;
|
||||
};
|
||||
|
||||
type GoogleLoginCallbackRequest = {
|
||||
code: string;
|
||||
state: string;
|
||||
@@ -329,6 +328,16 @@ declare namespace API {
|
||||
updated_at: number;
|
||||
};
|
||||
|
||||
type PaymenMethod = {
|
||||
id: number;
|
||||
name: string;
|
||||
mark: string;
|
||||
icon: string;
|
||||
fee_mode: number;
|
||||
fee_percent: number;
|
||||
fee_amount: number;
|
||||
};
|
||||
|
||||
type PaymentConfig = {
|
||||
id: number;
|
||||
name: string;
|
||||
@@ -417,6 +426,21 @@ declare namespace API {
|
||||
list: OrderDetail[];
|
||||
};
|
||||
|
||||
type QuerySubscribeGroupListResponse = {
|
||||
list: SubscribeGroup[];
|
||||
total: number;
|
||||
};
|
||||
|
||||
type QuerySubscribeListResponse = {
|
||||
list: Subscribe[];
|
||||
total: number;
|
||||
};
|
||||
|
||||
type QueryUserAffiliateListResponse = {
|
||||
list: UserAffiliate[];
|
||||
total: number;
|
||||
};
|
||||
|
||||
type RechargeOrderRequest = {
|
||||
amount: number;
|
||||
payment: string;
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
// @ts-ignore
|
||||
/* eslint-disable */
|
||||
|
||||
// API 更新时间:
|
||||
// API 唯一标识:
|
||||
import * as announcement from './announcement';
|
||||
import * as document from './document';
|
||||
import * as order from './order';
|
||||
import * as payment from './payment';
|
||||
import * as portal from './portal';
|
||||
import * as subscribe from './subscribe';
|
||||
import * as ticket from './ticket';
|
||||
import * as user from './user';
|
||||
@@ -14,6 +15,7 @@ export default {
|
||||
document,
|
||||
order,
|
||||
payment,
|
||||
portal,
|
||||
subscribe,
|
||||
ticket,
|
||||
user,
|
||||
|
||||
@@ -2,21 +2,6 @@
|
||||
/* eslint-disable */
|
||||
import request from '@/utils/request';
|
||||
|
||||
/** Checkout order POST /v1/public/order/checkout */
|
||||
export async function checkoutOrder(
|
||||
body: API.CheckoutOrderRequest,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<API.Response & { data?: API.CheckoutOrderResponse }>('/v1/public/order/checkout', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
data: body,
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
/** Close order POST /v1/public/order/close */
|
||||
export async function closeOrder(body: API.CloseOrderRequest, options?: { [key: string]: any }) {
|
||||
return request<API.Response & { data?: any }>('/v1/public/order/close', {
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
// @ts-ignore
|
||||
/* eslint-disable */
|
||||
import request from '@/utils/request';
|
||||
|
||||
/** Purchase Checkout POST /v1/public/portal/order/checkout */
|
||||
export async function purchaseCheckout(
|
||||
body: API.CheckoutOrderRequest,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<API.Response & { data?: API.CheckoutOrderResponse }>(
|
||||
'/v1/public/portal/order/checkout',
|
||||
{
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
data: body,
|
||||
...(options || {}),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/** Query Purchase Order GET /v1/public/portal/order/status */
|
||||
export async function queryPurchaseOrder(
|
||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
params: API.QueryPurchaseOrderParams,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<API.Response & { data?: API.QueryPurchaseOrderResponse }>(
|
||||
'/v1/public/portal/order/status',
|
||||
{
|
||||
method: 'GET',
|
||||
params: {
|
||||
...params,
|
||||
},
|
||||
...(options || {}),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/** Get available payment methods GET /v1/public/portal/payment-method */
|
||||
export async function getAvailablePaymentMethods(options?: { [key: string]: any }) {
|
||||
return request<API.Response & { data?: API.GetAvailablePaymentMethodsResponse }>(
|
||||
'/v1/public/portal/payment-method',
|
||||
{
|
||||
method: 'GET',
|
||||
...(options || {}),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/** Pre Purchase Order POST /v1/public/portal/pre */
|
||||
export async function prePurchaseOrder(
|
||||
body: API.PrePurchaseOrderRequest,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<API.Response & { data?: API.PrePurchaseOrderResponse }>('/v1/public/portal/pre', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
data: body,
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
/** Purchase subscription POST /v1/public/portal/purchase */
|
||||
export async function purchase(body: API.PortalPurchaseRequest, options?: { [key: string]: any }) {
|
||||
return request<API.Response & { data?: API.PortalPurchaseResponse }>(
|
||||
'/v1/public/portal/purchase',
|
||||
{
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
data: body,
|
||||
...(options || {}),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/** Get Subscription GET /v1/public/portal/subscribe */
|
||||
export async function getSubscription(options?: { [key: string]: any }) {
|
||||
return request<API.Response & { data?: API.GetSubscriptionResponse }>(
|
||||
'/v1/public/portal/subscribe',
|
||||
{
|
||||
method: 'GET',
|
||||
...(options || {}),
|
||||
},
|
||||
);
|
||||
}
|
||||
Vendored
+84
-1
@@ -187,7 +187,7 @@ declare namespace API {
|
||||
};
|
||||
|
||||
type GetAvailablePaymentMethodsResponse = {
|
||||
list: PaymentConfig[];
|
||||
list: PaymenMethod[];
|
||||
};
|
||||
|
||||
type GetLoginLogParams = {
|
||||
@@ -224,6 +224,24 @@ declare namespace API {
|
||||
total: number;
|
||||
};
|
||||
|
||||
type GetSubscriptionResponse = {
|
||||
list: Subscribe[];
|
||||
};
|
||||
|
||||
type GetUserSubscribeTrafficLogsRequest = {
|
||||
page: number;
|
||||
size: number;
|
||||
user_id: number;
|
||||
subscribe_id: number;
|
||||
start_time: number;
|
||||
end_time: number;
|
||||
};
|
||||
|
||||
type GetUserSubscribeTrafficLogsResponse = {
|
||||
list: TrafficLog[];
|
||||
total: number;
|
||||
};
|
||||
|
||||
type GetUserTicketDetailRequest = {
|
||||
id: number;
|
||||
};
|
||||
@@ -351,6 +369,16 @@ declare namespace API {
|
||||
updated_at: number;
|
||||
};
|
||||
|
||||
type PaymenMethod = {
|
||||
id: number;
|
||||
name: string;
|
||||
mark: string;
|
||||
icon: string;
|
||||
fee_mode: number;
|
||||
fee_percent: number;
|
||||
fee_amount: number;
|
||||
};
|
||||
|
||||
type PaymentConfig = {
|
||||
id: number;
|
||||
name: string;
|
||||
@@ -364,6 +392,21 @@ declare namespace API {
|
||||
enable: boolean;
|
||||
};
|
||||
|
||||
type PortalPurchaseRequest = {
|
||||
identifier: string;
|
||||
platform: string;
|
||||
password?: string;
|
||||
payment: string;
|
||||
subscribe_id: number;
|
||||
quantity: number;
|
||||
coupon?: string;
|
||||
turnstile_token?: string;
|
||||
};
|
||||
|
||||
type PortalPurchaseResponse = {
|
||||
order_no: string;
|
||||
};
|
||||
|
||||
type PreOrderResponse = {
|
||||
price: number;
|
||||
amount: number;
|
||||
@@ -374,6 +417,22 @@ declare namespace API {
|
||||
fee_amount: number;
|
||||
};
|
||||
|
||||
type PrePurchaseOrderRequest = {
|
||||
payment: string;
|
||||
subscribe_id: number;
|
||||
quantity: number;
|
||||
coupon?: string;
|
||||
};
|
||||
|
||||
type PrePurchaseOrderResponse = {
|
||||
price: number;
|
||||
amount: number;
|
||||
discount: number;
|
||||
coupon: string;
|
||||
coupon_discount: number;
|
||||
fee_amount: number;
|
||||
};
|
||||
|
||||
type PreRenewalOrderResponse = {
|
||||
orderNo: string;
|
||||
};
|
||||
@@ -467,6 +526,30 @@ declare namespace API {
|
||||
list: OrderDetail[];
|
||||
};
|
||||
|
||||
type QueryPurchaseOrderParams = {
|
||||
order_no: string;
|
||||
};
|
||||
|
||||
type QueryPurchaseOrderRequest = {
|
||||
order_no: string;
|
||||
};
|
||||
|
||||
type QueryPurchaseOrderResponse = {
|
||||
order_no: string;
|
||||
subscribe: Subscribe;
|
||||
quantity: number;
|
||||
price: number;
|
||||
amount: number;
|
||||
discount: number;
|
||||
coupon: string;
|
||||
coupon_discount: number;
|
||||
fee_amount: number;
|
||||
payment: string;
|
||||
status: number;
|
||||
created_at: number;
|
||||
token?: string;
|
||||
};
|
||||
|
||||
type QuerySubscribeGroupListResponse = {
|
||||
list: SubscribeGroup[];
|
||||
total: number;
|
||||
|
||||
Reference in New Issue
Block a user