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
+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;