🐛 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({ await updateCurrencyConfig({
...data, ...data,
[key]: value, [key]: value,
} as API.UpdateCurrencyConfigRequest); } as API.CurrencyConfig);
toast.success(t('saveSuccess')); toast.success(t('saveSuccess'));
refetch(); refetch();
} catch (error) { } catch (error) {
+1 -1
View File
@@ -31,7 +31,7 @@ export default function Email() {
await updateEmailSmtpConfig({ await updateEmailSmtpConfig({
...data, ...data,
[key]: value, [key]: value,
} as API.UpdateEmailSmtpConfigRequest); } as API.EmailSmtpConfig);
toast.success(t('saveSuccess')); toast.success(t('saveSuccess'));
refetch(); refetch();
} catch (error) { } catch (error) {
+1 -1
View File
@@ -27,7 +27,7 @@ export default function Invite() {
await updateInviteConfig({ await updateInviteConfig({
...data, ...data,
[key]: value, [key]: value,
} as API.UpdateInviteConfigRequest); } as API.InviteConfig);
toast.success(t('saveSuccess')); toast.success(t('saveSuccess'));
refetch(); refetch();
} catch (error) { } catch (error) {
+1 -1
View File
@@ -28,7 +28,7 @@ export default function Node() {
await updateNodeConfig({ await updateNodeConfig({
...data, ...data,
[key]: value, [key]: value,
} as API.GetNodeConfigResponse); } as API.NodeConfig);
toast.success(t('saveSuccess')); toast.success(t('saveSuccess'));
refetch(); refetch();
} catch (error) { } catch (error) {
+1 -1
View File
@@ -28,7 +28,7 @@ export default function Register() {
await updateRegisterConfig({ await updateRegisterConfig({
...data, ...data,
[key]: value, [key]: value,
} as API.GetRegisterConfigResponse); } as API.RegisterConfig);
toast.success(t('saveSuccess')); toast.success(t('saveSuccess'));
refetch(); refetch();
} catch (error) { } catch (error) {
@@ -24,8 +24,8 @@ import { Tabs, TabsContent, TabsList, TabsTrigger } from '@shadcn/ui/tabs';
import { Textarea } from '@shadcn/ui/textarea'; import { Textarea } from '@shadcn/ui/textarea';
function compareData( function compareData(
originalData: API.GetApplicationResponse, originalData: API.ApplicationResponse,
modifiedData: API.GetApplicationResponse, modifiedData: API.ApplicationResponse,
): { ): {
added: API.Application[]; added: API.Application[];
deleted: API.Application[]; deleted: API.Application[];
@@ -107,7 +107,7 @@ export default function Subscription() {
await updateSubscribeConfig({ await updateSubscribeConfig({
...data, ...data,
[key]: value, [key]: value,
} as API.GetSubscribeConfigResponse); } as API.SubscribeConfig);
toast.success(t('saveSuccess')); toast.success(t('saveSuccess'));
refetch(); refetch();
} catch (error) { } catch (error) {
@@ -123,7 +123,7 @@ export default function Subscription() {
return data.data?.subscribe_types || []; return data.data?.subscribe_types || [];
}, },
}); });
const [app, setApp] = useState<API.GetApplicationResponse>(); const [app, setApp] = useState<API.ApplicationResponse>();
const appTypes = Object.keys(apps || {}); const appTypes = Object.keys(apps || {});
useEffect(() => { useEffect(() => {
@@ -253,7 +253,7 @@ export default function Subscription() {
setApp({ setApp({
...app, ...app,
[type]: newList, [type]: newList,
} as API.GetApplicationResponse); } as API.ApplicationResponse);
}; };
return ( return (
@@ -300,7 +300,7 @@ export default function Subscription() {
setApp({ setApp({
...app, ...app,
[type]: list.filter((l, i) => i !== index), [type]: list.filter((l, i) => i !== index),
} as API.GetApplicationResponse); } as API.ApplicationResponse);
}} }}
> >
{t('delete')} {t('delete')}
@@ -320,7 +320,7 @@ export default function Subscription() {
platform: type, platform: type,
}, },
], ],
} as API.GetApplicationResponse); } as API.ApplicationResponse);
}} }}
> >
{t('add')} {t('add')}
+1 -1
View File
@@ -27,7 +27,7 @@ export default function Telegram() {
await updateTelegramConfig({ await updateTelegramConfig({
...data, ...data,
[key]: value, [key]: value,
} as API.GetTelegramConfigResponse); } as API.TelegramConfig);
toast.success(t('saveSuccess')); toast.success(t('saveSuccess'));
refetch(); refetch();
} catch (error) { } catch (error) {
+1 -1
View File
@@ -25,7 +25,7 @@ export default function Tos() {
await updateTosConfig({ await updateTosConfig({
...data, ...data,
[key]: value, [key]: value,
} as API.GetTosConfigResponse); } as API.TosConfig);
toast.success(t('saveSuccess')); toast.success(t('saveSuccess'));
refetch(); refetch();
} catch (error) { } catch (error) {
+1 -1
View File
@@ -26,7 +26,7 @@ export default function Verify() {
await updateVerifyConfig({ await updateVerifyConfig({
...data, ...data,
[key]: value, [key]: value,
} as API.GetVerifyConfigResponse); } as API.VerifyConfig);
toast.success(t('saveSuccess')); toast.success(t('saveSuccess'));
refetch(); refetch();
} catch (error) { } catch (error) {
+7
View File
@@ -26,13 +26,20 @@ export const useGlobalStore = create<GlobalStore>((set) => ({
enable_email_verify: false, enable_email_verify: false,
enable_email_domain_suffix: false, enable_email_domain_suffix: false,
email_domain_suffix_list: '', email_domain_suffix_list: '',
enable_trial: false,
enable_ip_register_limit: false,
ip_register_limit: 0,
ip_register_limit_duration: 0,
}, },
invite: { invite: {
forced_invite: false, forced_invite: false,
referral_percentage: 0,
only_first_purchase: false,
}, },
currency: { currency: {
currency_unit: 'USD', currency_unit: 'USD',
currency_symbol: '$', currency_symbol: '$',
access_key: '',
}, },
subscribe: { subscribe: {
single_model: false, single_model: false,
+2 -2
View File
@@ -1,7 +1,7 @@
{ {
"billing": { "billing": {
"title": "赞助商", "description": "Sponsoring helps PPanel to continue releasing updates!",
"description": "赞助有助于 PPanel 继续发布更新!" "title": "Sponsor"
}, },
"empty": [ "empty": [
"Imagine this place filled with exciting content! For now, you'll have to use your imagination...", "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": { "billing": {
"title": "赞助商", "description": "赞助有助于 PPanel 继续发布更新!",
"description": "赞助有助于 PPanel 继续发布更新!" "title": "赞助商"
}, },
"empty": [ "empty": [
"想象一下这里充满了精彩的内容!暂时只能靠想象了…", "想象一下这里充满了精彩的内容!暂时只能靠想象了…",
+32 -77
View File
@@ -4,7 +4,7 @@ import request from '@/utils/request';
/** Get application GET /v1/admin/system/application */ /** Get application GET /v1/admin/system/application */
export async function getApplication(options?: { [key: string]: any }) { 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', '/v1/admin/system/application',
{ {
method: 'GET', method: 'GET',
@@ -60,18 +60,15 @@ export async function deleteApplication(
/** Get Currency Config GET /v1/admin/system/currency_config */ /** Get Currency Config GET /v1/admin/system/currency_config */
export async function getCurrencyConfig(options?: { [key: string]: any }) { export async function getCurrencyConfig(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.GetCurrencyConfigResponse }>( return request<API.Response & { data?: API.CurrencyConfig }>('/v1/admin/system/currency_config', {
'/v1/admin/system/currency_config',
{
method: 'GET', method: 'GET',
...(options || {}), ...(options || {}),
}, });
);
} }
/** Update Currency Config PUT /v1/admin/system/currency_config */ /** Update Currency Config PUT /v1/admin/system/currency_config */
export async function updateCurrencyConfig( export async function updateCurrencyConfig(
body: API.UpdateCurrencyConfigRequest, body: API.CurrencyConfig,
options?: { [key: string]: any }, options?: { [key: string]: any },
) { ) {
return request<API.Response & { data?: any }>('/v1/admin/system/currency_config', { 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 */ /** Get email smtp config GET /v1/admin/system/email_config */
export async function getEmailSmtpConfig(options?: { [key: string]: any }) { export async function getEmailSmtpConfig(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.GetEmailSmtpConfigResponse }>( return request<API.Response & { data?: API.EmailSmtpConfig }>('/v1/admin/system/email_config', {
'/v1/admin/system/email_config',
{
method: 'GET', method: 'GET',
...(options || {}), ...(options || {}),
}, });
);
} }
/** Update email smtp config PUT /v1/admin/system/email_config */ /** Update email smtp config PUT /v1/admin/system/email_config */
export async function updateEmailSmtpConfig( export async function updateEmailSmtpConfig(
body: API.UpdateEmailSmtpConfigRequest, body: API.EmailSmtpConfig,
options?: { [key: string]: any }, options?: { [key: string]: any },
) { ) {
return request<API.Response & { data?: any }>('/v1/admin/system/email_config', { 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 */ /** Get invite config GET /v1/admin/system/invite_config */
export async function getInviteConfig(options?: { [key: string]: any }) { export async function getInviteConfig(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.GetInviteConfigResponse }>( return request<API.Response & { data?: API.InviteConfig }>('/v1/admin/system/invite_config', {
'/v1/admin/system/invite_config',
{
method: 'GET', method: 'GET',
...(options || {}), ...(options || {}),
}, });
);
} }
/** Update invite config PUT /v1/admin/system/invite_config */ /** Update invite config PUT /v1/admin/system/invite_config */
export async function updateInviteConfig( export async function updateInviteConfig(body: API.InviteConfig, options?: { [key: string]: any }) {
body: API.UpdateInviteConfigRequest,
options?: { [key: string]: any },
) {
return request<API.Response & { data?: any }>('/v1/admin/system/invite_config', { return request<API.Response & { data?: any }>('/v1/admin/system/invite_config', {
method: 'PUT', method: 'PUT',
headers: { headers: {
@@ -138,20 +126,14 @@ export async function updateInviteConfig(
/** Get node config GET /v1/admin/system/node_config */ /** Get node config GET /v1/admin/system/node_config */
export async function getNodeConfig(options?: { [key: string]: any }) { export async function getNodeConfig(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.GetNodeConfigResponse }>( return request<API.Response & { data?: API.NodeConfig }>('/v1/admin/system/node_config', {
'/v1/admin/system/node_config',
{
method: 'GET', method: 'GET',
...(options || {}), ...(options || {}),
}, });
);
} }
/** Update node config PUT /v1/admin/system/node_config */ /** Update node config PUT /v1/admin/system/node_config */
export async function updateNodeConfig( export async function updateNodeConfig(body: API.NodeConfig, options?: { [key: string]: any }) {
body: API.UpdateNodeConfigRequest,
options?: { [key: string]: any },
) {
return request<API.Response & { data?: any }>('/v1/admin/system/node_config', { return request<API.Response & { data?: any }>('/v1/admin/system/node_config', {
method: 'PUT', method: 'PUT',
headers: { headers: {
@@ -164,18 +146,15 @@ export async function updateNodeConfig(
/** Get register config GET /v1/admin/system/register_config */ /** Get register config GET /v1/admin/system/register_config */
export async function getRegisterConfig(options?: { [key: string]: any }) { export async function getRegisterConfig(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.GetRegisterConfigResponse }>( return request<API.Response & { data?: API.RegisterConfig }>('/v1/admin/system/register_config', {
'/v1/admin/system/register_config',
{
method: 'GET', method: 'GET',
...(options || {}), ...(options || {}),
}, });
);
} }
/** Update register config PUT /v1/admin/system/register_config */ /** Update register config PUT /v1/admin/system/register_config */
export async function updateRegisterConfig( export async function updateRegisterConfig(
body: API.UpdateRegisterConfigRequest, body: API.RegisterConfig,
options?: { [key: string]: any }, options?: { [key: string]: any },
) { ) {
return request<API.Response & { data?: any }>('/v1/admin/system/register_config', { 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 */ /** Get site config GET /v1/admin/system/site_config */
export async function getSiteConfig(options?: { [key: string]: any }) { export async function getSiteConfig(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.GetSiteConfigResponse }>( return request<API.Response & { data?: API.SiteConfig }>('/v1/admin/system/site_config', {
'/v1/admin/system/site_config',
{
method: 'GET', method: 'GET',
...(options || {}), ...(options || {}),
}, });
);
} }
/** Update site config PUT /v1/admin/system/site_config */ /** Update site config PUT /v1/admin/system/site_config */
export async function updateSiteConfig( export async function updateSiteConfig(body: API.SiteConfig, options?: { [key: string]: any }) {
body: API.UpdateSiteConfigRequest,
options?: { [key: string]: any },
) {
return request<API.Response & { data?: any }>('/v1/admin/system/site_config', { return request<API.Response & { data?: any }>('/v1/admin/system/site_config', {
method: 'PUT', method: 'PUT',
headers: { headers: {
@@ -216,7 +189,7 @@ export async function updateSiteConfig(
/** Get subscribe config GET /v1/admin/system/subscribe_config */ /** Get subscribe config GET /v1/admin/system/subscribe_config */
export async function getSubscribeConfig(options?: { [key: string]: any }) { 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', '/v1/admin/system/subscribe_config',
{ {
method: 'GET', method: 'GET',
@@ -227,7 +200,7 @@ export async function getSubscribeConfig(options?: { [key: string]: any }) {
/** Update subscribe config PUT /v1/admin/system/subscribe_config */ /** Update subscribe config PUT /v1/admin/system/subscribe_config */
export async function updateSubscribeConfig( export async function updateSubscribeConfig(
body: API.UpdateSubscribeConfigRequest, body: API.SubscribeConfig,
options?: { [key: string]: any }, options?: { [key: string]: any },
) { ) {
return request<API.Response & { data?: any }>('/v1/admin/system/subscribe_config', { 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 */ /** Get subscribe type GET /v1/admin/system/subscribe_type */
export async function getSubscribeType(options?: { [key: string]: any }) { export async function getSubscribeType(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.GetSubscribeTypeResponse }>( return request<API.Response & { data?: API.SubscribeType }>('/v1/admin/system/subscribe_type', {
'/v1/admin/system/subscribe_type',
{
method: 'GET', method: 'GET',
...(options || {}), ...(options || {}),
}, });
);
} }
/** Get Telegram Config GET /v1/admin/system/telegram_config */ /** Get Telegram Config GET /v1/admin/system/telegram_config */
export async function getTelegramConfig(options?: { [key: string]: any }) { export async function getTelegramConfig(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.GetTelegramConfigResponse }>( return request<API.Response & { data?: API.TelegramConfig }>('/v1/admin/system/telegram_config', {
'/v1/admin/system/telegram_config',
{
method: 'GET', method: 'GET',
...(options || {}), ...(options || {}),
}, });
);
} }
/** Update Telegram Config PUT /v1/admin/system/telegram_config */ /** Update Telegram Config PUT /v1/admin/system/telegram_config */
export async function updateTelegramConfig( export async function updateTelegramConfig(
body: API.UpdateTelegramConfigRequest, body: API.TelegramConfig,
options?: { [key: string]: any }, options?: { [key: string]: any },
) { ) {
return request<API.Response & { data?: any }>('/v1/admin/system/telegram_config', { 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 */ /** Get Team of Service Config GET /v1/admin/system/tos_config */
export async function getTosConfig(options?: { [key: string]: any }) { export async function getTosConfig(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.GetTosConfigResponse }>( return request<API.Response & { data?: API.TosConfig }>('/v1/admin/system/tos_config', {
'/v1/admin/system/tos_config',
{
method: 'GET', method: 'GET',
...(options || {}), ...(options || {}),
}, });
);
} }
/** Update Team of Service Config PUT /v1/admin/system/tos_config */ /** Update Team of Service Config PUT /v1/admin/system/tos_config */
export async function updateTosConfig( export async function updateTosConfig(body: API.TosConfig, options?: { [key: string]: any }) {
body: API.UpdateTosConfigRequest,
options?: { [key: string]: any },
) {
return request<API.Response & { data?: any }>('/v1/admin/system/tos_config', { return request<API.Response & { data?: any }>('/v1/admin/system/tos_config', {
method: 'PUT', method: 'PUT',
headers: { headers: {
@@ -320,20 +281,14 @@ export async function updateTosConfig(
/** Get verify config GET /v1/admin/system/verify_config */ /** Get verify config GET /v1/admin/system/verify_config */
export async function getVerifyConfig(options?: { [key: string]: any }) { export async function getVerifyConfig(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.GetVerifyConfigResponse }>( return request<API.Response & { data?: API.VerifyConfig }>('/v1/admin/system/verify_config', {
'/v1/admin/system/verify_config',
{
method: 'GET', method: 'GET',
...(options || {}), ...(options || {}),
}, });
);
} }
/** Update verify config PUT /v1/admin/system/verify_config */ /** Update verify config PUT /v1/admin/system/verify_config */
export async function updateVerifyConfig( export async function updateVerifyConfig(body: API.VerifyConfig, options?: { [key: string]: any }) {
body: API.UpdateVerifyConfigRequest,
options?: { [key: string]: any },
) {
return request<API.Response & { data?: any }>('/v1/admin/system/verify_config', { return request<API.Response & { data?: any }>('/v1/admin/system/verify_config', {
method: 'PUT', method: 'PUT',
headers: { headers: {
+138 -154
View File
@@ -17,6 +17,14 @@ declare namespace API {
url: string; url: string;
}; };
type ApplicationResponse = {
windows: Application[];
mac: Application[];
linux: Application[];
android: Application[];
ios: Application[];
};
type BatchDeleteCouponRequest = { type BatchDeleteCouponRequest = {
ids: number[]; ids: number[];
}; };
@@ -172,6 +180,12 @@ declare namespace API {
is_admin: boolean; is_admin: boolean;
}; };
type CurrencyConfig = {
currency_unit: string;
currency_symbol: string;
access_key: string;
};
type DeleteAnnouncementRequest = { type DeleteAnnouncementRequest = {
id: number; id: number;
}; };
@@ -218,6 +232,18 @@ declare namespace API {
updated_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 = { type Follow = {
id: number; id: number;
ticket_id: number; ticket_id: number;
@@ -258,14 +284,6 @@ declare namespace API {
id: number; id: number;
}; };
type GetApplicationResponse = {
windows: Application[];
mac: Application[];
linux: Application[];
android: Application[];
ios: Application[];
};
type GetCouponListParams = { type GetCouponListParams = {
page: number; page: number;
size: number; size: number;
@@ -285,12 +303,6 @@ declare namespace API {
list: Coupon[]; list: Coupon[];
}; };
type GetCurrencyConfigResponse = {
currency_unit: string;
currency_symbol: string;
access_key: string;
};
type GetDetailRequest = { type GetDetailRequest = {
id: number; id: number;
}; };
@@ -318,30 +330,6 @@ declare namespace API {
list: Document[]; 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 = { type GetNodeDetailParams = {
id: number; id: number;
}; };
@@ -397,31 +385,6 @@ declare namespace API {
list: Order[]; 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 = { type GetSubscribeDetailsParams = {
id: number; id: number;
}; };
@@ -454,16 +417,6 @@ declare namespace API {
total: number; total: number;
}; };
type GetSubscribeTypeResponse = {
subscribe_types: string[];
};
type GetTelegramConfigResponse = {
telegram_bot_token: string;
telegram_group_url: string;
telegram_notify: boolean;
};
type GetTicketListParams = { type GetTicketListParams = {
page: number; page: number;
size: number; size: number;
@@ -493,10 +446,6 @@ declare namespace API {
id: number; id: number;
}; };
type GetTosConfigResponse = {
tos_content: string;
};
type GetUserDetailParams = { type GetUserDetailParams = {
id: number; id: number;
}; };
@@ -518,12 +467,16 @@ declare namespace API {
list: User[]; list: User[];
}; };
type GetVerifyConfigResponse = { type InviteConfig = {
turnstile_site_key: string; forced_invite: boolean;
turnstile_secret: string; referral_percentage: number;
enable_login_verify: boolean; only_first_purchase: boolean;
enable_register_verify: boolean; };
enable_reset_password_verify: boolean;
type NodeConfig = {
node_secret: string;
node_pull_interval: number;
node_push_interval: number;
}; };
type Order = { type Order = {
@@ -546,6 +499,27 @@ declare namespace API {
updated_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 = { type PaymentConfig = {
id: number; id: number;
name: string; name: string;
@@ -564,6 +538,17 @@ declare namespace API {
count: 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 Response = { type Response = {
/** 状态码 */ /** 状态码 */
code?: number; code?: number;
@@ -607,6 +592,13 @@ declare namespace API {
relay_port: number; relay_port: number;
}; };
type SiteConfig = {
host: string;
site_name: string;
site_desc: string;
site_logo: string;
};
type Subscribe = { type Subscribe = {
id: number; id: number;
name: string; name: string;
@@ -628,6 +620,13 @@ declare namespace API {
updated_at: number; updated_at: number;
}; };
type SubscribeConfig = {
single_model: boolean;
subscribe_path: string;
subscribe_domain: string;
pan_domain: boolean;
};
type SubscribeDiscount = { type SubscribeDiscount = {
months: number; months: number;
discount: number; discount: number;
@@ -641,6 +640,16 @@ declare namespace API {
updated_at: number; updated_at: number;
}; };
type SubscribeType = {
subscribe_types: string[];
};
type TelegramConfig = {
telegram_bot_token: string;
telegram_group_url: string;
telegram_notify: boolean;
};
type TestEmailSmtpRequest = { type TestEmailSmtpRequest = {
email: string; email: string;
}; };
@@ -656,6 +665,10 @@ declare namespace API {
updated_at: number; updated_at: number;
}; };
type TosConfig = {
tos_content: string;
};
type Trojan = { type Trojan = {
network: string; network: string;
port: number; port: number;
@@ -703,12 +716,6 @@ declare namespace API {
enable?: boolean; enable?: boolean;
}; };
type UpdateCurrencyConfigRequest = {
currency_unit: string;
currency_symbol: string;
access_key: string;
};
type UpdateDocumentRequest = { type UpdateDocumentRequest = {
id: number; id: number;
title: string; title: string;
@@ -717,28 +724,6 @@ declare namespace API {
show: boolean; 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 = { type UpdateNodeGroupRequest = {
id: number; id: number;
name: string; name: string;
@@ -767,31 +752,6 @@ declare namespace API {
trade_no?: string; 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 = { type UpdateSubscribeGroupRequest = {
id: number; id: number;
name: string; name: string;
@@ -817,21 +777,11 @@ declare namespace API {
sell: boolean; sell: boolean;
}; };
type UpdateTelegramConfigRequest = {
telegram_bot_token: string;
telegram_group_url: string;
telegram_notify: boolean;
};
type UpdateTicketStatusRequest = { type UpdateTicketStatusRequest = {
id: number; id: number;
status: number; status: number;
}; };
type UpdateTosConfigRequest = {
tos_content: string;
};
type UpdateUserRequest = { type UpdateUserRequest = {
id: number; id: number;
email: string; email: string;
@@ -852,14 +802,6 @@ declare namespace API {
enable_trade_notify: boolean; 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 = { type User = {
id: number; id: number;
email: string; email: string;
@@ -883,6 +825,48 @@ declare namespace API {
is_del?: boolean; 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 = { type Vless = {
host: string; host: string;
port: number; 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 */ /** Get Tos Content GET /v1/common/site/tos */
export async function getTos(options?: { [key: string]: any }) { export async function getTos(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.GetTosResponse }>('/v1/common/site/tos', { return request<API.Response & { data?: API.GetTosResponse }>('/v1/common/site/tos', {
+351
View File
@@ -1,4 +1,30 @@
declare namespace API { 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 = { type CheckUserParams = {
email: string; email: string;
}; };
@@ -11,9 +37,58 @@ declare namespace API {
exist: boolean; 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 = { type CurrencyConfig = {
currency_unit: string; currency_unit: string;
currency_symbol: 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 = { type GetGlobalConfigResponse = {
@@ -25,23 +100,104 @@ declare namespace API {
subscribe: SubscribeConfig; subscribe: SubscribeConfig;
}; };
type GetStatResponse = {
user: number;
node: number;
country: number;
};
type GetSubscriptionResponse = {
list: Subscribe[];
};
type GetTosResponse = { type GetTosResponse = {
tos_content: string; tos_content: string;
}; };
type InviteConfig = { type InviteConfig = {
forced_invite: boolean; forced_invite: boolean;
referral_percentage: number;
only_first_purchase: boolean;
}; };
type LoginResponse = { type LoginResponse = {
token: string; 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 = { type RegisterConfig = {
stop_register: boolean; stop_register: boolean;
enable_trial: boolean;
enable_email_verify: boolean; enable_email_verify: boolean;
enable_email_domain_suffix: boolean; enable_email_domain_suffix: boolean;
email_domain_suffix_list: string; email_domain_suffix_list: string;
enable_ip_register_limit: boolean;
ip_register_limit: number;
ip_register_limit_duration: number;
}; };
type ResetPasswordRequest = { type ResetPasswordRequest = {
@@ -69,6 +225,40 @@ declare namespace API {
status: boolean; 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 = { type SiteConfig = {
host: string; host: string;
site_name: string; site_name: string;
@@ -76,6 +266,27 @@ declare namespace API {
site_logo: string; 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 = { type SubscribeConfig = {
single_model: boolean; single_model: boolean;
subscribe_path: string; subscribe_path: string;
@@ -83,6 +294,96 @@ declare namespace API {
pan_domain: boolean; 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 = { type UserLoginRequest = {
email: string; email: string;
password: string; password: string;
@@ -97,10 +398,60 @@ declare namespace API {
cf_token?: string; 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 = { type VeifyConfig = {
turnstile_site_key: string; turnstile_site_key: string;
enable_login_verify: boolean; enable_login_verify: boolean;
enable_register_verify: boolean; enable_register_verify: boolean;
enable_reset_password_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;
};
} }
@@ -18,7 +18,7 @@ export default function Announcement() {
page: 1, page: 1,
size: 1, size: 1,
}); });
return (data.data?.announcements?.[0] as API.AnnouncementDetails) || {}; return (data.data?.announcements?.[0] as API.Announcement) || {};
}, },
}); });
@@ -53,10 +53,10 @@ export default function Page() {
queryKey: ['queryApplicationConfig'], queryKey: ['queryApplicationConfig'],
queryFn: async () => { queryFn: async () => {
const { data } = await queryApplicationConfig(); const { data } = await queryApplicationConfig();
return data.data as API.QueryApplicationConfigResponse; return data.data as API.ApplicationResponse;
}, },
}); });
const [platform, setPlatform] = useState<keyof API.QueryApplicationConfigResponse>('windows'); const [platform, setPlatform] = useState<keyof API.ApplicationResponse>('windows');
const handleCopy = async (text: string) => { const handleCopy = async (text: string) => {
try { try {
@@ -79,9 +79,7 @@ export default function Page() {
<div className='flex flex-wrap justify-between gap-4'> <div className='flex flex-wrap justify-between gap-4'>
<Tabs <Tabs
value={platform} value={platform}
onValueChange={(value) => onValueChange={(value) => setPlatform(value as keyof API.ApplicationResponse)}
setPlatform(value as keyof API.QueryApplicationConfigResponse)
}
className='w-full max-w-full md:w-auto' className='w-full max-w-full md:w-auto'
> >
<TabsList className='flex *:flex-auto'> <TabsList className='flex *:flex-auto'>
@@ -12,18 +12,18 @@ import { AnimatePresence, motion } from 'framer-motion';
import { useTranslations } from 'next-intl'; import { useTranslations } from 'next-intl';
import { useEffect, useId, useRef, useState } from 'react'; import { useEffect, useId, useRef, useState } from 'react';
export function DocumentButton({ items }: { items: API.DocumentItem[] }) { export function DocumentButton({ items }: { items: API.Document[] }) {
const t = useTranslations('document'); const t = useTranslations('document');
const [active, setActive] = useState<API.DocumentItem | boolean | null>(null); const [active, setActive] = useState<API.Document | boolean | null>(null);
const id = useId(); const id = useId();
const ref = useRef<HTMLDivElement>(null); const ref = useRef<HTMLDivElement>(null);
const { data } = useQuery({ const { data } = useQuery({
enabled: !!(active as API.DocumentItem)?.id, enabled: !!(active as API.Document)?.id,
queryKey: ['queryDocumentDetail', (active as API.DocumentItem)?.id], queryKey: ['queryDocumentDetail', (active as API.Document)?.id],
queryFn: async () => { queryFn: async () => {
const { data } = await queryDocumentDetail({ const { data } = await queryDocumentDetail({
id: (active as API.DocumentItem)?.id, id: (active as API.Document)?.id,
}); });
return data.data?.content; return data.data?.content;
}, },
+5 -5
View File
@@ -15,7 +15,7 @@ export default function Page() {
const ref = useRef<ProListActions>(null); const ref = useRef<ProListActions>(null);
return ( return (
<ProList<API.OrderDetails, Record<string, unknown>> <ProList<API.OrderDetail, Record<string, unknown>>
action={ref} action={ref}
request={async (pagination, filter) => { request={async (pagination, filter) => {
const response = await queryOrderList({ ...pagination, ...filter }); const response = await queryOrderList({ ...pagination, ...filter });
@@ -30,14 +30,14 @@ export default function Page() {
<CardHeader className='bg-muted/50 flex flex-row items-center justify-between gap-2 space-y-0 p-3'> <CardHeader className='bg-muted/50 flex flex-row items-center justify-between gap-2 space-y-0 p-3'>
<CardTitle> <CardTitle>
{t('orderNo')} {t('orderNo')}
<p className='text-sm'>{item.orderNo}</p> <p className='text-sm'>{item.order_no}</p>
</CardTitle> </CardTitle>
<CardDescription className='flex gap-2'> <CardDescription className='flex gap-2'>
{item.status === 1 ? ( {item.status === 1 ? (
<> <>
<Link <Link
key='payment' key='payment'
href={`/payment?order_no=${item.orderNo}`} href={`/payment?order_no=${item.order_no}`}
className={buttonVariants({ size: 'sm' })} className={buttonVariants({ size: 'sm' })}
> >
{t('payment')} {t('payment')}
@@ -47,7 +47,7 @@ export default function Page() {
size='sm' size='sm'
variant='destructive' variant='destructive'
onClick={async () => { onClick={async () => {
await closeOrder({ orderNo: item.orderNo }); await closeOrder({ orderNo: item.order_no });
ref.current?.refresh(); ref.current?.refresh();
}} }}
> >
@@ -57,7 +57,7 @@ export default function Page() {
) : ( ) : (
<Link <Link
key='detail' key='detail'
href={`/payment?order_no=${item.orderNo}`} href={`/payment?order_no=${item.order_no}`}
className={buttonVariants({ size: 'sm' })} className={buttonVariants({ size: 'sm' })}
> >
{t('detail')} {t('detail')}
@@ -25,8 +25,8 @@ export default function Purchase({
subscribe, subscribe,
setSubscribe, setSubscribe,
}: { }: {
subscribe?: API.SubscribeDetails; subscribe?: API.Subscribe;
setSubscribe: (subscribe?: API.SubscribeDetails) => void; setSubscribe: (subscribe?: API.Subscribe) => void;
}) { }) {
const t = useTranslations('order'); const t = useTranslations('order');
@@ -26,8 +26,8 @@ export default function Renewal({
subscribe, subscribe,
}: { }: {
mark: string; mark: string;
subscribe: Omit<API.SubscribeDetails, 'discount'> & { subscribe: Omit<API.Subscribe, 'discount'> & {
discount: string | API.UserSubscribeDiscount[]; discount: string | API.SubscribeDiscount[];
}; };
}) { }) {
const t = useTranslations('order'); const t = useTranslations('order');
@@ -77,7 +77,7 @@ export default function Renewal({
function getDiscount() { function getDiscount() {
try { try {
if (typeof subscribe.discount === 'string') { if (typeof subscribe.discount === 'string') {
return JSON.parse(subscribe?.discount) as API.UserSubscribeDiscount[]; return JSON.parse(subscribe?.discount) as API.SubscribeDiscount[];
} }
return subscribe?.discount; return subscribe?.discount;
} catch (error) { } catch (error) {
@@ -17,7 +17,7 @@ import { SubscribeDetail } from './detail';
export default function Page() { export default function Page() {
const t = useTranslations('subscribe'); const t = useTranslations('subscribe');
const [subscribe, setSubscribe] = useState<API.SubscribeDetails>(); const [subscribe, setSubscribe] = useState<API.Subscribe>();
const [group, setGroup] = useState<string>(''); const [group, setGroup] = useState<string>('');
@@ -81,7 +81,6 @@ export default function Page() {
icon: string; icon: string;
label: string; label: string;
type: 'default' | 'success' | 'destructive'; type: 'default' | 'success' | 'destructive';
support: boolean;
}, },
index: number, index: number,
) => ( ) => (
+2 -2
View File
@@ -51,7 +51,7 @@ export default function Page() {
queryKey: ['getUserTicketDetails', ticketId], queryKey: ['getUserTicketDetails', ticketId],
queryFn: async () => { queryFn: async () => {
const { data } = await getUserTicketDetails({ id: ticketId }); const { data } = await getUserTicketDetails({ id: ticketId });
return data.data as API.UserTicket; return data.data as API.Ticket;
}, },
enabled: !!ticketId, enabled: !!ticketId,
refetchInterval: 5000, refetchInterval: 5000,
@@ -74,7 +74,7 @@ export default function Page() {
return ( return (
<> <>
<ProList<API.UserTicket, { status: number }> <ProList<API.Ticket, { status: number }>
action={ref} action={ref}
header={{ header={{
title: t('ticketList'), title: t('ticketList'),
+11 -8
View File
@@ -5,15 +5,11 @@ import Base64 from 'crypto-js/enc-base64';
import UTF8 from 'crypto-js/enc-utf8'; import UTF8 from 'crypto-js/enc-utf8';
import { create } from 'zustand'; import { create } from 'zustand';
interface ICommon extends API.GetGlobalConfigResponse {
background: string;
}
export interface GlobalStore { export interface GlobalStore {
common: ICommon; common: API.GetGlobalConfigResponse;
user?: API.UserInfo; user?: API.User;
setCommon: (common: Partial<ICommon>) => void; setCommon: (common: Partial<API.GetGlobalConfigResponse>) => void;
setUser: (user?: API.UserInfo) => void; setUser: (user?: API.User) => void;
getUserInfo: () => Promise<void>; getUserInfo: () => Promise<void>;
getUserSubscribe: (uuid: string, type?: string) => string[]; getUserSubscribe: (uuid: string, type?: string) => string[];
getAppSubLink: (type: string, url: string) => string; getAppSubLink: (type: string, url: string) => string;
@@ -39,13 +35,20 @@ export const useGlobalStore = create<GlobalStore>((set, get) => ({
enable_email_verify: false, enable_email_verify: false,
enable_email_domain_suffix: false, enable_email_domain_suffix: false,
email_domain_suffix_list: '', email_domain_suffix_list: '',
enable_trial: false,
enable_ip_register_limit: false,
ip_register_limit: 0,
ip_register_limit_duration: 0,
}, },
invite: { invite: {
forced_invite: false, forced_invite: false,
referral_percentage: 0,
only_first_purchase: false,
}, },
currency: { currency: {
currency_unit: 'USD', currency_unit: 'USD',
currency_symbol: '$', currency_symbol: '$',
access_key: '',
}, },
subscribe: { subscribe: {
single_model: false, single_model: false,
+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 */ /** Get Tos Content GET /v1/common/site/tos */
export async function getTos(options?: { [key: string]: any }) { export async function getTos(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.GetTosResponse }>('/v1/common/site/tos', { return request<API.Response & { data?: API.GetTosResponse }>('/v1/common/site/tos', {
+351
View File
@@ -1,4 +1,30 @@
declare namespace API { 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 = { type CheckUserParams = {
email: string; email: string;
}; };
@@ -11,9 +37,58 @@ declare namespace API {
exist: boolean; 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 = { type CurrencyConfig = {
currency_unit: string; currency_unit: string;
currency_symbol: 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 = { type GetGlobalConfigResponse = {
@@ -25,23 +100,104 @@ declare namespace API {
subscribe: SubscribeConfig; subscribe: SubscribeConfig;
}; };
type GetStatResponse = {
user: number;
node: number;
country: number;
};
type GetSubscriptionResponse = {
list: Subscribe[];
};
type GetTosResponse = { type GetTosResponse = {
tos_content: string; tos_content: string;
}; };
type InviteConfig = { type InviteConfig = {
forced_invite: boolean; forced_invite: boolean;
referral_percentage: number;
only_first_purchase: boolean;
}; };
type LoginResponse = { type LoginResponse = {
token: string; 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 = { type RegisterConfig = {
stop_register: boolean; stop_register: boolean;
enable_trial: boolean;
enable_email_verify: boolean; enable_email_verify: boolean;
enable_email_domain_suffix: boolean; enable_email_domain_suffix: boolean;
email_domain_suffix_list: string; email_domain_suffix_list: string;
enable_ip_register_limit: boolean;
ip_register_limit: number;
ip_register_limit_duration: number;
}; };
type ResetPasswordRequest = { type ResetPasswordRequest = {
@@ -69,6 +225,40 @@ declare namespace API {
status: boolean; 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 = { type SiteConfig = {
host: string; host: string;
site_name: string; site_name: string;
@@ -76,6 +266,27 @@ declare namespace API {
site_logo: string; 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 = { type SubscribeConfig = {
single_model: boolean; single_model: boolean;
subscribe_path: string; subscribe_path: string;
@@ -83,6 +294,96 @@ declare namespace API {
pan_domain: boolean; 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 = { type UserLoginRequest = {
email: string; email: string;
password: string; password: string;
@@ -97,10 +398,60 @@ declare namespace API {
cf_token?: string; 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 = { type VeifyConfig = {
turnstile_site_key: string; turnstile_site_key: string;
enable_login_verify: boolean; enable_login_verify: boolean;
enable_register_verify: boolean; enable_register_verify: boolean;
enable_reset_password_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;
};
} }
+1 -1
View File
@@ -8,7 +8,7 @@ export async function queryDocumentDetail(
params: API.QueryDocumentDetailParams, params: API.QueryDocumentDetailParams,
options?: { [key: string]: any }, options?: { [key: string]: any },
) { ) {
return request<API.Response & { data?: API.DocumentDetail }>('/v1/public/document/detail', { return request<API.Response & { data?: API.Document }>('/v1/public/document/detail', {
method: 'GET', method: 'GET',
params: { params: {
...params, ...params,
+1 -1
View File
@@ -35,7 +35,7 @@ export async function queryOrderDetail(
params: API.QueryOrderDetailParams, params: API.QueryOrderDetailParams,
options?: { [key: string]: any }, options?: { [key: string]: any },
) { ) {
return request<API.Response & { data?: API.OrderDetails }>('/v1/public/order/detail', { return request<API.Response & { data?: API.OrderDetail }>('/v1/public/order/detail', {
method: 'GET', method: 'GET',
params: { params: {
...params, ...params,
+1 -1
View File
@@ -4,7 +4,7 @@ import request from '@/utils/request';
/** Get application config GET /v1/public/subscribe/application/config */ /** Get application config GET /v1/public/subscribe/application/config */
export async function queryApplicationConfig(options?: { [key: string]: any }) { export async function queryApplicationConfig(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.QueryApplicationConfigResponse }>( return request<API.Response & { data?: API.ApplicationResponse }>(
'/v1/public/subscribe/application/config', '/v1/public/subscribe/application/config',
{ {
method: 'GET', method: 'GET',
+1 -1
View File
@@ -38,7 +38,7 @@ export async function getUserTicketDetails(
params: API.GetUserTicketDetailsParams, params: API.GetUserTicketDetailsParams,
options?: { [key: string]: any }, options?: { [key: string]: any },
) { ) {
return request<API.Response & { data?: API.UserTicket }>('/v1/public/ticket/detail', { return request<API.Response & { data?: API.Ticket }>('/v1/public/ticket/detail', {
method: 'GET', method: 'GET',
params: { params: {
...params, ...params,
+263 -105
View File
@@ -1,13 +1,14 @@
declare namespace API { declare namespace API {
type AnnouncementDetails = { type Announcement = {
id: number; id: number;
title: string; title: string;
content: string; content: string;
enable: boolean;
created_at: number; created_at: number;
updated_at: number; updated_at: number;
}; };
type ApplicationConfig = { type Application = {
id: number; id: number;
name: string; name: string;
platform: string; platform: string;
@@ -16,6 +17,14 @@ declare namespace API {
url: string; url: string;
}; };
type ApplicationResponse = {
windows: Application[];
mac: Application[];
linux: Application[];
android: Application[];
ios: Application[];
};
type CheckoutOrderRequest = { type CheckoutOrderRequest = {
orderNo: string; orderNo: string;
}; };
@@ -30,6 +39,23 @@ declare namespace API {
orderNo: string; orderNo: string;
}; };
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 CreateUserTicketFollowRequest = { type CreateUserTicketFollowRequest = {
ticket_id: number; ticket_id: number;
from: string; from: string;
@@ -42,24 +68,45 @@ declare namespace API {
description: string; description: string;
}; };
type DocumentDetail = { type CurrencyConfig = {
currency_unit: string;
currency_symbol: string;
access_key: string;
};
type Document = {
id: number; id: number;
title: string; title: string;
content: string; content: string;
tags: string[]; tags: string[];
show: boolean;
created_at: number; created_at: number;
updated_at: number; updated_at: number;
}; };
type DocumentItem = { 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; id: number;
title: string; ticket_id: number;
tags: string[]; from: string;
updated_at: number; type: number;
content: string;
created_at: number;
}; };
type GetAvailablePaymentMethodsResponse = { type GetAvailablePaymentMethodsResponse = {
list: PaymentItem[]; list: PaymentConfig[];
}; };
type GetUserTicketDetailRequest = { type GetUserTicketDetailRequest = {
@@ -86,12 +133,25 @@ declare namespace API {
type GetUserTicketListResponse = { type GetUserTicketListResponse = {
total: number; total: number;
list: UserTicket[]; list: Ticket[];
}; };
type OrderDetails = { 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 = {
id: number; id: number;
orderNo: string; user_id: number;
order_no: string;
type: number; type: number;
quantity: number; quantity: number;
price: number; price: number;
@@ -104,19 +164,41 @@ declare namespace API {
trade_no: string; trade_no: string;
status: number; status: number;
subscribe_id: number; subscribe_id: number;
subscribe: SubscribeInfo;
created_at: number; created_at: number;
updated_at: number;
}; };
type PaymentItem = { 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; id: number;
name: string; name: string;
mark: string; mark: string;
icon: string; icon?: string;
domain: string; domain?: string;
config: Record<string, any>;
fee_mode: number; fee_mode: number;
fee_percent: number; fee_percent?: number;
fee_amount: number; fee_amount?: number;
enable: boolean; enable: boolean;
}; };
@@ -144,6 +226,11 @@ declare namespace API {
order_no: string; order_no: string;
}; };
type Push = {
push_at: number;
count: number;
};
type QueryAnnouncementParams = { type QueryAnnouncementParams = {
page: number; page: number;
size: number; size: number;
@@ -156,15 +243,7 @@ declare namespace API {
type QueryAnnouncementResponse = { type QueryAnnouncementResponse = {
total: number; total: number;
announcements: AnnouncementDetails[]; announcements: Announcement[];
};
type QueryApplicationConfigResponse = {
windows: ApplicationConfig[];
mac: ApplicationConfig[];
linux: ApplicationConfig[];
android: ApplicationConfig[];
ios: ApplicationConfig[];
}; };
type QueryDocumentDetailParams = { type QueryDocumentDetailParams = {
@@ -177,7 +256,7 @@ declare namespace API {
type QueryDocumentListResponse = { type QueryDocumentListResponse = {
total: number; total: number;
list: DocumentItem[]; list: Document[];
}; };
type QueryOrderDetailParams = { type QueryOrderDetailParams = {
@@ -200,16 +279,16 @@ declare namespace API {
type QueryOrderListResponse = { type QueryOrderListResponse = {
total: number; total: number;
list: OrderDetails[]; list: OrderDetail[];
}; };
type QuerySubscribeGroupListResponse = { type QuerySubscribeGroupListResponse = {
list: UserSubscribeGroupDetails[]; list: SubscribeGroup[];
total: number; total: number;
}; };
type QuerySubscribeListResponse = { type QuerySubscribeListResponse = {
list: SubscribeDetails[]; list: Subscribe[];
total: number; total: number;
}; };
@@ -238,6 +317,17 @@ declare namespace API {
order_no: string; order_no: string;
}; };
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 RenewalOrderRequest = { type RenewalOrderRequest = {
subscribe_id: number; subscribe_id: number;
quantity: number; quantity: number;
@@ -269,66 +359,129 @@ declare namespace API {
data?: Record<string, any>; data?: Record<string, any>;
}; };
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;
site_desc: string;
site_logo: string;
};
type StripePayment = { type StripePayment = {
method: string; method: string;
client_secret: string; client_secret: string;
publishable_key: string; publishable_key: string;
}; };
type SubscribeDetails = { type Subscribe = {
id: number; id: number;
name: string; name: string;
description: string; description: string;
unit_price: number; unit_price: number;
discount: UserSubscribeDiscount[]; discount: SubscribeDiscount[];
replacement: number; replacement: number;
inventory: number; inventory: number;
traffic: number; traffic: number;
group_id: number;
speed_limit: number; speed_limit: number;
device_limit: number; device_limit: number;
quota: number; quota: number;
group_id: number;
server_group: number[];
server: number[];
show: boolean; show: boolean;
sell: boolean; sell: boolean;
created_at: number;
updated_at: number;
}; };
type SubscribeDiscountInfo = { type SubscribeConfig = {
single_model: boolean;
subscribe_path: string;
subscribe_domain: string;
pan_domain: boolean;
};
type SubscribeDiscount = {
months: number; months: number;
discount: number; discount: number;
}; };
type SubscribeInfo = { type SubscribeGroup = {
id: number; id: number;
name: string; name: string;
description: string; description: string;
discount: string; created_at: number;
unit_price: number; updated_at: number;
replacement: number;
inventory: number;
traffic: number;
group_id: number;
speed_limit: number;
device_limit: number;
quota: number;
show: boolean;
sell: boolean;
}; };
type SubscribeItem = { type SubscribeType = {
subscribe_types: string[];
};
type TelegramConfig = {
telegram_bot_token: string;
telegram_group_url: string;
telegram_notify: boolean;
};
type Ticket = {
id: number; id: number;
name: string; title: string;
description: string; description: string;
discount: string; user_id: number;
unit_price: number; follow?: Follow[];
replacement: number; status: number;
inventory: number; created_at: number;
traffic: number; updated_at: number;
group_id: number; };
speed_limit: number;
device_limit: number; type TosConfig = {
quota: number; tos_content: string;
show: boolean; };
sell: boolean;
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 UpdateUserNotifyRequest = { type UpdateUserNotifyRequest = {
@@ -353,6 +506,29 @@ declare namespace API {
status: number; status: 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 = { type UserAffiliate = {
email: string; email: string;
avatar: string; avatar: string;
@@ -370,41 +546,12 @@ declare namespace API {
created_at: number; created_at: number;
}; };
type UserFollow = {
id: number;
ticket_id: number;
from: string;
type: number;
content: string;
created_at: number;
};
type UserInfo = {
id: number;
email: string;
avatar: string;
balance: number;
telegram: number;
refer_code: string;
referer_id: number;
enable: 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;
};
type UserSubscribe = { type UserSubscribe = {
id: number; id: number;
user_id: number; user_id: number;
order_id: number; order_id: number;
subscribe_id: number; subscribe_id: number;
subscribe: SubscribeItem; subscribe: Subscribe;
start_time: number; start_time: number;
expire_time: number; expire_time: number;
traffic: number; traffic: number;
@@ -416,25 +563,36 @@ declare namespace API {
updated_at: number; updated_at: number;
}; };
type UserSubscribeDiscount = { type VerifyConfig = {
months: number; turnstile_site_key: string;
discount: number; turnstile_secret: string;
enable_login_verify: boolean;
enable_register_verify: boolean;
enable_reset_password_verify: boolean;
}; };
type UserSubscribeGroupDetails = { type Vless = {
id: number; host: string;
name: string; port: number;
description: string; 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 UserTicket = { type Vmess = {
id: number; host: string;
title: string; port: number;
description: string; enable_tls: boolean;
user_id: number; tls_config: Record<string, any>;
follow?: UserFollow[]; network: string;
status: number; transport: Record<string, any>;
created_at: number; enable_relay: boolean;
updated_at: number; relay_host: string;
relay_port: number;
}; };
} }
+1 -1
View File
@@ -26,7 +26,7 @@ export async function queryUserBalanceLog(options?: { [key: string]: any }) {
/** Query User Info GET /v1/public/user/info */ /** Query User Info GET /v1/public/user/info */
export async function queryUserInfo(options?: { [key: string]: any }) { export async function queryUserInfo(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.UserInfo }>('/v1/public/user/info', { return request<API.Response & { data?: API.User }>('/v1/public/user/info', {
method: 'GET', method: 'GET',
...(options || {}), ...(options || {}),
}); });