feat: Update Auth Control

This commit is contained in:
web@ppanel
2025-01-13 21:07:27 +07:00
parent dd23279e3e
commit c59742a4f3
143 changed files with 4195 additions and 1512 deletions
+2
View File
@@ -9,6 +9,7 @@ import * as document from './document';
import * as order from './order';
import * as payment from './payment';
import * as server from './server';
import * as sms from './sms';
import * as subscribe from './subscribe';
import * as system from './system';
import * as ticket from './ticket';
@@ -22,6 +23,7 @@ export default {
order,
payment,
server,
sms,
subscribe,
system,
ticket,
+18
View File
@@ -0,0 +1,18 @@
// @ts-ignore
/* eslint-disable */
import request from '@/utils/request';
/** Get sms list GET /v1/admin/sms/list */
export async function getSmsList(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: API.GetSmsListParams,
options?: { [key: string]: any },
) {
return request<API.Response & { data?: API.GetSmsListResponse }>('/v1/admin/sms/list', {
method: 'GET',
params: {
...params,
},
...(options || {}),
});
}
+43
View File
@@ -221,6 +221,37 @@ export async function updateSiteConfig(body: API.SiteConfig, options?: { [key: s
});
}
/** Get sms config GET /v1/admin/system/sms_config */
export async function getSmsConfig(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.SmsConfig }>('/v1/admin/system/sms_config', {
method: 'GET',
...(options || {}),
});
}
/** Get sms config PUT /v1/admin/system/sms_config */
export async function updateSmsConfig(body: API.SmsConfig, options?: { [key: string]: any }) {
return request<API.Response & { data?: any }>('/v1/admin/system/sms_config', {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
},
data: body,
...(options || {}),
});
}
/** Get sms config GET /v1/admin/system/sms_platform */
export async function getSmsPlatform(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.SmsPlatformResponse }>(
'/v1/admin/system/sms_platform',
{
method: 'GET',
...(options || {}),
},
);
}
/** Get subscribe config GET /v1/admin/system/subscribe_config */
export async function getSubscribeConfig(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.SubscribeConfig }>(
@@ -293,6 +324,18 @@ export async function testEmailSmtp(
});
}
/** Test sms send POST /v1/admin/system/test_sms */
export async function testSmsSend(body: API.SendSmsRequest, options?: { [key: string]: any }) {
return request<API.Response & { data?: any }>('/v1/admin/system/test_sms', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
data: body,
...(options || {}),
});
}
/** 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.TosConfig }>('/v1/admin/system/tos_config', {
+87 -1
View File
@@ -121,6 +121,7 @@ declare namespace API {
type CreateNodeRequest = {
name: string;
tags: string[];
server_addr: string;
relay_mode: string;
relay_node: NodeRelay[];
@@ -373,6 +374,7 @@ declare namespace API {
type GetNodeListParams = {
page: number;
size: number;
tag?: string;
group_id?: number;
search?: string;
};
@@ -384,6 +386,7 @@ declare namespace API {
type GetNodeServerListRequest = {
page: number;
size: number;
tag?: string;
group_id?: number;
search?: string;
};
@@ -416,6 +419,23 @@ declare namespace API {
list: Order[];
};
type GetSmsListParams = {
page: number;
size: number;
telephone?: string;
};
type GetSmsListRequest = {
page: number;
size: number;
telephone?: string;
};
type GetSmsListResponse = {
total: number;
list: Sms[];
};
type GetSubscribeDetailsParams = {
id: number;
};
@@ -444,7 +464,7 @@ declare namespace API {
};
type GetSubscribeListResponse = {
list: Subscribe[];
list: SubscribeItem[];
total: number;
};
@@ -646,8 +666,15 @@ declare namespace API {
reality_short_id: string;
};
type SendSmsRequest = {
content: string;
area_code: string;
telephone: string;
};
type Server = {
id: number;
tags: string[];
name: string;
server_addr: string;
relay_mode: string;
@@ -718,6 +745,36 @@ declare namespace API {
site_logo: string;
};
type Sms = {
id: string;
content: string;
platform: string;
areaCode: string;
telephone: string;
status: number;
created_at: number;
};
type SmsConfig = {
sms_enabled: boolean;
sms_api_url: string;
sms_api_foreign_url: string;
sms_key: string;
sms_secret: string;
sms_region: string;
sms_template: string;
sms_template_code: string;
sms_template_param: string;
sms_platform: string;
sms_limit: number;
sms_interval: number;
sms_expire_time: number;
};
type SmsPlatformResponse = {
list: string[];
};
type SortItem = {
id: number;
sort: number;
@@ -777,6 +834,34 @@ declare namespace API {
updated_at: number;
};
type SubscribeItem = {
id?: number;
name?: string;
description?: string;
unit_price?: number;
unit_time?: string;
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;
sort?: number;
deduction_ratio?: number;
allow_deduction?: boolean;
reset_cycle?: number;
renewal_reset?: boolean;
created_at?: number;
updated_at?: number;
sold: number;
};
type SubscribeSortRequest = {
sort: SortItem[];
};
@@ -919,6 +1004,7 @@ declare namespace API {
type UpdateNodeRequest = {
id: number;
tags: string[];
name: string;
server_addr: string;
relay_mode: string;
+78
View File
@@ -17,6 +17,24 @@ export async function checkUser(
});
}
/** Check user telephone is exist GET /v1/auth/check/telephone */
export async function checkUserTelephone(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: API.CheckUserTelephoneParams,
options?: { [key: string]: any },
) {
return request<API.Response & { data?: API.TelephoneCheckUserResponse }>(
'/v1/auth/check/telephone',
{
method: 'GET',
params: {
...params,
},
...(options || {}),
},
);
}
/** User login POST /v1/auth/login */
export async function userLogin(body: API.UserLoginRequest, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.LoginResponse }>('/v1/auth/login', {
@@ -29,6 +47,36 @@ export async function userLogin(body: API.UserLoginRequest, options?: { [key: st
});
}
/** User Telephone login POST /v1/auth/login/telephone */
export async function telephoneLogin(
body: API.TelephoneLoginRequest,
options?: { [key: string]: any },
) {
return request<API.Response & { data?: API.LoginResponse }>('/v1/auth/login/telephone', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
data: body,
...(options || {}),
});
}
/** User Telephone login POST /v1/auth/login/telephone/code */
export async function telephoneCodeLogin(
body: API.TelephoneCodeLoginRequest,
options?: { [key: string]: any },
) {
return request<API.Response & { data?: API.LoginResponse }>('/v1/auth/login/telephone/code', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
data: body,
...(options || {}),
});
}
/** User register POST /v1/auth/register */
export async function userRegister(
body: API.UserRegisterRequest,
@@ -44,6 +92,21 @@ export async function userRegister(
});
}
/** User Telephone register POST /v1/auth/register/telephone */
export async function telephoneUserRegister(
body: API.TelephoneRegisterRequest,
options?: { [key: string]: any },
) {
return request<API.Response & { data?: API.LoginResponse }>('/v1/auth/register/telephone', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
data: body,
...(options || {}),
});
}
/** Reset password POST /v1/auth/reset */
export async function resetPassword(
body: API.ResetPasswordRequest,
@@ -58,3 +121,18 @@ export async function resetPassword(
...(options || {}),
});
}
/** Reset password POST /v1/auth/reset/telephone */
export async function telephoneResetPassword(
body: API.TelephoneResetPasswordRequest,
options?: { [key: string]: any },
) {
return request<API.Response & { data?: API.LoginResponse }>('/v1/auth/reset/telephone', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
data: body,
...(options || {}),
});
}
+12
View File
@@ -14,6 +14,18 @@ export async function sendEmailCode(body: API.SendCodeRequest, options?: { [key:
});
}
/** Get sms verification code POST /v1/common/send_sms_code */
export async function sendSmsCode(body: API.SendSmsCodeRequest, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.SendCodeResponse }>('/v1/common/send_sms_code', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
data: body,
...(options || {}),
});
}
/** Get global config GET /v1/common/site/config */
export async function getGlobalConfig(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.GetGlobalConfigResponse }>('/v1/common/site/config', {
+64
View File
@@ -39,6 +39,10 @@ declare namespace API {
exist: boolean;
};
type CheckUserTelephoneParams = {
telephone: string;
};
type Coupon = {
id: number;
name: string;
@@ -262,8 +266,14 @@ declare namespace API {
status: boolean;
};
type SendSmsCodeRequest = {
telephone: string;
telephone_area_code: string;
};
type Server = {
id: number;
tags: string[];
name: string;
server_addr: string;
relay_mode: string;
@@ -308,6 +318,22 @@ declare namespace API {
site_logo: string;
};
type SmsConfig = {
sms_enabled: boolean;
sms_api_url: string;
sms_api_foreign_url: string;
sms_key: string;
sms_secret: string;
sms_region: string;
sms_template: string;
sms_template_code: string;
sms_template_param: string;
sms_platform: string;
sms_limit: number;
sms_interval: number;
sms_expire_time: number;
};
type SortItem = {
id: number;
sort: number;
@@ -371,6 +397,44 @@ declare namespace API {
telegram_web_hook_domain: string;
};
type TelephoneCheckUserRequest = {
telephone_area_code: string;
};
type TelephoneCheckUserResponse = {
exist: boolean;
};
type TelephoneCodeLoginRequest = {
telephone: string;
telephone_area_code: string;
telephone_code: string;
cf_token?: string;
};
type TelephoneLoginRequest = {
telephone: string;
telephone_area_code: string;
password: string;
cf_token?: string;
};
type TelephoneRegisterRequest = {
telephone: string;
telephone_area_code: string;
password: string;
invite?: string;
code?: string;
cf_token?: string;
};
type TelephoneResetPasswordRequest = {
telephone: string;
password: string;
code?: string;
cf_token?: string;
};
type Ticket = {
id: number;
title: string;