🐛 fix(api): Update Model
This commit is contained in:
parent
81e0f21a39
commit
39aaa73d6d
@ -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) {
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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')}
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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...",
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"billing": {
|
||||
"title": "赞助商",
|
||||
"description": "赞助有助于 PPanel 继续发布更新!"
|
||||
"description": "赞助有助于 PPanel 继续发布更新!",
|
||||
"title": "赞助商"
|
||||
},
|
||||
"empty": [
|
||||
"想象一下这里充满了精彩的内容!暂时只能靠想象了…",
|
||||
|
||||
@ -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: {
|
||||
|
||||
292
apps/admin/services/admin/typings.d.ts
vendored
292
apps/admin/services/admin/typings.d.ts
vendored
@ -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;
|
||||
|
||||
@ -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
apps/admin/services/common/typings.d.ts
vendored
351
apps/admin/services/common/typings.d.ts
vendored
@ -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;
|
||||
};
|
||||
}
|
||||
|
||||
@ -18,7 +18,7 @@ export default function Announcement() {
|
||||
page: 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'],
|
||||
queryFn: async () => {
|
||||
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) => {
|
||||
try {
|
||||
@ -79,9 +79,7 @@ export default function Page() {
|
||||
<div className='flex flex-wrap justify-between gap-4'>
|
||||
<Tabs
|
||||
value={platform}
|
||||
onValueChange={(value) =>
|
||||
setPlatform(value as keyof API.QueryApplicationConfigResponse)
|
||||
}
|
||||
onValueChange={(value) => setPlatform(value as keyof API.ApplicationResponse)}
|
||||
className='w-full max-w-full md:w-auto'
|
||||
>
|
||||
<TabsList className='flex *:flex-auto'>
|
||||
|
||||
@ -12,18 +12,18 @@ import { AnimatePresence, motion } from 'framer-motion';
|
||||
import { useTranslations } from 'next-intl';
|
||||
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 [active, setActive] = useState<API.DocumentItem | boolean | null>(null);
|
||||
const [active, setActive] = useState<API.Document | boolean | null>(null);
|
||||
const id = useId();
|
||||
const ref = useRef<HTMLDivElement>(null);
|
||||
|
||||
const { data } = useQuery({
|
||||
enabled: !!(active as API.DocumentItem)?.id,
|
||||
queryKey: ['queryDocumentDetail', (active as API.DocumentItem)?.id],
|
||||
enabled: !!(active as API.Document)?.id,
|
||||
queryKey: ['queryDocumentDetail', (active as API.Document)?.id],
|
||||
queryFn: async () => {
|
||||
const { data } = await queryDocumentDetail({
|
||||
id: (active as API.DocumentItem)?.id,
|
||||
id: (active as API.Document)?.id,
|
||||
});
|
||||
return data.data?.content;
|
||||
},
|
||||
|
||||
@ -15,7 +15,7 @@ export default function Page() {
|
||||
|
||||
const ref = useRef<ProListActions>(null);
|
||||
return (
|
||||
<ProList<API.OrderDetails, Record<string, unknown>>
|
||||
<ProList<API.OrderDetail, Record<string, unknown>>
|
||||
action={ref}
|
||||
request={async (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'>
|
||||
<CardTitle>
|
||||
{t('orderNo')}
|
||||
<p className='text-sm'>{item.orderNo}</p>
|
||||
<p className='text-sm'>{item.order_no}</p>
|
||||
</CardTitle>
|
||||
<CardDescription className='flex gap-2'>
|
||||
{item.status === 1 ? (
|
||||
<>
|
||||
<Link
|
||||
key='payment'
|
||||
href={`/payment?order_no=${item.orderNo}`}
|
||||
href={`/payment?order_no=${item.order_no}`}
|
||||
className={buttonVariants({ size: 'sm' })}
|
||||
>
|
||||
{t('payment')}
|
||||
@ -47,7 +47,7 @@ export default function Page() {
|
||||
size='sm'
|
||||
variant='destructive'
|
||||
onClick={async () => {
|
||||
await closeOrder({ orderNo: item.orderNo });
|
||||
await closeOrder({ orderNo: item.order_no });
|
||||
ref.current?.refresh();
|
||||
}}
|
||||
>
|
||||
@ -57,7 +57,7 @@ export default function Page() {
|
||||
) : (
|
||||
<Link
|
||||
key='detail'
|
||||
href={`/payment?order_no=${item.orderNo}`}
|
||||
href={`/payment?order_no=${item.order_no}`}
|
||||
className={buttonVariants({ size: 'sm' })}
|
||||
>
|
||||
{t('detail')}
|
||||
|
||||
@ -25,8 +25,8 @@ export default function Purchase({
|
||||
subscribe,
|
||||
setSubscribe,
|
||||
}: {
|
||||
subscribe?: API.SubscribeDetails;
|
||||
setSubscribe: (subscribe?: API.SubscribeDetails) => void;
|
||||
subscribe?: API.Subscribe;
|
||||
setSubscribe: (subscribe?: API.Subscribe) => void;
|
||||
}) {
|
||||
const t = useTranslations('order');
|
||||
|
||||
|
||||
@ -26,8 +26,8 @@ export default function Renewal({
|
||||
subscribe,
|
||||
}: {
|
||||
mark: string;
|
||||
subscribe: Omit<API.SubscribeDetails, 'discount'> & {
|
||||
discount: string | API.UserSubscribeDiscount[];
|
||||
subscribe: Omit<API.Subscribe, 'discount'> & {
|
||||
discount: string | API.SubscribeDiscount[];
|
||||
};
|
||||
}) {
|
||||
const t = useTranslations('order');
|
||||
@ -77,7 +77,7 @@ export default function Renewal({
|
||||
function getDiscount() {
|
||||
try {
|
||||
if (typeof subscribe.discount === 'string') {
|
||||
return JSON.parse(subscribe?.discount) as API.UserSubscribeDiscount[];
|
||||
return JSON.parse(subscribe?.discount) as API.SubscribeDiscount[];
|
||||
}
|
||||
return subscribe?.discount;
|
||||
} catch (error) {
|
||||
|
||||
@ -17,7 +17,7 @@ import { SubscribeDetail } from './detail';
|
||||
|
||||
export default function Page() {
|
||||
const t = useTranslations('subscribe');
|
||||
const [subscribe, setSubscribe] = useState<API.SubscribeDetails>();
|
||||
const [subscribe, setSubscribe] = useState<API.Subscribe>();
|
||||
|
||||
const [group, setGroup] = useState<string>('');
|
||||
|
||||
@ -81,7 +81,6 @@ export default function Page() {
|
||||
icon: string;
|
||||
label: string;
|
||||
type: 'default' | 'success' | 'destructive';
|
||||
support: boolean;
|
||||
},
|
||||
index: number,
|
||||
) => (
|
||||
|
||||
@ -51,7 +51,7 @@ export default function Page() {
|
||||
queryKey: ['getUserTicketDetails', ticketId],
|
||||
queryFn: async () => {
|
||||
const { data } = await getUserTicketDetails({ id: ticketId });
|
||||
return data.data as API.UserTicket;
|
||||
return data.data as API.Ticket;
|
||||
},
|
||||
enabled: !!ticketId,
|
||||
refetchInterval: 5000,
|
||||
@ -74,7 +74,7 @@ export default function Page() {
|
||||
|
||||
return (
|
||||
<>
|
||||
<ProList<API.UserTicket, { status: number }>
|
||||
<ProList<API.Ticket, { status: number }>
|
||||
action={ref}
|
||||
header={{
|
||||
title: t('ticketList'),
|
||||
|
||||
@ -5,15 +5,11 @@ import Base64 from 'crypto-js/enc-base64';
|
||||
import UTF8 from 'crypto-js/enc-utf8';
|
||||
import { create } from 'zustand';
|
||||
|
||||
interface ICommon extends API.GetGlobalConfigResponse {
|
||||
background: string;
|
||||
}
|
||||
|
||||
export interface GlobalStore {
|
||||
common: ICommon;
|
||||
user?: API.UserInfo;
|
||||
setCommon: (common: Partial<ICommon>) => void;
|
||||
setUser: (user?: API.UserInfo) => void;
|
||||
common: API.GetGlobalConfigResponse;
|
||||
user?: API.User;
|
||||
setCommon: (common: Partial<API.GetGlobalConfigResponse>) => void;
|
||||
setUser: (user?: API.User) => void;
|
||||
getUserInfo: () => Promise<void>;
|
||||
getUserSubscribe: (uuid: string, type?: 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_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,
|
||||
|
||||
@ -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
apps/user/services/common/typings.d.ts
vendored
351
apps/user/services/common/typings.d.ts
vendored
@ -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;
|
||||
};
|
||||
}
|
||||
|
||||
@ -8,7 +8,7 @@ export async function queryDocumentDetail(
|
||||
params: API.QueryDocumentDetailParams,
|
||||
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',
|
||||
params: {
|
||||
...params,
|
||||
|
||||
@ -35,7 +35,7 @@ export async function queryOrderDetail(
|
||||
params: API.QueryOrderDetailParams,
|
||||
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',
|
||||
params: {
|
||||
...params,
|
||||
|
||||
@ -4,7 +4,7 @@ import request from '@/utils/request';
|
||||
|
||||
/** Get application config GET /v1/public/subscribe/application/config */
|
||||
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',
|
||||
{
|
||||
method: 'GET',
|
||||
|
||||
@ -38,7 +38,7 @@ export async function getUserTicketDetails(
|
||||
params: API.GetUserTicketDetailsParams,
|
||||
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',
|
||||
params: {
|
||||
...params,
|
||||
|
||||
368
apps/user/services/user/typings.d.ts
vendored
368
apps/user/services/user/typings.d.ts
vendored
@ -1,13 +1,14 @@
|
||||
declare namespace API {
|
||||
type AnnouncementDetails = {
|
||||
type Announcement = {
|
||||
id: number;
|
||||
title: string;
|
||||
content: string;
|
||||
enable: boolean;
|
||||
created_at: number;
|
||||
updated_at: number;
|
||||
};
|
||||
|
||||
type ApplicationConfig = {
|
||||
type Application = {
|
||||
id: number;
|
||||
name: string;
|
||||
platform: string;
|
||||
@ -16,6 +17,14 @@ declare namespace API {
|
||||
url: string;
|
||||
};
|
||||
|
||||
type ApplicationResponse = {
|
||||
windows: Application[];
|
||||
mac: Application[];
|
||||
linux: Application[];
|
||||
android: Application[];
|
||||
ios: Application[];
|
||||
};
|
||||
|
||||
type CheckoutOrderRequest = {
|
||||
orderNo: string;
|
||||
};
|
||||
@ -30,6 +39,23 @@ declare namespace API {
|
||||
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 = {
|
||||
ticket_id: number;
|
||||
from: string;
|
||||
@ -42,24 +68,45 @@ declare namespace API {
|
||||
description: string;
|
||||
};
|
||||
|
||||
type DocumentDetail = {
|
||||
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 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;
|
||||
title: string;
|
||||
tags: string[];
|
||||
updated_at: number;
|
||||
ticket_id: number;
|
||||
from: string;
|
||||
type: number;
|
||||
content: string;
|
||||
created_at: number;
|
||||
};
|
||||
|
||||
type GetAvailablePaymentMethodsResponse = {
|
||||
list: PaymentItem[];
|
||||
list: PaymentConfig[];
|
||||
};
|
||||
|
||||
type GetUserTicketDetailRequest = {
|
||||
@ -86,12 +133,25 @@ declare namespace API {
|
||||
|
||||
type GetUserTicketListResponse = {
|
||||
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;
|
||||
orderNo: string;
|
||||
user_id: number;
|
||||
order_no: string;
|
||||
type: number;
|
||||
quantity: number;
|
||||
price: number;
|
||||
@ -104,19 +164,41 @@ declare namespace API {
|
||||
trade_no: string;
|
||||
status: number;
|
||||
subscribe_id: number;
|
||||
subscribe: SubscribeInfo;
|
||||
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;
|
||||
name: string;
|
||||
mark: string;
|
||||
icon: string;
|
||||
domain: string;
|
||||
icon?: string;
|
||||
domain?: string;
|
||||
config: Record<string, any>;
|
||||
fee_mode: number;
|
||||
fee_percent: number;
|
||||
fee_amount: number;
|
||||
fee_percent?: number;
|
||||
fee_amount?: number;
|
||||
enable: boolean;
|
||||
};
|
||||
|
||||
@ -144,6 +226,11 @@ declare namespace API {
|
||||
order_no: string;
|
||||
};
|
||||
|
||||
type Push = {
|
||||
push_at: number;
|
||||
count: number;
|
||||
};
|
||||
|
||||
type QueryAnnouncementParams = {
|
||||
page: number;
|
||||
size: number;
|
||||
@ -156,15 +243,7 @@ declare namespace API {
|
||||
|
||||
type QueryAnnouncementResponse = {
|
||||
total: number;
|
||||
announcements: AnnouncementDetails[];
|
||||
};
|
||||
|
||||
type QueryApplicationConfigResponse = {
|
||||
windows: ApplicationConfig[];
|
||||
mac: ApplicationConfig[];
|
||||
linux: ApplicationConfig[];
|
||||
android: ApplicationConfig[];
|
||||
ios: ApplicationConfig[];
|
||||
announcements: Announcement[];
|
||||
};
|
||||
|
||||
type QueryDocumentDetailParams = {
|
||||
@ -177,7 +256,7 @@ declare namespace API {
|
||||
|
||||
type QueryDocumentListResponse = {
|
||||
total: number;
|
||||
list: DocumentItem[];
|
||||
list: Document[];
|
||||
};
|
||||
|
||||
type QueryOrderDetailParams = {
|
||||
@ -200,16 +279,16 @@ declare namespace API {
|
||||
|
||||
type QueryOrderListResponse = {
|
||||
total: number;
|
||||
list: OrderDetails[];
|
||||
list: OrderDetail[];
|
||||
};
|
||||
|
||||
type QuerySubscribeGroupListResponse = {
|
||||
list: UserSubscribeGroupDetails[];
|
||||
list: SubscribeGroup[];
|
||||
total: number;
|
||||
};
|
||||
|
||||
type QuerySubscribeListResponse = {
|
||||
list: SubscribeDetails[];
|
||||
list: Subscribe[];
|
||||
total: number;
|
||||
};
|
||||
|
||||
@ -238,6 +317,17 @@ declare namespace API {
|
||||
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 = {
|
||||
subscribe_id: number;
|
||||
quantity: number;
|
||||
@ -269,66 +359,129 @@ declare namespace API {
|
||||
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 = {
|
||||
method: string;
|
||||
client_secret: string;
|
||||
publishable_key: string;
|
||||
};
|
||||
|
||||
type SubscribeDetails = {
|
||||
type Subscribe = {
|
||||
id: number;
|
||||
name: string;
|
||||
description: string;
|
||||
unit_price: number;
|
||||
discount: UserSubscribeDiscount[];
|
||||
discount: SubscribeDiscount[];
|
||||
replacement: number;
|
||||
inventory: number;
|
||||
traffic: number;
|
||||
group_id: 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 SubscribeDiscountInfo = {
|
||||
type SubscribeConfig = {
|
||||
single_model: boolean;
|
||||
subscribe_path: string;
|
||||
subscribe_domain: string;
|
||||
pan_domain: boolean;
|
||||
};
|
||||
|
||||
type SubscribeDiscount = {
|
||||
months: number;
|
||||
discount: number;
|
||||
};
|
||||
|
||||
type SubscribeInfo = {
|
||||
type SubscribeGroup = {
|
||||
id: number;
|
||||
name: string;
|
||||
description: string;
|
||||
discount: string;
|
||||
unit_price: number;
|
||||
replacement: number;
|
||||
inventory: number;
|
||||
traffic: number;
|
||||
group_id: number;
|
||||
speed_limit: number;
|
||||
device_limit: number;
|
||||
quota: number;
|
||||
show: boolean;
|
||||
sell: boolean;
|
||||
created_at: number;
|
||||
updated_at: number;
|
||||
};
|
||||
|
||||
type SubscribeItem = {
|
||||
type SubscribeType = {
|
||||
subscribe_types: string[];
|
||||
};
|
||||
|
||||
type TelegramConfig = {
|
||||
telegram_bot_token: string;
|
||||
telegram_group_url: string;
|
||||
telegram_notify: boolean;
|
||||
};
|
||||
|
||||
type Ticket = {
|
||||
id: number;
|
||||
name: string;
|
||||
title: string;
|
||||
description: string;
|
||||
discount: string;
|
||||
unit_price: number;
|
||||
replacement: number;
|
||||
inventory: number;
|
||||
traffic: number;
|
||||
group_id: number;
|
||||
speed_limit: number;
|
||||
device_limit: number;
|
||||
quota: number;
|
||||
show: boolean;
|
||||
sell: boolean;
|
||||
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 UpdateUserNotifyRequest = {
|
||||
@ -353,6 +506,29 @@ declare namespace API {
|
||||
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 = {
|
||||
email: string;
|
||||
avatar: string;
|
||||
@ -370,41 +546,12 @@ declare namespace API {
|
||||
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 = {
|
||||
id: number;
|
||||
user_id: number;
|
||||
order_id: number;
|
||||
subscribe_id: number;
|
||||
subscribe: SubscribeItem;
|
||||
subscribe: Subscribe;
|
||||
start_time: number;
|
||||
expire_time: number;
|
||||
traffic: number;
|
||||
@ -416,25 +563,36 @@ declare namespace API {
|
||||
updated_at: number;
|
||||
};
|
||||
|
||||
type UserSubscribeDiscount = {
|
||||
months: number;
|
||||
discount: number;
|
||||
type VerifyConfig = {
|
||||
turnstile_site_key: string;
|
||||
turnstile_secret: string;
|
||||
enable_login_verify: boolean;
|
||||
enable_register_verify: boolean;
|
||||
enable_reset_password_verify: boolean;
|
||||
};
|
||||
|
||||
type UserSubscribeGroupDetails = {
|
||||
id: number;
|
||||
name: string;
|
||||
description: string;
|
||||
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 UserTicket = {
|
||||
id: number;
|
||||
title: string;
|
||||
description: string;
|
||||
user_id: number;
|
||||
follow?: UserFollow[];
|
||||
status: number;
|
||||
created_at: number;
|
||||
updated_at: 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;
|
||||
};
|
||||
}
|
||||
|
||||
@ -26,7 +26,7 @@ export async function queryUserBalanceLog(options?: { [key: string]: any }) {
|
||||
|
||||
/** Query User Info GET /v1/public/user/info */
|
||||
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',
|
||||
...(options || {}),
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user