♻️ refactor(api): update endpoints to include '/api' prefix and add new types for IP location and withdrawal logs

- Updated all user and common service endpoints to include '/api' prefix for consistency.
- Added new API types for querying IP location and withdrawal logs.
- Introduced commission withdrawal functionality in user service.
- Enhanced user service typings to include rules and withdrawal log structures.
This commit is contained in:
web
2025-11-30 18:20:06 -08:00
parent 1837343845
commit 5f3354e948
35 changed files with 594 additions and 399 deletions
+25 -22
View File
@@ -6,7 +6,7 @@ export async function createServer(
body: API.CreateServerRequest,
options?: { [key: string]: any }
) {
return request<API.Response & { data?: any }>("/v1/admin/server/create", {
return request<API.Response & { data?: any }>("/api/v1/admin/server/create", {
method: "POST",
headers: {
"Content-Type": "application/json",
@@ -21,7 +21,7 @@ export async function deleteServer(
body: API.DeleteServerRequest,
options?: { [key: string]: any }
) {
return request<API.Response & { data?: any }>("/v1/admin/server/delete", {
return request<API.Response & { data?: any }>("/api/v1/admin/server/delete", {
method: "POST",
headers: {
"Content-Type": "application/json",
@@ -38,7 +38,7 @@ export async function filterServerList(
options?: { [key: string]: any }
) {
return request<API.Response & { data?: API.FilterServerListResponse }>(
"/v1/admin/server/list",
"/api/v1/admin/server/list",
{
method: "GET",
params: {
@@ -52,7 +52,7 @@ export async function filterServerList(
/** Check if there is any server or node to migrate GET /v1/admin/server/migrate/has */
export async function hasMigrateSeverNode(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.HasMigrateSeverNodeResponse }>(
"/v1/admin/server/migrate/has",
"/api/v1/admin/server/migrate/has",
{
method: "GET",
...(options || {}),
@@ -63,7 +63,7 @@ export async function hasMigrateSeverNode(options?: { [key: string]: any }) {
/** Migrate server and node data to new database POST /v1/admin/server/migrate/run */
export async function migrateServerNode(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.MigrateServerNodeResponse }>(
"/v1/admin/server/migrate/run",
"/api/v1/admin/server/migrate/run",
{
method: "POST",
...(options || {}),
@@ -77,7 +77,7 @@ export async function createNode(
options?: { [key: string]: any }
) {
return request<API.Response & { data?: any }>(
"/v1/admin/server/node/create",
"/api/v1/admin/server/node/create",
{
method: "POST",
headers: {
@@ -95,7 +95,7 @@ export async function deleteNode(
options?: { [key: string]: any }
) {
return request<API.Response & { data?: any }>(
"/v1/admin/server/node/delete",
"/api/v1/admin/server/node/delete",
{
method: "POST",
headers: {
@@ -114,7 +114,7 @@ export async function filterNodeList(
options?: { [key: string]: any }
) {
return request<API.Response & { data?: API.FilterNodeListResponse }>(
"/v1/admin/server/node/list",
"/api/v1/admin/server/node/list",
{
method: "GET",
params: {
@@ -130,14 +130,17 @@ export async function resetSortWithNode(
body: API.ResetSortRequest,
options?: { [key: string]: any }
) {
return request<API.Response & { data?: any }>("/v1/admin/server/node/sort", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
data: body,
...(options || {}),
});
return request<API.Response & { data?: any }>(
"/api/v1/admin/server/node/sort",
{
method: "POST",
headers: {
"Content-Type": "application/json",
},
data: body,
...(options || {}),
}
);
}
/** Toggle Node Status POST /v1/admin/server/node/status/toggle */
@@ -146,7 +149,7 @@ export async function toggleNodeStatus(
options?: { [key: string]: any }
) {
return request<API.Response & { data?: any }>(
"/v1/admin/server/node/status/toggle",
"/api/v1/admin/server/node/status/toggle",
{
method: "POST",
headers: {
@@ -161,7 +164,7 @@ export async function toggleNodeStatus(
/** Query all node tags GET /v1/admin/server/node/tags */
export async function queryNodeTag(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.QueryNodeTagResponse }>(
"/v1/admin/server/node/tags",
"/api/v1/admin/server/node/tags",
{
method: "GET",
...(options || {}),
@@ -175,7 +178,7 @@ export async function updateNode(
options?: { [key: string]: any }
) {
return request<API.Response & { data?: any }>(
"/v1/admin/server/node/update",
"/api/v1/admin/server/node/update",
{
method: "POST",
headers: {
@@ -194,7 +197,7 @@ export async function getServerProtocols(
options?: { [key: string]: any }
) {
return request<API.Response & { data?: API.GetServerProtocolsResponse }>(
"/v1/admin/server/protocols",
"/api/v1/admin/server/protocols",
{
method: "GET",
params: {
@@ -211,7 +214,7 @@ export async function resetSortWithServer(
options?: { [key: string]: any }
) {
return request<API.Response & { data?: any }>(
"/v1/admin/server/server/sort",
"/api/v1/admin/server/server/sort",
{
method: "POST",
headers: {
@@ -228,7 +231,7 @@ export async function updateServer(
body: API.UpdateServerRequest,
options?: { [key: string]: any }
) {
return request<API.Response & { data?: any }>("/v1/admin/server/update", {
return request<API.Response & { data?: any }>("/api/v1/admin/server/update", {
method: "POST",
headers: {
"Content-Type": "application/json",