🐛 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
+1 -1
View File
@@ -25,7 +25,7 @@ export default function Site() {
await updateCurrencyConfig({
...data,
[key]: value,
} as API.UpdateCurrencyConfigRequest);
} as API.CurrencyConfig);
toast.success(t('saveSuccess'));
refetch();
} catch (error) {
+1 -1
View File
@@ -31,7 +31,7 @@ export default function Email() {
await updateEmailSmtpConfig({
...data,
[key]: value,
} as API.UpdateEmailSmtpConfigRequest);
} as API.EmailSmtpConfig);
toast.success(t('saveSuccess'));
refetch();
} catch (error) {
+1 -1
View File
@@ -27,7 +27,7 @@ export default function Invite() {
await updateInviteConfig({
...data,
[key]: value,
} as API.UpdateInviteConfigRequest);
} as API.InviteConfig);
toast.success(t('saveSuccess'));
refetch();
} catch (error) {
+1 -1
View File
@@ -28,7 +28,7 @@ export default function Node() {
await updateNodeConfig({
...data,
[key]: value,
} as API.GetNodeConfigResponse);
} as API.NodeConfig);
toast.success(t('saveSuccess'));
refetch();
} catch (error) {
+1 -1
View File
@@ -28,7 +28,7 @@ export default function Register() {
await updateRegisterConfig({
...data,
[key]: value,
} as API.GetRegisterConfigResponse);
} as API.RegisterConfig);
toast.success(t('saveSuccess'));
refetch();
} catch (error) {
@@ -24,8 +24,8 @@ import { Tabs, TabsContent, TabsList, TabsTrigger } from '@shadcn/ui/tabs';
import { Textarea } from '@shadcn/ui/textarea';
function compareData(
originalData: API.GetApplicationResponse,
modifiedData: API.GetApplicationResponse,
originalData: API.ApplicationResponse,
modifiedData: API.ApplicationResponse,
): {
added: API.Application[];
deleted: API.Application[];
@@ -107,7 +107,7 @@ export default function Subscription() {
await updateSubscribeConfig({
...data,
[key]: value,
} as API.GetSubscribeConfigResponse);
} as API.SubscribeConfig);
toast.success(t('saveSuccess'));
refetch();
} catch (error) {
@@ -123,7 +123,7 @@ export default function Subscription() {
return data.data?.subscribe_types || [];
},
});
const [app, setApp] = useState<API.GetApplicationResponse>();
const [app, setApp] = useState<API.ApplicationResponse>();
const appTypes = Object.keys(apps || {});
useEffect(() => {
@@ -253,7 +253,7 @@ export default function Subscription() {
setApp({
...app,
[type]: newList,
} as API.GetApplicationResponse);
} as API.ApplicationResponse);
};
return (
@@ -300,7 +300,7 @@ export default function Subscription() {
setApp({
...app,
[type]: list.filter((l, i) => i !== index),
} as API.GetApplicationResponse);
} as API.ApplicationResponse);
}}
>
{t('delete')}
@@ -320,7 +320,7 @@ export default function Subscription() {
platform: type,
},
],
} as API.GetApplicationResponse);
} as API.ApplicationResponse);
}}
>
{t('add')}
+1 -1
View File
@@ -27,7 +27,7 @@ export default function Telegram() {
await updateTelegramConfig({
...data,
[key]: value,
} as API.GetTelegramConfigResponse);
} as API.TelegramConfig);
toast.success(t('saveSuccess'));
refetch();
} catch (error) {
+1 -1
View File
@@ -25,7 +25,7 @@ export default function Tos() {
await updateTosConfig({
...data,
[key]: value,
} as API.GetTosConfigResponse);
} as API.TosConfig);
toast.success(t('saveSuccess'));
refetch();
} catch (error) {
+1 -1
View File
@@ -26,7 +26,7 @@ export default function Verify() {
await updateVerifyConfig({
...data,
[key]: value,
} as API.GetVerifyConfigResponse);
} as API.VerifyConfig);
toast.success(t('saveSuccess'));
refetch();
} catch (error) {
+7
View File
@@ -26,13 +26,20 @@ export const useGlobalStore = create<GlobalStore>((set) => ({
enable_email_verify: false,
enable_email_domain_suffix: false,
email_domain_suffix_list: '',
enable_trial: false,
enable_ip_register_limit: false,
ip_register_limit: 0,
ip_register_limit_duration: 0,
},
invite: {
forced_invite: false,
referral_percentage: 0,
only_first_purchase: false,
},
currency: {
currency_unit: 'USD',
currency_symbol: '$',
access_key: '',
},
subscribe: {
single_model: false,
+2 -2
View File
@@ -1,7 +1,7 @@
{
"billing": {
"title": "赞助商",
"description": "赞助有助于 PPanel 继续发布更新!"
"description": "Sponsoring helps PPanel to continue releasing updates!",
"title": "Sponsor"
},
"empty": [
"Imagine this place filled with exciting content! For now, you'll have to use your imagination...",
+2 -2
View File
@@ -1,7 +1,7 @@
{
"billing": {
"title": "赞助商",
"description": "赞助有助于 PPanel 继续发布更新!"
"description": "赞助有助于 PPanel 继续发布更新!",
"title": "赞助商"
},
"empty": [
"想象一下这里充满了精彩的内容!暂时只能靠想象了…",
+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;
+19
View File
@@ -22,6 +22,25 @@ export async function getGlobalConfig(options?: { [key: string]: any }) {
});
}
/** Get stat GET /v1/common/site/stat */
export async function getStat(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.GetStatResponse }>('/v1/common/site/stat', {
method: 'GET',
...(options || {}),
});
}
/** 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', {
+351
View File
@@ -1,4 +1,30 @@
declare namespace API {
type Announcement = {
id: number;
title: string;
content: string;
enable: boolean;
created_at: number;
updated_at: number;
};
type Application = {
id: number;
name: string;
platform: string;
subscribe_type: string;
icon: string;
url: string;
};
type ApplicationResponse = {
windows: Application[];
mac: Application[];
linux: Application[];
android: Application[];
ios: Application[];
};
type CheckUserParams = {
email: string;
};
@@ -11,9 +37,58 @@ declare namespace API {
exist: boolean;
};
type Coupon = {
id: number;
name: string;
code: string;
count: number;
type: number;
discount: number;
start_time: number;
expire_time: number;
user_limit: number;
subscribe: number[];
used_count: number;
enable: boolean;
created_at: number;
updated_at: number;
};
type CurrencyConfig = {
currency_unit: string;
currency_symbol: string;
access_key: string;
};
type Document = {
id: number;
title: string;
content: string;
tags: string[];
show: boolean;
created_at: number;
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;
from: string;
type: number;
content: string;
created_at: number;
};
type GetGlobalConfigResponse = {
@@ -25,23 +100,104 @@ declare namespace API {
subscribe: SubscribeConfig;
};
type GetStatResponse = {
user: number;
node: number;
country: number;
};
type GetSubscriptionResponse = {
list: Subscribe[];
};
type GetTosResponse = {
tos_content: string;
};
type InviteConfig = {
forced_invite: boolean;
referral_percentage: number;
only_first_purchase: boolean;
};
type LoginResponse = {
token: string;
};
type NodeConfig = {
node_secret: string;
node_pull_interval: number;
node_push_interval: number;
};
type Order = {
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;
created_at: number;
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;
mark: string;
icon?: string;
domain?: string;
config: Record<string, any>;
fee_mode: number;
fee_percent?: number;
fee_amount?: number;
enable: boolean;
};
type Push = {
push_at: number;
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 ResetPasswordRequest = {
@@ -69,6 +225,40 @@ declare namespace API {
status: boolean;
};
type Server = {
id: number;
name: string;
server_addr: string;
speed_limit: number;
traffic_ratio: number;
groupId: number;
protocol: string;
enable: boolean;
vmess?: Vmess;
vless?: Vless;
trojan?: Trojan;
shadowsocks?: Shadowsocks;
created_at: number;
updated_at: number;
last: Push;
};
type ServerGroup = {
id: number;
name: string;
description: string;
created_at: number;
updated_at: number;
};
type Shadowsocks = {
method: string;
port: number;
enable_relay: boolean;
relay_host: string;
relay_port: number;
};
type SiteConfig = {
host: string;
site_name: string;
@@ -76,6 +266,27 @@ declare namespace API {
site_logo: string;
};
type Subscribe = {
id: number;
name: string;
description: string;
unit_price: number;
discount: SubscribeDiscount[];
replacement: number;
inventory: number;
traffic: number;
speed_limit: number;
device_limit: number;
quota: number;
group_id: number;
server_group: number[];
server: number[];
show: boolean;
sell: boolean;
created_at: number;
updated_at: number;
};
type SubscribeConfig = {
single_model: boolean;
subscribe_path: string;
@@ -83,6 +294,96 @@ declare namespace API {
pan_domain: boolean;
};
type SubscribeDiscount = {
months: number;
discount: number;
};
type SubscribeGroup = {
id: number;
name: string;
description: string;
created_at: number;
updated_at: number;
};
type SubscribeType = {
subscribe_types: string[];
};
type TelegramConfig = {
telegram_bot_token: string;
telegram_group_url: string;
telegram_notify: boolean;
};
type Ticket = {
id: number;
title: string;
description: string;
user_id: number;
follow?: Follow[];
status: number;
created_at: number;
updated_at: number;
};
type TosConfig = {
tos_content: string;
};
type Trojan = {
network: string;
port: number;
host: string;
sni: string;
allow_insecure: boolean;
transport: Record<string, any>;
enable_relay: boolean;
relay_host: string;
relay_port: number;
};
type User = {
id: number;
email: string;
avatar: string;
balance: number;
telegram: number;
refer_code: string;
referer_id: number;
enable: boolean;
is_admin?: boolean;
valid_email: boolean;
enable_email_notify: boolean;
enable_telegram_notify: boolean;
enable_balance_notify: boolean;
enable_login_notify: boolean;
enable_subscribe_notify: boolean;
enable_trade_notify: boolean;
created_at: number;
updated_at: number;
deleted_at?: number;
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 UserLoginRequest = {
email: string;
password: string;
@@ -97,10 +398,60 @@ declare namespace API {
cf_token?: string;
};
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 VeifyConfig = {
turnstile_site_key: string;
enable_login_verify: boolean;
enable_register_verify: boolean;
enable_reset_password_verify: boolean;
};
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;
network: string;
transport: Record<string, any>;
security: string;
security_config: Record<string, any>;
xtls: string;
enable_relay: boolean;
relay_host: string;
relay_port: number;
};
type Vmess = {
host: string;
port: number;
enable_tls: boolean;
tls_config: Record<string, any>;
network: string;
transport: Record<string, any>;
enable_relay: boolean;
relay_host: string;
relay_port: number;
};
}