🐛 fix(api): Update Model

This commit is contained in:
web@ppanel
2024-12-01 15:44:51 +07:00
parent 81e0f21a39
commit 39aaa73d6d
33 changed files with 1257 additions and 413 deletions
+52 -97
View File
@@ -4,7 +4,7 @@ import request from '@/utils/request';
/** Get application GET /v1/admin/system/application */
export async function getApplication(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.GetApplicationResponse }>(
return request<API.Response & { data?: API.ApplicationResponse }>(
'/v1/admin/system/application',
{
method: 'GET',
@@ -60,18 +60,15 @@ export async function deleteApplication(
/** Get Currency Config GET /v1/admin/system/currency_config */
export async function getCurrencyConfig(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.GetCurrencyConfigResponse }>(
'/v1/admin/system/currency_config',
{
method: 'GET',
...(options || {}),
},
);
return request<API.Response & { data?: API.CurrencyConfig }>('/v1/admin/system/currency_config', {
method: 'GET',
...(options || {}),
});
}
/** Update Currency Config PUT /v1/admin/system/currency_config */
export async function updateCurrencyConfig(
body: API.UpdateCurrencyConfigRequest,
body: API.CurrencyConfig,
options?: { [key: string]: any },
) {
return request<API.Response & { data?: any }>('/v1/admin/system/currency_config', {
@@ -86,18 +83,15 @@ export async function updateCurrencyConfig(
/** Get email smtp config GET /v1/admin/system/email_config */
export async function getEmailSmtpConfig(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.GetEmailSmtpConfigResponse }>(
'/v1/admin/system/email_config',
{
method: 'GET',
...(options || {}),
},
);
return request<API.Response & { data?: API.EmailSmtpConfig }>('/v1/admin/system/email_config', {
method: 'GET',
...(options || {}),
});
}
/** Update email smtp config PUT /v1/admin/system/email_config */
export async function updateEmailSmtpConfig(
body: API.UpdateEmailSmtpConfigRequest,
body: API.EmailSmtpConfig,
options?: { [key: string]: any },
) {
return request<API.Response & { data?: any }>('/v1/admin/system/email_config', {
@@ -112,20 +106,14 @@ export async function updateEmailSmtpConfig(
/** Get invite config GET /v1/admin/system/invite_config */
export async function getInviteConfig(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.GetInviteConfigResponse }>(
'/v1/admin/system/invite_config',
{
method: 'GET',
...(options || {}),
},
);
return request<API.Response & { data?: API.InviteConfig }>('/v1/admin/system/invite_config', {
method: 'GET',
...(options || {}),
});
}
/** Update invite config PUT /v1/admin/system/invite_config */
export async function updateInviteConfig(
body: API.UpdateInviteConfigRequest,
options?: { [key: string]: any },
) {
export async function updateInviteConfig(body: API.InviteConfig, options?: { [key: string]: any }) {
return request<API.Response & { data?: any }>('/v1/admin/system/invite_config', {
method: 'PUT',
headers: {
@@ -138,20 +126,14 @@ export async function updateInviteConfig(
/** Get node config GET /v1/admin/system/node_config */
export async function getNodeConfig(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.GetNodeConfigResponse }>(
'/v1/admin/system/node_config',
{
method: 'GET',
...(options || {}),
},
);
return request<API.Response & { data?: API.NodeConfig }>('/v1/admin/system/node_config', {
method: 'GET',
...(options || {}),
});
}
/** Update node config PUT /v1/admin/system/node_config */
export async function updateNodeConfig(
body: API.UpdateNodeConfigRequest,
options?: { [key: string]: any },
) {
export async function updateNodeConfig(body: API.NodeConfig, options?: { [key: string]: any }) {
return request<API.Response & { data?: any }>('/v1/admin/system/node_config', {
method: 'PUT',
headers: {
@@ -164,18 +146,15 @@ export async function updateNodeConfig(
/** Get register config GET /v1/admin/system/register_config */
export async function getRegisterConfig(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.GetRegisterConfigResponse }>(
'/v1/admin/system/register_config',
{
method: 'GET',
...(options || {}),
},
);
return request<API.Response & { data?: API.RegisterConfig }>('/v1/admin/system/register_config', {
method: 'GET',
...(options || {}),
});
}
/** Update register config PUT /v1/admin/system/register_config */
export async function updateRegisterConfig(
body: API.UpdateRegisterConfigRequest,
body: API.RegisterConfig,
options?: { [key: string]: any },
) {
return request<API.Response & { data?: any }>('/v1/admin/system/register_config', {
@@ -190,20 +169,14 @@ export async function updateRegisterConfig(
/** Get site config GET /v1/admin/system/site_config */
export async function getSiteConfig(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.GetSiteConfigResponse }>(
'/v1/admin/system/site_config',
{
method: 'GET',
...(options || {}),
},
);
return request<API.Response & { data?: API.SiteConfig }>('/v1/admin/system/site_config', {
method: 'GET',
...(options || {}),
});
}
/** Update site config PUT /v1/admin/system/site_config */
export async function updateSiteConfig(
body: API.UpdateSiteConfigRequest,
options?: { [key: string]: any },
) {
export async function updateSiteConfig(body: API.SiteConfig, options?: { [key: string]: any }) {
return request<API.Response & { data?: any }>('/v1/admin/system/site_config', {
method: 'PUT',
headers: {
@@ -216,7 +189,7 @@ export async function updateSiteConfig(
/** Get subscribe config GET /v1/admin/system/subscribe_config */
export async function getSubscribeConfig(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.GetSubscribeConfigResponse }>(
return request<API.Response & { data?: API.SubscribeConfig }>(
'/v1/admin/system/subscribe_config',
{
method: 'GET',
@@ -227,7 +200,7 @@ export async function getSubscribeConfig(options?: { [key: string]: any }) {
/** Update subscribe config PUT /v1/admin/system/subscribe_config */
export async function updateSubscribeConfig(
body: API.UpdateSubscribeConfigRequest,
body: API.SubscribeConfig,
options?: { [key: string]: any },
) {
return request<API.Response & { data?: any }>('/v1/admin/system/subscribe_config', {
@@ -242,29 +215,23 @@ export async function updateSubscribeConfig(
/** Get subscribe type GET /v1/admin/system/subscribe_type */
export async function getSubscribeType(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.GetSubscribeTypeResponse }>(
'/v1/admin/system/subscribe_type',
{
method: 'GET',
...(options || {}),
},
);
return request<API.Response & { data?: API.SubscribeType }>('/v1/admin/system/subscribe_type', {
method: 'GET',
...(options || {}),
});
}
/** Get Telegram Config GET /v1/admin/system/telegram_config */
export async function getTelegramConfig(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.GetTelegramConfigResponse }>(
'/v1/admin/system/telegram_config',
{
method: 'GET',
...(options || {}),
},
);
return request<API.Response & { data?: API.TelegramConfig }>('/v1/admin/system/telegram_config', {
method: 'GET',
...(options || {}),
});
}
/** Update Telegram Config PUT /v1/admin/system/telegram_config */
export async function updateTelegramConfig(
body: API.UpdateTelegramConfigRequest,
body: API.TelegramConfig,
options?: { [key: string]: any },
) {
return request<API.Response & { data?: any }>('/v1/admin/system/telegram_config', {
@@ -294,20 +261,14 @@ export async function testEmailSmtp(
/** Get Team of Service Config GET /v1/admin/system/tos_config */
export async function getTosConfig(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.GetTosConfigResponse }>(
'/v1/admin/system/tos_config',
{
method: 'GET',
...(options || {}),
},
);
return request<API.Response & { data?: API.TosConfig }>('/v1/admin/system/tos_config', {
method: 'GET',
...(options || {}),
});
}
/** Update Team of Service Config PUT /v1/admin/system/tos_config */
export async function updateTosConfig(
body: API.UpdateTosConfigRequest,
options?: { [key: string]: any },
) {
export async function updateTosConfig(body: API.TosConfig, options?: { [key: string]: any }) {
return request<API.Response & { data?: any }>('/v1/admin/system/tos_config', {
method: 'PUT',
headers: {
@@ -320,20 +281,14 @@ export async function updateTosConfig(
/** Get verify config GET /v1/admin/system/verify_config */
export async function getVerifyConfig(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.GetVerifyConfigResponse }>(
'/v1/admin/system/verify_config',
{
method: 'GET',
...(options || {}),
},
);
return request<API.Response & { data?: API.VerifyConfig }>('/v1/admin/system/verify_config', {
method: 'GET',
...(options || {}),
});
}
/** Update verify config PUT /v1/admin/system/verify_config */
export async function updateVerifyConfig(
body: API.UpdateVerifyConfigRequest,
options?: { [key: string]: any },
) {
export async function updateVerifyConfig(body: API.VerifyConfig, options?: { [key: string]: any }) {
return request<API.Response & { data?: any }>('/v1/admin/system/verify_config', {
method: 'PUT',
headers: {
+138 -154
View File
@@ -17,6 +17,14 @@ declare namespace API {
url: string;
};
type ApplicationResponse = {
windows: Application[];
mac: Application[];
linux: Application[];
android: Application[];
ios: Application[];
};
type BatchDeleteCouponRequest = {
ids: number[];
};
@@ -172,6 +180,12 @@ declare namespace API {
is_admin: boolean;
};
type CurrencyConfig = {
currency_unit: string;
currency_symbol: string;
access_key: string;
};
type DeleteAnnouncementRequest = {
id: number;
};
@@ -218,6 +232,18 @@ declare namespace API {
updated_at: number;
};
type EmailSmtpConfig = {
email_smtp_host: string;
email_smtp_port: number;
email_smtp_user: string;
email_smtp_pass: string;
email_smtp_from: string;
email_smtp_ssl: boolean;
verify_email_template: string;
maintenance_email_template: string;
expiration_email_template: string;
};
type Follow = {
id: number;
ticket_id: number;
@@ -258,14 +284,6 @@ declare namespace API {
id: number;
};
type GetApplicationResponse = {
windows: Application[];
mac: Application[];
linux: Application[];
android: Application[];
ios: Application[];
};
type GetCouponListParams = {
page: number;
size: number;
@@ -285,12 +303,6 @@ declare namespace API {
list: Coupon[];
};
type GetCurrencyConfigResponse = {
currency_unit: string;
currency_symbol: string;
access_key: string;
};
type GetDetailRequest = {
id: number;
};
@@ -318,30 +330,6 @@ declare namespace API {
list: Document[];
};
type GetEmailSmtpConfigResponse = {
email_smtp_host: string;
email_smtp_port: number;
email_smtp_user: string;
email_smtp_pass: string;
email_smtp_from: string;
email_smtp_ssl: boolean;
verify_email_template: string;
maintenance_email_template: string;
expiration_email_template: string;
};
type GetInviteConfigResponse = {
forced_invite: boolean;
referral_percentage: number;
only_first_purchase: boolean;
};
type GetNodeConfigResponse = {
node_secret: string;
node_pull_interval: number;
node_push_interval: number;
};
type GetNodeDetailParams = {
id: number;
};
@@ -397,31 +385,6 @@ declare namespace API {
list: Order[];
};
type GetRegisterConfigResponse = {
stop_register: boolean;
enable_trial: boolean;
enable_email_verify: boolean;
enable_email_domain_suffix: boolean;
email_domain_suffix_list: string;
enable_ip_register_limit: boolean;
ip_register_limit: number;
ip_register_limit_duration: number;
};
type GetSiteConfigResponse = {
host: string;
site_name: string;
site_desc: string;
site_logo: string;
};
type GetSubscribeConfigResponse = {
single_model: boolean;
subscribe_path: string;
subscribe_domain: string;
pan_domain: boolean;
};
type GetSubscribeDetailsParams = {
id: number;
};
@@ -454,16 +417,6 @@ declare namespace API {
total: number;
};
type GetSubscribeTypeResponse = {
subscribe_types: string[];
};
type GetTelegramConfigResponse = {
telegram_bot_token: string;
telegram_group_url: string;
telegram_notify: boolean;
};
type GetTicketListParams = {
page: number;
size: number;
@@ -493,10 +446,6 @@ declare namespace API {
id: number;
};
type GetTosConfigResponse = {
tos_content: string;
};
type GetUserDetailParams = {
id: number;
};
@@ -518,12 +467,16 @@ declare namespace API {
list: User[];
};
type GetVerifyConfigResponse = {
turnstile_site_key: string;
turnstile_secret: string;
enable_login_verify: boolean;
enable_register_verify: boolean;
enable_reset_password_verify: boolean;
type InviteConfig = {
forced_invite: boolean;
referral_percentage: number;
only_first_purchase: boolean;
};
type NodeConfig = {
node_secret: string;
node_pull_interval: number;
node_push_interval: number;
};
type Order = {
@@ -546,6 +499,27 @@ declare namespace API {
updated_at: number;
};
type OrderDetail = {
id: number;
user_id: number;
order_no: string;
type: number;
quantity: number;
price: number;
amount: number;
discount: number;
coupon: string;
coupon_discount: number;
method: string;
fee_amount: number;
trade_no: string;
status: number;
subscribe_id: number;
subscribe: Subscribe;
created_at: number;
updated_at: number;
};
type PaymentConfig = {
id: number;
name: string;
@@ -564,6 +538,17 @@ declare namespace API {
count: number;
};
type RegisterConfig = {
stop_register: boolean;
enable_trial: boolean;
enable_email_verify: boolean;
enable_email_domain_suffix: boolean;
email_domain_suffix_list: string;
enable_ip_register_limit: boolean;
ip_register_limit: number;
ip_register_limit_duration: number;
};
type Response = {
/** 状态码 */
code?: number;
@@ -607,6 +592,13 @@ declare namespace API {
relay_port: number;
};
type SiteConfig = {
host: string;
site_name: string;
site_desc: string;
site_logo: string;
};
type Subscribe = {
id: number;
name: string;
@@ -628,6 +620,13 @@ declare namespace API {
updated_at: number;
};
type SubscribeConfig = {
single_model: boolean;
subscribe_path: string;
subscribe_domain: string;
pan_domain: boolean;
};
type SubscribeDiscount = {
months: number;
discount: number;
@@ -641,6 +640,16 @@ declare namespace API {
updated_at: number;
};
type SubscribeType = {
subscribe_types: string[];
};
type TelegramConfig = {
telegram_bot_token: string;
telegram_group_url: string;
telegram_notify: boolean;
};
type TestEmailSmtpRequest = {
email: string;
};
@@ -656,6 +665,10 @@ declare namespace API {
updated_at: number;
};
type TosConfig = {
tos_content: string;
};
type Trojan = {
network: string;
port: number;
@@ -703,12 +716,6 @@ declare namespace API {
enable?: boolean;
};
type UpdateCurrencyConfigRequest = {
currency_unit: string;
currency_symbol: string;
access_key: string;
};
type UpdateDocumentRequest = {
id: number;
title: string;
@@ -717,28 +724,6 @@ declare namespace API {
show: boolean;
};
type UpdateEmailSmtpConfigRequest = {
email_smtp_host: string;
email_smtp_port: number;
email_smtp_user: string;
email_smtp_pass: string;
email_smtp_from: string;
email_smtp_ssl: boolean;
email_template: string;
};
type UpdateInviteConfigRequest = {
forced_invite: boolean;
referral_percentage: number;
only_first_purchase: boolean;
};
type UpdateNodeConfigRequest = {
node_secret: string;
node_pull_interval: number;
node_push_interval: number;
};
type UpdateNodeGroupRequest = {
id: number;
name: string;
@@ -767,31 +752,6 @@ declare namespace API {
trade_no?: string;
};
type UpdateRegisterConfigRequest = {
stop_register: boolean;
enable_trial: boolean;
enable_email_verify: boolean;
enable_email_domain_suffix: boolean;
email_domain_suffix_list: string;
enable_ip_register_limit: boolean;
ip_register_limit: number;
ip_register_limit_duration: number;
};
type UpdateSiteConfigRequest = {
host: string;
site_name: string;
site_desc: string;
site_logo: string;
};
type UpdateSubscribeConfigRequest = {
single_model: boolean;
subscribe_path: string;
subscribe_domain: string;
pan_domain: boolean;
};
type UpdateSubscribeGroupRequest = {
id: number;
name: string;
@@ -817,21 +777,11 @@ declare namespace API {
sell: boolean;
};
type UpdateTelegramConfigRequest = {
telegram_bot_token: string;
telegram_group_url: string;
telegram_notify: boolean;
};
type UpdateTicketStatusRequest = {
id: number;
status: number;
};
type UpdateTosConfigRequest = {
tos_content: string;
};
type UpdateUserRequest = {
id: number;
email: string;
@@ -852,14 +802,6 @@ declare namespace API {
enable_trade_notify: boolean;
};
type UpdateVerifyConfigRequest = {
turnstile_site_key: string;
turnstile_secret: string;
enable_login_verify: boolean;
enable_register_verify: boolean;
enable_reset_password_verify: boolean;
};
type User = {
id: number;
email: string;
@@ -883,6 +825,48 @@ declare namespace API {
is_del?: boolean;
};
type UserAffiliate = {
email: string;
avatar: string;
registered_at: number;
enable: boolean;
};
type UserBalanceLog = {
id: number;
user_id: number;
amount: number;
type: number;
order_id: number;
balance: number;
created_at: number;
};
type UserSubscribe = {
id: number;
user_id: number;
order_id: number;
subscribe_id: number;
subscribe: Subscribe;
start_time: number;
expire_time: number;
traffic: number;
download: number;
upload: number;
mark: string;
status: number;
created_at: number;
updated_at: number;
};
type VerifyConfig = {
turnstile_site_key: string;
turnstile_secret: string;
enable_login_verify: boolean;
enable_register_verify: boolean;
enable_reset_password_verify: boolean;
};
type Vless = {
host: string;
port: number;