diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2dab160..bb6a36c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,7 +2,7 @@ name: Build and Release on: push: - branches: [main, next, beta] + branches: [main, next, beta, develop] permissions: contents: write @@ -25,7 +25,7 @@ jobs: path: | ~/.bun node_modules - key: ${{ runner.os }}-bun-cache-${{ hashFiles('**/bun.lockb') }} + key: ${{ runner.os }}-bun-cache-${{ hashFiles('**/bun.lock') }} restore-keys: | ${{ runner.os }}-bun-cache- diff --git a/apps/admin/vite.config.ts b/apps/admin/vite.config.ts index 92cbf6f..3b23306 100644 --- a/apps/admin/vite.config.ts +++ b/apps/admin/vite.config.ts @@ -43,11 +43,10 @@ export default defineConfig({ }, server: { proxy: { - "/v1": { + "/api": { target: "https://api.ppanel.dev", changeOrigin: true, secure: false, - rewrite: (path) => path.replace(/^\/v1/, "/v1"), }, }, }, diff --git a/apps/user/vite.config.ts b/apps/user/vite.config.ts index 93ab006..a1f8f95 100644 --- a/apps/user/vite.config.ts +++ b/apps/user/vite.config.ts @@ -43,11 +43,10 @@ export default defineConfig({ }, server: { proxy: { - "/v1": { + "/api": { target: "https://api.ppanel.dev", changeOrigin: true, secure: false, - rewrite: (path) => path.replace(/^\/v1/, "/v1"), }, }, }, diff --git a/packages/ui/openapi2ts.config.ts b/packages/ui/openapi2ts.config.ts index 577e2dc..a99c3d4 100644 --- a/packages/ui/openapi2ts.config.ts +++ b/packages/ui/openapi2ts.config.ts @@ -1,23 +1,26 @@ +const baseConfig = { + requestLibPath: "import request from '@workspace/ui/lib/request';", + serversPath: "./src/services", + apiPrefix: "'/api'", +}; + const config = [ { - requestLibPath: "import request from '@workspace/ui/lib/request';", + ...baseConfig, schemaPath: "https://raw.githubusercontent.com/perfect-panel/ppanel-docs/refs/heads/main/public/swagger/common.json", - serversPath: "./src/services", projectName: "common", }, { - requestLibPath: "import request from '@workspace/ui/lib/request';", + ...baseConfig, schemaPath: "https://raw.githubusercontent.com/perfect-panel/ppanel-docs/refs/heads/main/public/swagger/user.json", - serversPath: "./src/services", projectName: "user", }, { - requestLibPath: "import request from '@workspace/ui/lib/request';", + ...baseConfig, schemaPath: "https://raw.githubusercontent.com/perfect-panel/ppanel-docs/refs/heads/main/public/swagger/admin.json", - serversPath: "./src/services", projectName: "admin", }, ]; diff --git a/packages/ui/src/services/admin/ads.ts b/packages/ui/src/services/admin/ads.ts index c85ba78..2af4938 100644 --- a/packages/ui/src/services/admin/ads.ts +++ b/packages/ui/src/services/admin/ads.ts @@ -6,7 +6,7 @@ export async function updateAds( body: API.UpdateAdsRequest, options?: { [key: string]: any } ) { - return request("/v1/admin/ads/", { + return request("/api/v1/admin/ads/", { method: "PUT", headers: { "Content-Type": "application/json", @@ -21,7 +21,7 @@ export async function createAds( body: API.CreateAdsRequest, options?: { [key: string]: any } ) { - return request("/v1/admin/ads/", { + return request("/api/v1/admin/ads/", { method: "POST", headers: { "Content-Type": "application/json", @@ -36,7 +36,7 @@ export async function deleteAds( body: API.DeleteAdsRequest, options?: { [key: string]: any } ) { - return request("/v1/admin/ads/", { + return request("/api/v1/admin/ads/", { method: "DELETE", headers: { "Content-Type": "application/json", @@ -52,23 +52,26 @@ export async function getAdsDetail( params: API.GetAdsDetailParams, options?: { [key: string]: any } ) { - return request("/v1/admin/ads/detail", { - method: "GET", - params: { - ...params, - }, - ...(options || {}), - }); -} - -/** Get Ads List GET /v1/admin/ads/list */ -export async function getAdsList( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.GetAdsListParams, - options?: { [key: string]: any } -) { - return request( - "/v1/admin/ads/list", + return request( + "/api/v1/admin/ads/detail", + { + method: "GET", + params: { + ...params, + }, + ...(options || {}), + } + ); +} + +/** Get Ads List GET /v1/admin/ads/list */ +export async function getAdsList( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.GetAdsListParams, + options?: { [key: string]: any } +) { + return request( + "/api/v1/admin/ads/list", { method: "GET", params: { diff --git a/packages/ui/src/services/admin/announcement.ts b/packages/ui/src/services/admin/announcement.ts index 2bd3151..7e003a2 100644 --- a/packages/ui/src/services/admin/announcement.ts +++ b/packages/ui/src/services/admin/announcement.ts @@ -6,7 +6,7 @@ export async function updateAnnouncement( body: API.UpdateAnnouncementRequest, options?: { [key: string]: any } ) { - return request("/v1/admin/announcement/", { + return request("/api/v1/admin/announcement/", { method: "PUT", headers: { "Content-Type": "application/json", @@ -21,7 +21,7 @@ export async function createAnnouncement( body: API.CreateAnnouncementRequest, options?: { [key: string]: any } ) { - return request("/v1/admin/announcement/", { + return request("/api/v1/admin/announcement/", { method: "POST", headers: { "Content-Type": "application/json", @@ -36,7 +36,7 @@ export async function deleteAnnouncement( body: API.DeleteAnnouncementRequest, options?: { [key: string]: any } ) { - return request("/v1/admin/announcement/", { + return request("/api/v1/admin/announcement/", { method: "DELETE", headers: { "Content-Type": "application/json", @@ -53,7 +53,7 @@ export async function getAnnouncement( options?: { [key: string]: any } ) { return request( - "/v1/admin/announcement/detail", + "/api/v1/admin/announcement/detail", { method: "GET", params: { @@ -71,7 +71,7 @@ export async function getAnnouncementList( options?: { [key: string]: any } ) { return request( - "/v1/admin/announcement/list", + "/api/v1/admin/announcement/list", { method: "GET", params: { diff --git a/packages/ui/src/services/admin/application.ts b/packages/ui/src/services/admin/application.ts index 40b2007..146859b 100644 --- a/packages/ui/src/services/admin/application.ts +++ b/packages/ui/src/services/admin/application.ts @@ -7,7 +7,7 @@ export async function createSubscribeApplication( options?: { [key: string]: any } ) { return request( - "/v1/admin/application/", + "/api/v1/admin/application/", { method: "POST", headers: { @@ -27,7 +27,7 @@ export async function previewSubscribeTemplate( ) { return request< API.Response & { data?: API.PreviewSubscribeTemplateResponse } - >("/v1/admin/application/preview", { + >("/api/v1/admin/application/preview", { method: "GET", params: { ...params, @@ -42,7 +42,7 @@ export async function updateSubscribeApplication( options?: { [key: string]: any } ) { return request( - "/v1/admin/application/subscribe_application", + "/api/v1/admin/application/subscribe_application", { method: "PUT", headers: { @@ -60,7 +60,7 @@ export async function deleteSubscribeApplication( options?: { [key: string]: any } ) { return request( - "/v1/admin/application/subscribe_application", + "/api/v1/admin/application/subscribe_application", { method: "DELETE", headers: { @@ -80,7 +80,7 @@ export async function getSubscribeApplicationList( ) { return request< API.Response & { data?: API.GetSubscribeApplicationListResponse } - >("/v1/admin/application/subscribe_application_list", { + >("/api/v1/admin/application/subscribe_application_list", { method: "GET", params: { ...params, diff --git a/packages/ui/src/services/admin/authMethod.ts b/packages/ui/src/services/admin/authMethod.ts index cb8b097..4231b81 100644 --- a/packages/ui/src/services/admin/authMethod.ts +++ b/packages/ui/src/services/admin/authMethod.ts @@ -8,7 +8,7 @@ export async function getAuthMethodConfig( options?: { [key: string]: any } ) { return request( - "/v1/admin/auth-method/config", + "/api/v1/admin/auth-method/config", { method: "GET", params: { @@ -25,7 +25,7 @@ export async function updateAuthMethodConfig( options?: { [key: string]: any } ) { return request( - "/v1/admin/auth-method/config", + "/api/v1/admin/auth-method/config", { method: "PUT", headers: { @@ -40,7 +40,7 @@ export async function updateAuthMethodConfig( /** Get email support platform GET /v1/admin/auth-method/email_platform */ export async function getEmailPlatform(options?: { [key: string]: any }) { return request( - "/v1/admin/auth-method/email_platform", + "/api/v1/admin/auth-method/email_platform", { method: "GET", ...(options || {}), @@ -51,7 +51,7 @@ export async function getEmailPlatform(options?: { [key: string]: any }) { /** Get auth method list GET /v1/admin/auth-method/list */ export async function getAuthMethodList(options?: { [key: string]: any }) { return request( - "/v1/admin/auth-method/list", + "/api/v1/admin/auth-method/list", { method: "GET", ...(options || {}), @@ -62,7 +62,7 @@ export async function getAuthMethodList(options?: { [key: string]: any }) { /** Get sms support platform GET /v1/admin/auth-method/sms_platform */ export async function getSmsPlatform(options?: { [key: string]: any }) { return request( - "/v1/admin/auth-method/sms_platform", + "/api/v1/admin/auth-method/sms_platform", { method: "GET", ...(options || {}), @@ -76,7 +76,7 @@ export async function testEmailSend( options?: { [key: string]: any } ) { return request( - "/v1/admin/auth-method/test_email_send", + "/api/v1/admin/auth-method/test_email_send", { method: "POST", headers: { @@ -94,7 +94,7 @@ export async function testSmsSend( options?: { [key: string]: any } ) { return request( - "/v1/admin/auth-method/test_sms_send", + "/api/v1/admin/auth-method/test_sms_send", { method: "POST", headers: { diff --git a/packages/ui/src/services/admin/console.ts b/packages/ui/src/services/admin/console.ts index 11e5d02..2b33453 100644 --- a/packages/ui/src/services/admin/console.ts +++ b/packages/ui/src/services/admin/console.ts @@ -4,7 +4,7 @@ import request from "@workspace/ui/lib/request"; /** Query revenue statistics GET /v1/admin/console/revenue */ export async function queryRevenueStatistics(options?: { [key: string]: any }) { return request( - "/v1/admin/console/revenue", + "/api/v1/admin/console/revenue", { method: "GET", ...(options || {}), @@ -15,7 +15,7 @@ export async function queryRevenueStatistics(options?: { [key: string]: any }) { /** Query server total data GET /v1/admin/console/server */ export async function queryServerTotalData(options?: { [key: string]: any }) { return request( - "/v1/admin/console/server", + "/api/v1/admin/console/server", { method: "GET", ...(options || {}), @@ -26,7 +26,7 @@ export async function queryServerTotalData(options?: { [key: string]: any }) { /** Query ticket wait reply GET /v1/admin/console/ticket */ export async function queryTicketWaitReply(options?: { [key: string]: any }) { return request( - "/v1/admin/console/ticket", + "/api/v1/admin/console/ticket", { method: "GET", ...(options || {}), @@ -37,7 +37,7 @@ export async function queryTicketWaitReply(options?: { [key: string]: any }) { /** Query user statistics GET /v1/admin/console/user */ export async function queryUserStatistics(options?: { [key: string]: any }) { return request( - "/v1/admin/console/user", + "/api/v1/admin/console/user", { method: "GET", ...(options || {}), diff --git a/packages/ui/src/services/admin/coupon.ts b/packages/ui/src/services/admin/coupon.ts index f884b69..7933cf4 100644 --- a/packages/ui/src/services/admin/coupon.ts +++ b/packages/ui/src/services/admin/coupon.ts @@ -6,7 +6,7 @@ export async function updateCoupon( body: API.UpdateCouponRequest, options?: { [key: string]: any } ) { - return request("/v1/admin/coupon/", { + return request("/api/v1/admin/coupon/", { method: "PUT", headers: { "Content-Type": "application/json", @@ -21,7 +21,7 @@ export async function createCoupon( body: API.CreateCouponRequest, options?: { [key: string]: any } ) { - return request("/v1/admin/coupon/", { + return request("/api/v1/admin/coupon/", { method: "POST", headers: { "Content-Type": "application/json", @@ -36,7 +36,7 @@ export async function deleteCoupon( body: API.DeleteCouponRequest, options?: { [key: string]: any } ) { - return request("/v1/admin/coupon/", { + return request("/api/v1/admin/coupon/", { method: "DELETE", headers: { "Content-Type": "application/json", @@ -51,7 +51,7 @@ export async function batchDeleteCoupon( body: API.BatchDeleteCouponRequest, options?: { [key: string]: any } ) { - return request("/v1/admin/coupon/batch", { + return request("/api/v1/admin/coupon/batch", { method: "DELETE", headers: { "Content-Type": "application/json", @@ -68,7 +68,7 @@ export async function getCouponList( options?: { [key: string]: any } ) { return request( - "/v1/admin/coupon/list", + "/api/v1/admin/coupon/list", { method: "GET", params: { diff --git a/packages/ui/src/services/admin/document.ts b/packages/ui/src/services/admin/document.ts index 31dd181..8582728 100644 --- a/packages/ui/src/services/admin/document.ts +++ b/packages/ui/src/services/admin/document.ts @@ -6,7 +6,7 @@ export async function updateDocument( body: API.UpdateDocumentRequest, options?: { [key: string]: any } ) { - return request("/v1/admin/document/", { + return request("/api/v1/admin/document/", { method: "PUT", headers: { "Content-Type": "application/json", @@ -21,7 +21,7 @@ export async function createDocument( body: API.CreateDocumentRequest, options?: { [key: string]: any } ) { - return request("/v1/admin/document/", { + return request("/api/v1/admin/document/", { method: "POST", headers: { "Content-Type": "application/json", @@ -36,7 +36,7 @@ export async function deleteDocument( body: API.DeleteDocumentRequest, options?: { [key: string]: any } ) { - return request("/v1/admin/document/", { + return request("/api/v1/admin/document/", { method: "DELETE", headers: { "Content-Type": "application/json", @@ -51,20 +51,23 @@ export async function batchDeleteDocument( body: API.BatchDeleteDocumentRequest, options?: { [key: string]: any } ) { - return request("/v1/admin/document/batch", { - method: "DELETE", - headers: { - "Content-Type": "application/json", - }, - data: body, - ...(options || {}), - }); + return request( + "/api/v1/admin/document/batch", + { + method: "DELETE", + headers: { + "Content-Type": "application/json", + }, + data: body, + ...(options || {}), + } + ); } /** Get document detail GET /v1/admin/document/detail */ export async function getDocumentDetail(options?: { [key: string]: any }) { return request( - "/v1/admin/document/detail", + "/api/v1/admin/document/detail", { method: "GET", ...(options || {}), @@ -79,7 +82,7 @@ export async function getDocumentList( options?: { [key: string]: any } ) { return request( - "/v1/admin/document/list", + "/api/v1/admin/document/list", { method: "GET", params: { diff --git a/packages/ui/src/services/admin/log.ts b/packages/ui/src/services/admin/log.ts index d77df2b..90793ac 100644 --- a/packages/ui/src/services/admin/log.ts +++ b/packages/ui/src/services/admin/log.ts @@ -8,7 +8,7 @@ export async function filterBalanceLog( options?: { [key: string]: any } ) { return request( - "/v1/admin/log/balance/list", + "/api/v1/admin/log/balance/list", { method: "GET", params: { @@ -26,7 +26,7 @@ export async function filterCommissionLog( options?: { [key: string]: any } ) { return request( - "/v1/admin/log/commission/list", + "/api/v1/admin/log/commission/list", { method: "GET", params: { @@ -44,7 +44,7 @@ export async function filterEmailLog( options?: { [key: string]: any } ) { return request( - "/v1/admin/log/email/list", + "/api/v1/admin/log/email/list", { method: "GET", params: { @@ -62,7 +62,7 @@ export async function filterGiftLog( options?: { [key: string]: any } ) { return request( - "/v1/admin/log/gift/list", + "/api/v1/admin/log/gift/list", { method: "GET", params: { @@ -80,7 +80,7 @@ export async function filterLoginLog( options?: { [key: string]: any } ) { return request( - "/v1/admin/log/login/list", + "/api/v1/admin/log/login/list", { method: "GET", params: { @@ -98,7 +98,7 @@ export async function getMessageLogList( options?: { [key: string]: any } ) { return request( - "/v1/admin/log/message/list", + "/api/v1/admin/log/message/list", { method: "GET", params: { @@ -116,7 +116,7 @@ export async function filterMobileLog( options?: { [key: string]: any } ) { return request( - "/v1/admin/log/mobile/list", + "/api/v1/admin/log/mobile/list", { method: "GET", params: { @@ -134,7 +134,7 @@ export async function filterRegisterLog( options?: { [key: string]: any } ) { return request( - "/v1/admin/log/register/list", + "/api/v1/admin/log/register/list", { method: "GET", params: { @@ -152,7 +152,7 @@ export async function filterServerTrafficLog( options?: { [key: string]: any } ) { return request( - "/v1/admin/log/server/traffic/list", + "/api/v1/admin/log/server/traffic/list", { method: "GET", params: { @@ -166,7 +166,7 @@ export async function filterServerTrafficLog( /** Get log setting GET /v1/admin/log/setting */ export async function getLogSetting(options?: { [key: string]: any }) { return request( - "/v1/admin/log/setting", + "/api/v1/admin/log/setting", { method: "GET", ...(options || {}), @@ -179,7 +179,7 @@ export async function updateLogSetting( body: API.LogSetting, options?: { [key: string]: any } ) { - return request("/v1/admin/log/setting", { + return request("/api/v1/admin/log/setting", { method: "POST", headers: { "Content-Type": "application/json", @@ -196,7 +196,7 @@ export async function filterSubscribeLog( options?: { [key: string]: any } ) { return request( - "/v1/admin/log/subscribe/list", + "/api/v1/admin/log/subscribe/list", { method: "GET", params: { @@ -214,7 +214,7 @@ export async function filterResetSubscribeLog( options?: { [key: string]: any } ) { return request( - "/v1/admin/log/subscribe/reset/list", + "/api/v1/admin/log/subscribe/reset/list", { method: "GET", params: { @@ -232,7 +232,7 @@ export async function filterUserSubscribeTrafficLog( options?: { [key: string]: any } ) { return request( - "/v1/admin/log/subscribe/traffic/list", + "/api/v1/admin/log/subscribe/traffic/list", { method: "GET", params: { @@ -250,7 +250,7 @@ export async function filterTrafficLogDetails( options?: { [key: string]: any } ) { return request( - "/v1/admin/log/traffic/details", + "/api/v1/admin/log/traffic/details", { method: "GET", params: { diff --git a/packages/ui/src/services/admin/marketing.ts b/packages/ui/src/services/admin/marketing.ts index d0920ea..1f4bcd4 100644 --- a/packages/ui/src/services/admin/marketing.ts +++ b/packages/ui/src/services/admin/marketing.ts @@ -9,7 +9,7 @@ export async function getBatchSendEmailTaskList( ) { return request< API.Response & { data?: API.GetBatchSendEmailTaskListResponse } - >("/v1/admin/marketing/email/batch/list", { + >("/api/v1/admin/marketing/email/batch/list", { method: "GET", params: { ...params, @@ -24,7 +24,7 @@ export async function getPreSendEmailCount( options?: { [key: string]: any } ) { return request( - "/v1/admin/marketing/email/batch/pre-send-count", + "/api/v1/admin/marketing/email/batch/pre-send-count", { method: "POST", headers: { @@ -42,7 +42,7 @@ export async function createBatchSendEmailTask( options?: { [key: string]: any } ) { return request( - "/v1/admin/marketing/email/batch/send", + "/api/v1/admin/marketing/email/batch/send", { method: "POST", headers: { @@ -61,7 +61,7 @@ export async function getBatchSendEmailTaskStatus( ) { return request< API.Response & { data?: API.GetBatchSendEmailTaskStatusResponse } - >("/v1/admin/marketing/email/batch/status", { + >("/api/v1/admin/marketing/email/batch/status", { method: "POST", headers: { "Content-Type": "application/json", @@ -77,7 +77,7 @@ export async function stopBatchSendEmailTask( options?: { [key: string]: any } ) { return request( - "/v1/admin/marketing/email/batch/stop", + "/api/v1/admin/marketing/email/batch/stop", { method: "POST", headers: { @@ -95,7 +95,7 @@ export async function createQuotaTask( options?: { [key: string]: any } ) { return request( - "/v1/admin/marketing/quota/create", + "/api/v1/admin/marketing/quota/create", { method: "POST", headers: { @@ -114,7 +114,7 @@ export async function queryQuotaTaskList( options?: { [key: string]: any } ) { return request( - "/v1/admin/marketing/quota/list", + "/api/v1/admin/marketing/quota/list", { method: "GET", params: { @@ -131,7 +131,7 @@ export async function queryQuotaTaskPreCount( options?: { [key: string]: any } ) { return request( - "/v1/admin/marketing/quota/pre-count", + "/api/v1/admin/marketing/quota/pre-count", { method: "POST", headers: { diff --git a/packages/ui/src/services/admin/order.ts b/packages/ui/src/services/admin/order.ts index f35516d..d63b309 100644 --- a/packages/ui/src/services/admin/order.ts +++ b/packages/ui/src/services/admin/order.ts @@ -6,7 +6,7 @@ export async function createOrder( body: API.CreateOrderRequest, options?: { [key: string]: any } ) { - return request("/v1/admin/order/", { + return request("/api/v1/admin/order/", { method: "POST", headers: { "Content-Type": "application/json", @@ -23,7 +23,7 @@ export async function getOrderList( options?: { [key: string]: any } ) { return request( - "/v1/admin/order/list", + "/api/v1/admin/order/list", { method: "GET", params: { @@ -39,7 +39,7 @@ export async function updateOrderStatus( body: API.UpdateOrderStatusRequest, options?: { [key: string]: any } ) { - return request("/v1/admin/order/status", { + return request("/api/v1/admin/order/status", { method: "PUT", headers: { "Content-Type": "application/json", diff --git a/packages/ui/src/services/admin/payment.ts b/packages/ui/src/services/admin/payment.ts index b9a054e..c4ef4d3 100644 --- a/packages/ui/src/services/admin/payment.ts +++ b/packages/ui/src/services/admin/payment.ts @@ -7,7 +7,7 @@ export async function updatePaymentMethod( options?: { [key: string]: any } ) { return request( - "/v1/admin/payment/", + "/api/v1/admin/payment/", { method: "PUT", headers: { @@ -25,7 +25,7 @@ export async function createPaymentMethod( options?: { [key: string]: any } ) { return request( - "/v1/admin/payment/", + "/api/v1/admin/payment/", { method: "POST", headers: { @@ -42,7 +42,7 @@ export async function deletePaymentMethod( body: API.DeletePaymentMethodRequest, options?: { [key: string]: any } ) { - return request("/v1/admin/payment/", { + return request("/api/v1/admin/payment/", { method: "DELETE", headers: { "Content-Type": "application/json", @@ -59,7 +59,7 @@ export async function getPaymentMethodList( options?: { [key: string]: any } ) { return request( - "/v1/admin/payment/list", + "/api/v1/admin/payment/list", { method: "GET", params: { @@ -73,7 +73,7 @@ export async function getPaymentMethodList( /** Get supported payment platform GET /v1/admin/payment/platform */ export async function getPaymentPlatform(options?: { [key: string]: any }) { return request( - "/v1/admin/payment/platform", + "/api/v1/admin/payment/platform", { method: "GET", ...(options || {}), diff --git a/packages/ui/src/services/admin/server.ts b/packages/ui/src/services/admin/server.ts index f47ba13..65749ec 100644 --- a/packages/ui/src/services/admin/server.ts +++ b/packages/ui/src/services/admin/server.ts @@ -6,7 +6,7 @@ export async function createServer( body: API.CreateServerRequest, options?: { [key: string]: any } ) { - return request("/v1/admin/server/create", { + return request("/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("/v1/admin/server/delete", { + return request("/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( - "/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( - "/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( - "/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( - "/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( - "/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( - "/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("/v1/admin/server/node/sort", { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - data: body, - ...(options || {}), - }); + return request( + "/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( - "/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( - "/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( - "/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( - "/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( - "/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("/v1/admin/server/update", { + return request("/api/v1/admin/server/update", { method: "POST", headers: { "Content-Type": "application/json", diff --git a/packages/ui/src/services/admin/subscribe.ts b/packages/ui/src/services/admin/subscribe.ts index 592576a..b7bd95f 100644 --- a/packages/ui/src/services/admin/subscribe.ts +++ b/packages/ui/src/services/admin/subscribe.ts @@ -6,7 +6,7 @@ export async function updateSubscribe( body: API.UpdateSubscribeRequest, options?: { [key: string]: any } ) { - return request("/v1/admin/subscribe/", { + return request("/api/v1/admin/subscribe/", { method: "PUT", headers: { "Content-Type": "application/json", @@ -21,7 +21,7 @@ export async function createSubscribe( body: API.CreateSubscribeRequest, options?: { [key: string]: any } ) { - return request("/v1/admin/subscribe/", { + return request("/api/v1/admin/subscribe/", { method: "POST", headers: { "Content-Type": "application/json", @@ -36,7 +36,7 @@ export async function deleteSubscribe( body: API.DeleteSubscribeRequest, options?: { [key: string]: any } ) { - return request("/v1/admin/subscribe/", { + return request("/api/v1/admin/subscribe/", { method: "DELETE", headers: { "Content-Type": "application/json", @@ -51,14 +51,17 @@ export async function batchDeleteSubscribe( body: API.BatchDeleteSubscribeRequest, options?: { [key: string]: any } ) { - return request("/v1/admin/subscribe/batch", { - method: "DELETE", - headers: { - "Content-Type": "application/json", - }, - data: body, - ...(options || {}), - }); + return request( + "/api/v1/admin/subscribe/batch", + { + method: "DELETE", + headers: { + "Content-Type": "application/json", + }, + data: body, + ...(options || {}), + } + ); } /** Get subscribe details GET /v1/admin/subscribe/details */ @@ -68,7 +71,7 @@ export async function getSubscribeDetails( options?: { [key: string]: any } ) { return request( - "/v1/admin/subscribe/details", + "/api/v1/admin/subscribe/details", { method: "GET", params: { @@ -84,14 +87,17 @@ export async function updateSubscribeGroup( body: API.UpdateSubscribeGroupRequest, options?: { [key: string]: any } ) { - return request("/v1/admin/subscribe/group", { - method: "PUT", - headers: { - "Content-Type": "application/json", - }, - data: body, - ...(options || {}), - }); + return request( + "/api/v1/admin/subscribe/group", + { + method: "PUT", + headers: { + "Content-Type": "application/json", + }, + data: body, + ...(options || {}), + } + ); } /** Create subscribe group POST /v1/admin/subscribe/group */ @@ -99,14 +105,17 @@ export async function createSubscribeGroup( body: API.CreateSubscribeGroupRequest, options?: { [key: string]: any } ) { - return request("/v1/admin/subscribe/group", { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - data: body, - ...(options || {}), - }); + return request( + "/api/v1/admin/subscribe/group", + { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + data: body, + ...(options || {}), + } + ); } /** Delete subscribe group DELETE /v1/admin/subscribe/group */ @@ -114,14 +123,17 @@ export async function deleteSubscribeGroup( body: API.DeleteSubscribeGroupRequest, options?: { [key: string]: any } ) { - return request("/v1/admin/subscribe/group", { - method: "DELETE", - headers: { - "Content-Type": "application/json", - }, - data: body, - ...(options || {}), - }); + return request( + "/api/v1/admin/subscribe/group", + { + method: "DELETE", + headers: { + "Content-Type": "application/json", + }, + data: body, + ...(options || {}), + } + ); } /** Batch delete subscribe group DELETE /v1/admin/subscribe/group/batch */ @@ -130,7 +142,7 @@ export async function batchDeleteSubscribeGroup( options?: { [key: string]: any } ) { return request( - "/v1/admin/subscribe/group/batch", + "/api/v1/admin/subscribe/group/batch", { method: "DELETE", headers: { @@ -145,7 +157,7 @@ export async function batchDeleteSubscribeGroup( /** Get subscribe group list GET /v1/admin/subscribe/group/list */ export async function getSubscribeGroupList(options?: { [key: string]: any }) { return request( - "/v1/admin/subscribe/group/list", + "/api/v1/admin/subscribe/group/list", { method: "GET", ...(options || {}), @@ -160,7 +172,7 @@ export async function getSubscribeList( options?: { [key: string]: any } ) { return request( - "/v1/admin/subscribe/list", + "/api/v1/admin/subscribe/list", { method: "GET", params: { @@ -174,7 +186,7 @@ export async function getSubscribeList( /** Reset all subscribe tokens POST /v1/admin/subscribe/reset_all_token */ export async function resetAllSubscribeToken(options?: { [key: string]: any }) { return request( - "/v1/admin/subscribe/reset_all_token", + "/api/v1/admin/subscribe/reset_all_token", { method: "POST", ...(options || {}), @@ -187,12 +199,15 @@ export async function subscribeSort( body: API.SubscribeSortRequest, options?: { [key: string]: any } ) { - return request("/v1/admin/subscribe/sort", { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - data: body, - ...(options || {}), - }); + return request( + "/api/v1/admin/subscribe/sort", + { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + data: body, + ...(options || {}), + } + ); } diff --git a/packages/ui/src/services/admin/system.ts b/packages/ui/src/services/admin/system.ts index a2c2651..7378bcd 100644 --- a/packages/ui/src/services/admin/system.ts +++ b/packages/ui/src/services/admin/system.ts @@ -4,7 +4,7 @@ import request from "@workspace/ui/lib/request"; /** Get Currency Config GET /v1/admin/system/currency_config */ export async function getCurrencyConfig(options?: { [key: string]: any }) { return request( - "/v1/admin/system/currency_config", + "/api/v1/admin/system/currency_config", { method: "GET", ...(options || {}), @@ -18,7 +18,7 @@ export async function updateCurrencyConfig( options?: { [key: string]: any } ) { return request( - "/v1/admin/system/currency_config", + "/api/v1/admin/system/currency_config", { method: "PUT", headers: { @@ -33,7 +33,7 @@ export async function updateCurrencyConfig( /** Get Node Multiplier GET /v1/admin/system/get_node_multiplier */ export async function getNodeMultiplier(options?: { [key: string]: any }) { return request( - "/v1/admin/system/get_node_multiplier", + "/api/v1/admin/system/get_node_multiplier", { method: "GET", ...(options || {}), @@ -44,7 +44,7 @@ export async function getNodeMultiplier(options?: { [key: string]: any }) { /** Get invite config GET /v1/admin/system/invite_config */ export async function getInviteConfig(options?: { [key: string]: any }) { return request( - "/v1/admin/system/invite_config", + "/api/v1/admin/system/invite_config", { method: "GET", ...(options || {}), @@ -58,7 +58,7 @@ export async function updateInviteConfig( options?: { [key: string]: any } ) { return request( - "/v1/admin/system/invite_config", + "/api/v1/admin/system/invite_config", { method: "PUT", headers: { @@ -73,7 +73,7 @@ export async function updateInviteConfig( /** Get Module Config GET /v1/admin/system/module */ export async function getModuleConfig(options?: { [key: string]: any }) { return request( - "/v1/admin/system/module", + "/api/v1/admin/system/module", { method: "GET", ...(options || {}), @@ -84,7 +84,7 @@ export async function getModuleConfig(options?: { [key: string]: any }) { /** Get node config GET /v1/admin/system/node_config */ export async function getNodeConfig(options?: { [key: string]: any }) { return request( - "/v1/admin/system/node_config", + "/api/v1/admin/system/node_config", { method: "GET", ...(options || {}), @@ -98,7 +98,7 @@ export async function updateNodeConfig( options?: { [key: string]: any } ) { return request( - "/v1/admin/system/node_config", + "/api/v1/admin/system/node_config", { method: "PUT", headers: { @@ -113,7 +113,7 @@ export async function updateNodeConfig( /** PreView Node Multiplier GET /v1/admin/system/node_multiplier/preview */ export async function preViewNodeMultiplier(options?: { [key: string]: any }) { return request( - "/v1/admin/system/node_multiplier/preview", + "/api/v1/admin/system/node_multiplier/preview", { method: "GET", ...(options || {}), @@ -124,7 +124,7 @@ export async function preViewNodeMultiplier(options?: { [key: string]: any }) { /** get Privacy Policy Config GET /v1/admin/system/privacy */ export async function getPrivacyPolicyConfig(options?: { [key: string]: any }) { return request( - "/v1/admin/system/privacy", + "/api/v1/admin/system/privacy", { method: "GET", ...(options || {}), @@ -137,20 +137,23 @@ export async function updatePrivacyPolicyConfig( body: API.PrivacyPolicyConfig, options?: { [key: string]: any } ) { - return request("/v1/admin/system/privacy", { - method: "PUT", - headers: { - "Content-Type": "application/json", - }, - data: body, - ...(options || {}), - }); + return request( + "/api/v1/admin/system/privacy", + { + method: "PUT", + headers: { + "Content-Type": "application/json", + }, + data: body, + ...(options || {}), + } + ); } /** Get register config GET /v1/admin/system/register_config */ export async function getRegisterConfig(options?: { [key: string]: any }) { return request( - "/v1/admin/system/register_config", + "/api/v1/admin/system/register_config", { method: "GET", ...(options || {}), @@ -164,7 +167,7 @@ export async function updateRegisterConfig( options?: { [key: string]: any } ) { return request( - "/v1/admin/system/register_config", + "/api/v1/admin/system/register_config", { method: "PUT", headers: { @@ -182,7 +185,7 @@ export async function setNodeMultiplier( options?: { [key: string]: any } ) { return request( - "/v1/admin/system/set_node_multiplier", + "/api/v1/admin/system/set_node_multiplier", { method: "POST", headers: { @@ -197,7 +200,7 @@ export async function setNodeMultiplier( /** setting telegram bot POST /v1/admin/system/setting_telegram_bot */ export async function settingTelegramBot(options?: { [key: string]: any }) { return request( - "/v1/admin/system/setting_telegram_bot", + "/api/v1/admin/system/setting_telegram_bot", { method: "POST", ...(options || {}), @@ -208,7 +211,7 @@ export async function settingTelegramBot(options?: { [key: string]: any }) { /** Get site config GET /v1/admin/system/site_config */ export async function getSiteConfig(options?: { [key: string]: any }) { return request( - "/v1/admin/system/site_config", + "/api/v1/admin/system/site_config", { method: "GET", ...(options || {}), @@ -222,7 +225,7 @@ export async function updateSiteConfig( options?: { [key: string]: any } ) { return request( - "/v1/admin/system/site_config", + "/api/v1/admin/system/site_config", { method: "PUT", headers: { @@ -237,7 +240,7 @@ export async function updateSiteConfig( /** Get subscribe config GET /v1/admin/system/subscribe_config */ export async function getSubscribeConfig(options?: { [key: string]: any }) { return request( - "/v1/admin/system/subscribe_config", + "/api/v1/admin/system/subscribe_config", { method: "GET", ...(options || {}), @@ -251,7 +254,7 @@ export async function updateSubscribeConfig( options?: { [key: string]: any } ) { return request( - "/v1/admin/system/subscribe_config", + "/api/v1/admin/system/subscribe_config", { method: "PUT", headers: { @@ -266,7 +269,7 @@ export async function updateSubscribeConfig( /** Get Team of Service Config GET /v1/admin/system/tos_config */ export async function getTosConfig(options?: { [key: string]: any }) { return request( - "/v1/admin/system/tos_config", + "/api/v1/admin/system/tos_config", { method: "GET", ...(options || {}), @@ -279,20 +282,23 @@ export async function updateTosConfig( body: API.TosConfig, options?: { [key: string]: any } ) { - return request("/v1/admin/system/tos_config", { - method: "PUT", - headers: { - "Content-Type": "application/json", - }, - data: body, - ...(options || {}), - }); + return request( + "/api/v1/admin/system/tos_config", + { + method: "PUT", + headers: { + "Content-Type": "application/json", + }, + data: body, + ...(options || {}), + } + ); } /** Get Verify Code Config GET /v1/admin/system/verify_code_config */ export async function getVerifyCodeConfig(options?: { [key: string]: any }) { return request( - "/v1/admin/system/verify_code_config", + "/api/v1/admin/system/verify_code_config", { method: "GET", ...(options || {}), @@ -306,7 +312,7 @@ export async function updateVerifyCodeConfig( options?: { [key: string]: any } ) { return request( - "/v1/admin/system/verify_code_config", + "/api/v1/admin/system/verify_code_config", { method: "PUT", headers: { @@ -321,7 +327,7 @@ export async function updateVerifyCodeConfig( /** Get verify config GET /v1/admin/system/verify_config */ export async function getVerifyConfig(options?: { [key: string]: any }) { return request( - "/v1/admin/system/verify_config", + "/api/v1/admin/system/verify_config", { method: "GET", ...(options || {}), @@ -335,7 +341,7 @@ export async function updateVerifyConfig( options?: { [key: string]: any } ) { return request( - "/v1/admin/system/verify_config", + "/api/v1/admin/system/verify_config", { method: "PUT", headers: { diff --git a/packages/ui/src/services/admin/ticket.ts b/packages/ui/src/services/admin/ticket.ts index c068054..b858685 100644 --- a/packages/ui/src/services/admin/ticket.ts +++ b/packages/ui/src/services/admin/ticket.ts @@ -6,7 +6,7 @@ export async function updateTicketStatus( body: API.UpdateTicketStatusRequest, options?: { [key: string]: any } ) { - return request("/v1/admin/ticket/", { + return request("/api/v1/admin/ticket/", { method: "PUT", headers: { "Content-Type": "application/json", @@ -23,7 +23,7 @@ export async function getTicket( options?: { [key: string]: any } ) { return request( - "/v1/admin/ticket/detail", + "/api/v1/admin/ticket/detail", { method: "GET", params: { @@ -39,7 +39,7 @@ export async function createTicketFollow( body: API.CreateTicketFollowRequest, options?: { [key: string]: any } ) { - return request("/v1/admin/ticket/follow", { + return request("/api/v1/admin/ticket/follow", { method: "POST", headers: { "Content-Type": "application/json", @@ -56,7 +56,7 @@ export async function getTicketList( options?: { [key: string]: any } ) { return request( - "/v1/admin/ticket/list", + "/api/v1/admin/ticket/list", { method: "GET", params: { diff --git a/packages/ui/src/services/admin/tool.ts b/packages/ui/src/services/admin/tool.ts index c7c10d5..8b2ad94 100644 --- a/packages/ui/src/services/admin/tool.ts +++ b/packages/ui/src/services/admin/tool.ts @@ -1,10 +1,28 @@ /* eslint-disable */ import request from "@workspace/ui/lib/request"; +/** Query IP Location GET /v1/admin/tool/ip/location */ +export async function queryIpLocation( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.QueryIPLocationParams, + options?: { [key: string]: any } +) { + return request( + "/api/v1/admin/tool/ip/location", + { + method: "GET", + params: { + ...params, + }, + ...(options || {}), + } + ); +} + /** Get System Log GET /v1/admin/tool/log */ export async function getSystemLog(options?: { [key: string]: any }) { return request( - "/v1/admin/tool/log", + "/api/v1/admin/tool/log", { method: "GET", ...(options || {}), @@ -14,7 +32,7 @@ export async function getSystemLog(options?: { [key: string]: any }) { /** Restart System GET /v1/admin/tool/restart */ export async function restartSystem(options?: { [key: string]: any }) { - return request("/v1/admin/tool/restart", { + return request("/api/v1/admin/tool/restart", { method: "GET", ...(options || {}), }); @@ -23,7 +41,7 @@ export async function restartSystem(options?: { [key: string]: any }) { /** Get Version GET /v1/admin/tool/version */ export async function getVersion(options?: { [key: string]: any }) { return request( - "/v1/admin/tool/version", + "/api/v1/admin/tool/version", { method: "GET", ...(options || {}), diff --git a/packages/ui/src/services/admin/typings.d.ts b/packages/ui/src/services/admin/typings.d.ts index 9c2ad38..3a80d12 100644 --- a/packages/ui/src/services/admin/typings.d.ts +++ b/packages/ui/src/services/admin/typings.d.ts @@ -1648,6 +1648,20 @@ declare namespace API { list: Document[]; }; + type QueryIPLocationParams = { + ip: string; + }; + + type QueryIPLocationRequest = { + ip: string; + }; + + type QueryIPLocationResponse = { + country: string; + region?: string; + city: string; + }; + type QueryNodeTagResponse = { tags: string[]; }; @@ -2388,6 +2402,7 @@ declare namespace API { enable_trade_notify: boolean; auth_methods: UserAuthMethod[]; user_devices: UserDevice[]; + rules: string[]; created_at: number; updated_at: number; deleted_at?: number; diff --git a/packages/ui/src/services/admin/user.ts b/packages/ui/src/services/admin/user.ts index 967a339..6a8f32a 100644 --- a/packages/ui/src/services/admin/user.ts +++ b/packages/ui/src/services/admin/user.ts @@ -6,7 +6,7 @@ export async function createUser( body: API.CreateUserRequest, options?: { [key: string]: any } ) { - return request("/v1/admin/user/", { + return request("/api/v1/admin/user/", { method: "POST", headers: { "Content-Type": "application/json", @@ -22,7 +22,7 @@ export async function deleteUser( params: API.DeleteUserParams, options?: { [key: string]: any } ) { - return request("/v1/admin/user/", { + return request("/api/v1/admin/user/", { method: "DELETE", params: { ...params, @@ -34,7 +34,7 @@ export async function deleteUser( /** Get user auth method GET /v1/admin/user/auth_method */ export async function getUserAuthMethod(options?: { [key: string]: any }) { return request( - "/v1/admin/user/auth_method", + "/api/v1/admin/user/auth_method", { method: "GET", ...(options || {}), @@ -47,14 +47,17 @@ export async function updateUserAuthMethod( body: API.UpdateUserAuthMethodRequest, options?: { [key: string]: any } ) { - return request("/v1/admin/user/auth_method", { - method: "PUT", - headers: { - "Content-Type": "application/json", - }, - data: body, - ...(options || {}), - }); + return request( + "/api/v1/admin/user/auth_method", + { + method: "PUT", + headers: { + "Content-Type": "application/json", + }, + data: body, + ...(options || {}), + } + ); } /** Create user auth method POST /v1/admin/user/auth_method */ @@ -62,14 +65,17 @@ export async function createUserAuthMethod( body: API.CreateUserAuthMethodRequest, options?: { [key: string]: any } ) { - return request("/v1/admin/user/auth_method", { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - data: body, - ...(options || {}), - }); + return request( + "/api/v1/admin/user/auth_method", + { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + data: body, + ...(options || {}), + } + ); } /** Delete user auth method DELETE /v1/admin/user/auth_method */ @@ -77,14 +83,17 @@ export async function deleteUserAuthMethod( body: API.DeleteUserAuthMethodRequest, options?: { [key: string]: any } ) { - return request("/v1/admin/user/auth_method", { - method: "DELETE", - headers: { - "Content-Type": "application/json", - }, - data: body, - ...(options || {}), - }); + return request( + "/api/v1/admin/user/auth_method", + { + method: "DELETE", + headers: { + "Content-Type": "application/json", + }, + data: body, + ...(options || {}), + } + ); } /** Update user basic info PUT /v1/admin/user/basic */ @@ -92,7 +101,7 @@ export async function updateUserBasicInfo( body: API.UpdateUserBasiceInfoRequest, options?: { [key: string]: any } ) { - return request("/v1/admin/user/basic", { + return request("/api/v1/admin/user/basic", { method: "PUT", headers: { "Content-Type": "application/json", @@ -107,7 +116,7 @@ export async function batchDeleteUser( body: API.BatchDeleteUserRequest, options?: { [key: string]: any } ) { - return request("/v1/admin/user/batch", { + return request("/api/v1/admin/user/batch", { method: "DELETE", headers: { "Content-Type": "application/json", @@ -119,10 +128,13 @@ export async function batchDeleteUser( /** Current user GET /v1/admin/user/current */ export async function currentUser(options?: { [key: string]: any }) { - return request("/v1/admin/user/current", { - method: "GET", - ...(options || {}), - }); + return request( + "/api/v1/admin/user/current", + { + method: "GET", + ...(options || {}), + } + ); } /** Get user detail GET /v1/admin/user/detail */ @@ -131,13 +143,16 @@ export async function getUserDetail( params: API.GetUserDetailParams, options?: { [key: string]: any } ) { - return request("/v1/admin/user/detail", { - method: "GET", - params: { - ...params, - }, - ...(options || {}), - }); + return request( + "/api/v1/admin/user/detail", + { + method: "GET", + params: { + ...params, + }, + ...(options || {}), + } + ); } /** User device PUT /v1/admin/user/device */ @@ -145,7 +160,7 @@ export async function updateUserDevice( body: API.UserDevice, options?: { [key: string]: any } ) { - return request("/v1/admin/user/device", { + return request("/api/v1/admin/user/device", { method: "PUT", headers: { "Content-Type": "application/json", @@ -160,7 +175,7 @@ export async function deleteUserDevice( body: API.DeleteUserDeivceRequest, options?: { [key: string]: any } ) { - return request("/v1/admin/user/device", { + return request("/api/v1/admin/user/device", { method: "DELETE", headers: { "Content-Type": "application/json", @@ -176,7 +191,7 @@ export async function kickOfflineByUserDevice( options?: { [key: string]: any } ) { return request( - "/v1/admin/user/device/kick_offline", + "/api/v1/admin/user/device/kick_offline", { method: "PUT", headers: { @@ -195,7 +210,7 @@ export async function getUserList( options?: { [key: string]: any } ) { return request( - "/v1/admin/user/list", + "/api/v1/admin/user/list", { method: "GET", params: { @@ -213,7 +228,7 @@ export async function getUserLoginLogs( options?: { [key: string]: any } ) { return request( - "/v1/admin/user/login/logs", + "/api/v1/admin/user/login/logs", { method: "GET", params: { @@ -229,7 +244,7 @@ export async function updateUserNotifySetting( body: API.UpdateUserNotifySettingRequest, options?: { [key: string]: any } ) { - return request("/v1/admin/user/notify", { + return request("/api/v1/admin/user/notify", { method: "PUT", headers: { "Content-Type": "application/json", @@ -246,7 +261,7 @@ export async function getUserSubscribe( options?: { [key: string]: any } ) { return request( - "/v1/admin/user/subscribe", + "/api/v1/admin/user/subscribe", { method: "GET", params: { @@ -262,14 +277,17 @@ export async function updateUserSubscribe( body: API.UpdateUserSubscribeRequest, options?: { [key: string]: any } ) { - return request("/v1/admin/user/subscribe", { - method: "PUT", - headers: { - "Content-Type": "application/json", - }, - data: body, - ...(options || {}), - }); + return request( + "/api/v1/admin/user/subscribe", + { + method: "PUT", + headers: { + "Content-Type": "application/json", + }, + data: body, + ...(options || {}), + } + ); } /** Create user subcribe POST /v1/admin/user/subscribe */ @@ -277,14 +295,17 @@ export async function createUserSubscribe( body: API.CreateUserSubscribeRequest, options?: { [key: string]: any } ) { - return request("/v1/admin/user/subscribe", { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - data: body, - ...(options || {}), - }); + return request( + "/api/v1/admin/user/subscribe", + { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + data: body, + ...(options || {}), + } + ); } /** Delete user subcribe DELETE /v1/admin/user/subscribe */ @@ -292,14 +313,17 @@ export async function deleteUserSubscribe( body: API.DeleteUserSubscribeRequest, options?: { [key: string]: any } ) { - return request("/v1/admin/user/subscribe", { - method: "DELETE", - headers: { - "Content-Type": "application/json", - }, - data: body, - ...(options || {}), - }); + return request( + "/api/v1/admin/user/subscribe", + { + method: "DELETE", + headers: { + "Content-Type": "application/json", + }, + data: body, + ...(options || {}), + } + ); } /** Get user subcribe by id GET /v1/admin/user/subscribe/detail */ @@ -309,7 +333,7 @@ export async function getUserSubscribeById( options?: { [key: string]: any } ) { return request( - "/v1/admin/user/subscribe/detail", + "/api/v1/admin/user/subscribe/detail", { method: "GET", params: { @@ -327,7 +351,7 @@ export async function getUserSubscribeDevices( options?: { [key: string]: any } ) { return request( - "/v1/admin/user/subscribe/device", + "/api/v1/admin/user/subscribe/device", { method: "GET", params: { @@ -345,7 +369,7 @@ export async function getUserSubscribeLogs( options?: { [key: string]: any } ) { return request( - "/v1/admin/user/subscribe/logs", + "/api/v1/admin/user/subscribe/logs", { method: "GET", params: { @@ -364,7 +388,7 @@ export async function getUserSubscribeResetTrafficLogs( ) { return request< API.Response & { data?: API.GetUserSubscribeResetTrafficLogsResponse } - >("/v1/admin/user/subscribe/reset/logs", { + >("/api/v1/admin/user/subscribe/reset/logs", { method: "GET", params: { ...params, @@ -381,7 +405,7 @@ export async function getUserSubscribeTrafficLogs( ) { return request< API.Response & { data?: API.GetUserSubscribeTrafficLogsResponse } - >("/v1/admin/user/subscribe/traffic_logs", { + >("/api/v1/admin/user/subscribe/traffic_logs", { method: "GET", params: { ...params, diff --git a/packages/ui/src/services/common/auth.ts b/packages/ui/src/services/common/auth.ts index d254eba..df9a61e 100644 --- a/packages/ui/src/services/common/auth.ts +++ b/packages/ui/src/services/common/auth.ts @@ -8,7 +8,7 @@ export async function checkUser( options?: { [key: string]: any } ) { return request( - "/v1/auth/check", + "/api/v1/auth/check", { method: "GET", params: { @@ -26,7 +26,7 @@ export async function checkUserTelephone( options?: { [key: string]: any } ) { return request( - "/v1/auth/check/telephone", + "/api/v1/auth/check/telephone", { method: "GET", params: { @@ -43,7 +43,7 @@ export async function userLogin( options?: { [key: string]: any } ) { return request( - "/v1/auth/login", + "/api/v1/auth/login", { method: "POST", headers: { @@ -61,7 +61,7 @@ export async function deviceLogin( options?: { [key: string]: any } ) { return request( - "/v1/auth/login/device", + "/api/v1/auth/login/device", { method: "POST", headers: { @@ -79,7 +79,7 @@ export async function telephoneLogin( options?: { [key: string]: any } ) { return request( - "/v1/auth/login/telephone", + "/api/v1/auth/login/telephone", { method: "POST", headers: { @@ -97,7 +97,7 @@ export async function userRegister( options?: { [key: string]: any } ) { return request( - "/v1/auth/register", + "/api/v1/auth/register", { method: "POST", headers: { @@ -115,7 +115,7 @@ export async function telephoneUserRegister( options?: { [key: string]: any } ) { return request( - "/v1/auth/register/telephone", + "/api/v1/auth/register/telephone", { method: "POST", headers: { @@ -133,7 +133,7 @@ export async function resetPassword( options?: { [key: string]: any } ) { return request( - "/v1/auth/reset", + "/api/v1/auth/reset", { method: "POST", headers: { @@ -151,7 +151,7 @@ export async function telephoneResetPassword( options?: { [key: string]: any } ) { return request( - "/v1/auth/reset/telephone", + "/api/v1/auth/reset/telephone", { method: "POST", headers: { diff --git a/packages/ui/src/services/common/common.ts b/packages/ui/src/services/common/common.ts index 724e5ee..f2c3654 100644 --- a/packages/ui/src/services/common/common.ts +++ b/packages/ui/src/services/common/common.ts @@ -8,7 +8,7 @@ export async function getAds( options?: { [key: string]: any } ) { return request( - "/v1/common/ads", + "/api/v1/common/ads", { method: "GET", params: { @@ -25,7 +25,7 @@ export async function checkVerificationCode( options?: { [key: string]: any } ) { return request( - "/v1/common/check_verification_code", + "/api/v1/common/check_verification_code", { method: "POST", headers: { @@ -40,7 +40,7 @@ export async function checkVerificationCode( /** Get Client GET /v1/common/client */ export async function getClient(options?: { [key: string]: any }) { return request( - "/v1/common/client", + "/api/v1/common/client", { method: "GET", ...(options || {}), @@ -51,7 +51,7 @@ export async function getClient(options?: { [key: string]: any }) { /** 此处后端没有提供注释 GET /v1/common/heartbeat */ export async function heartbeat(options?: { [key: string]: any }) { return request( - "/v1/common/heartbeat", + "/api/v1/common/heartbeat", { method: "GET", ...(options || {}), @@ -65,7 +65,7 @@ export async function sendEmailCode( options?: { [key: string]: any } ) { return request( - "/v1/common/send_code", + "/api/v1/common/send_code", { method: "POST", headers: { @@ -83,7 +83,7 @@ export async function sendSmsCode( options?: { [key: string]: any } ) { return request( - "/v1/common/send_sms_code", + "/api/v1/common/send_sms_code", { method: "POST", headers: { @@ -98,7 +98,7 @@ export async function sendSmsCode( /** Get global config GET /v1/common/site/config */ export async function getGlobalConfig(options?: { [key: string]: any }) { return request( - "/v1/common/site/config", + "/api/v1/common/site/config", { method: "GET", ...(options || {}), @@ -109,7 +109,7 @@ export async function getGlobalConfig(options?: { [key: string]: any }) { /** Get Privacy Policy GET /v1/common/site/privacy */ export async function getPrivacyPolicy(options?: { [key: string]: any }) { return request( - "/v1/common/site/privacy", + "/api/v1/common/site/privacy", { method: "GET", ...(options || {}), @@ -120,7 +120,7 @@ export async function getPrivacyPolicy(options?: { [key: string]: any }) { /** Get stat GET /v1/common/site/stat */ export async function getStat(options?: { [key: string]: any }) { return request( - "/v1/common/site/stat", + "/api/v1/common/site/stat", { method: "GET", ...(options || {}), @@ -131,7 +131,7 @@ export async function getStat(options?: { [key: string]: any }) { /** Get Tos Content GET /v1/common/site/tos */ export async function getTos(options?: { [key: string]: any }) { return request( - "/v1/common/site/tos", + "/api/v1/common/site/tos", { method: "GET", ...(options || {}), diff --git a/packages/ui/src/services/common/oauth.ts b/packages/ui/src/services/common/oauth.ts index 547be13..44a67f3 100644 --- a/packages/ui/src/services/common/oauth.ts +++ b/packages/ui/src/services/common/oauth.ts @@ -4,6 +4,7 @@ import request from "@workspace/ui/lib/request"; /** Apple Login Callback POST /v1/auth/oauth/callback/apple */ export async function appleLoginCallback( body: { + code: string; id_token: string; state: string; }, @@ -17,9 +18,9 @@ export async function appleLoginCallback( if (item !== undefined && item !== null) { if (typeof item === "object" && !(item instanceof File)) { if (Array.isArray(item)) { - for (const f of item) { + item.forEach((f) => { formData.append(ele, f || ""); - } + }); } else { formData.append( ele, @@ -33,7 +34,7 @@ export async function appleLoginCallback( }); return request( - "/v1/auth/oauth/callback/apple", + "/api/v1/auth/oauth/callback/apple", { method: "POST", data: formData, @@ -48,7 +49,7 @@ export async function oAuthLogin( options?: { [key: string]: any } ) { return request( - "/v1/auth/oauth/login", + "/api/v1/auth/oauth/login", { method: "POST", headers: { @@ -66,7 +67,7 @@ export async function oAuthLoginGetToken( options?: { [key: string]: any } ) { return request( - "/v1/auth/oauth/login/token", + "/api/v1/auth/oauth/login/token", { method: "POST", headers: { diff --git a/packages/ui/src/services/common/typings.d.ts b/packages/ui/src/services/common/typings.d.ts index d1a9016..b22240e 100644 --- a/packages/ui/src/services/common/typings.d.ts +++ b/packages/ui/src/services/common/typings.d.ts @@ -1019,6 +1019,7 @@ declare namespace API { enable_trade_notify: boolean; auth_methods: UserAuthMethod[]; user_devices: UserDevice[]; + rules: string[]; created_at: number; updated_at: number; deleted_at?: number; diff --git a/packages/ui/src/services/user/announcement.ts b/packages/ui/src/services/user/announcement.ts index c285e64..60b2f04 100644 --- a/packages/ui/src/services/user/announcement.ts +++ b/packages/ui/src/services/user/announcement.ts @@ -8,7 +8,7 @@ export async function queryAnnouncement( options?: { [key: string]: any } ) { return request( - "/v1/public/announcement/list", + "/api/v1/public/announcement/list", { method: "GET", params: { diff --git a/packages/ui/src/services/user/document.ts b/packages/ui/src/services/user/document.ts index e1026f9..61220a5 100644 --- a/packages/ui/src/services/user/document.ts +++ b/packages/ui/src/services/user/document.ts @@ -8,7 +8,7 @@ export async function queryDocumentDetail( options?: { [key: string]: any } ) { return request( - "/v1/public/document/detail", + "/api/v1/public/document/detail", { method: "GET", params: { @@ -22,7 +22,7 @@ export async function queryDocumentDetail( /** Get document list GET /v1/public/document/list */ export async function queryDocumentList(options?: { [key: string]: any }) { return request( - "/v1/public/document/list", + "/api/v1/public/document/list", { method: "GET", ...(options || {}), diff --git a/packages/ui/src/services/user/order.ts b/packages/ui/src/services/user/order.ts index a7b0817..c7f807a 100644 --- a/packages/ui/src/services/user/order.ts +++ b/packages/ui/src/services/user/order.ts @@ -6,7 +6,7 @@ export async function closeOrder( body: API.CloseOrderRequest, options?: { [key: string]: any } ) { - return request("/v1/public/order/close", { + return request("/api/v1/public/order/close", { method: "POST", headers: { "Content-Type": "application/json", @@ -23,7 +23,7 @@ export async function queryOrderDetail( options?: { [key: string]: any } ) { return request( - "/v1/public/order/detail", + "/api/v1/public/order/detail", { method: "GET", params: { @@ -41,7 +41,7 @@ export async function queryOrderList( options?: { [key: string]: any } ) { return request( - "/v1/public/order/list", + "/api/v1/public/order/list", { method: "GET", params: { @@ -58,7 +58,7 @@ export async function preCreateOrder( options?: { [key: string]: any } ) { return request( - "/v1/public/order/pre", + "/api/v1/public/order/pre", { method: "POST", headers: { @@ -76,7 +76,7 @@ export async function purchase( options?: { [key: string]: any } ) { return request( - "/v1/public/order/purchase", + "/api/v1/public/order/purchase", { method: "POST", headers: { @@ -94,7 +94,7 @@ export async function recharge( options?: { [key: string]: any } ) { return request( - "/v1/public/order/recharge", + "/api/v1/public/order/recharge", { method: "POST", headers: { @@ -112,7 +112,7 @@ export async function renewal( options?: { [key: string]: any } ) { return request( - "/v1/public/order/renewal", + "/api/v1/public/order/renewal", { method: "POST", headers: { @@ -130,7 +130,7 @@ export async function resetTraffic( options?: { [key: string]: any } ) { return request( - "/v1/public/order/reset", + "/api/v1/public/order/reset", { method: "POST", headers: { diff --git a/packages/ui/src/services/user/payment.ts b/packages/ui/src/services/user/payment.ts index e7349e1..4deb59f 100644 --- a/packages/ui/src/services/user/payment.ts +++ b/packages/ui/src/services/user/payment.ts @@ -7,7 +7,7 @@ export async function getAvailablePaymentMethods(options?: { }) { return request< API.Response & { data?: API.GetAvailablePaymentMethodsResponse } - >("/v1/public/payment/methods", { + >("/api/v1/public/payment/methods", { method: "GET", ...(options || {}), }); diff --git a/packages/ui/src/services/user/portal.ts b/packages/ui/src/services/user/portal.ts index 644754b..89700b2 100644 --- a/packages/ui/src/services/user/portal.ts +++ b/packages/ui/src/services/user/portal.ts @@ -7,7 +7,7 @@ export async function purchaseCheckout( options?: { [key: string]: any } ) { return request( - "/v1/public/portal/order/checkout", + "/api/v1/public/portal/order/checkout", { method: "POST", headers: { @@ -26,7 +26,7 @@ export async function queryPurchaseOrder( options?: { [key: string]: any } ) { return request( - "/v1/public/portal/order/status", + "/api/v1/public/portal/order/status", { method: "GET", params: { @@ -43,7 +43,7 @@ export async function getAvailablePaymentMethods(options?: { }) { return request< API.Response & { data?: API.GetAvailablePaymentMethodsResponse } - >("/v1/public/portal/payment-method", { + >("/api/v1/public/portal/payment-method", { method: "GET", ...(options || {}), }); @@ -55,7 +55,7 @@ export async function prePurchaseOrder( options?: { [key: string]: any } ) { return request( - "/v1/public/portal/pre", + "/api/v1/public/portal/pre", { method: "POST", headers: { @@ -73,7 +73,7 @@ export async function purchase( options?: { [key: string]: any } ) { return request( - "/v1/public/portal/purchase", + "/api/v1/public/portal/purchase", { method: "POST", headers: { @@ -92,7 +92,7 @@ export async function getSubscription( options?: { [key: string]: any } ) { return request( - "/v1/public/portal/subscribe", + "/api/v1/public/portal/subscribe", { method: "GET", params: { diff --git a/packages/ui/src/services/user/subscribe.ts b/packages/ui/src/services/user/subscribe.ts index aa77ffb..23b4968 100644 --- a/packages/ui/src/services/user/subscribe.ts +++ b/packages/ui/src/services/user/subscribe.ts @@ -8,7 +8,7 @@ export async function querySubscribeList( options?: { [key: string]: any } ) { return request( - "/v1/public/subscribe/list", + "/api/v1/public/subscribe/list", { method: "GET", params: { @@ -25,7 +25,7 @@ export async function queryUserSubscribeNodeList(options?: { }) { return request< API.Response & { data?: API.QueryUserSubscribeNodeListResponse } - >("/v1/public/subscribe/node/list", { + >("/api/v1/public/subscribe/node/list", { method: "GET", ...(options || {}), }); diff --git a/packages/ui/src/services/user/ticket.ts b/packages/ui/src/services/user/ticket.ts index bfd47af..6f95041 100644 --- a/packages/ui/src/services/user/ticket.ts +++ b/packages/ui/src/services/user/ticket.ts @@ -6,7 +6,7 @@ export async function updateUserTicketStatus( body: API.UpdateUserTicketStatusRequest, options?: { [key: string]: any } ) { - return request("/v1/public/ticket/", { + return request("/api/v1/public/ticket/", { method: "PUT", headers: { "Content-Type": "application/json", @@ -21,7 +21,7 @@ export async function createUserTicket( body: API.CreateUserTicketRequest, options?: { [key: string]: any } ) { - return request("/v1/public/ticket/", { + return request("/api/v1/public/ticket/", { method: "POST", headers: { "Content-Type": "application/json", @@ -38,7 +38,7 @@ export async function getUserTicketDetails( options?: { [key: string]: any } ) { return request( - "/v1/public/ticket/detail", + "/api/v1/public/ticket/detail", { method: "GET", params: { @@ -54,14 +54,17 @@ export async function createUserTicketFollow( body: API.CreateUserTicketFollowRequest, options?: { [key: string]: any } ) { - return request("/v1/public/ticket/follow", { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - data: body, - ...(options || {}), - }); + return request( + "/api/v1/public/ticket/follow", + { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + data: body, + ...(options || {}), + } + ); } /** Get ticket list GET /v1/public/ticket/list */ @@ -71,7 +74,7 @@ export async function getUserTicketList( options?: { [key: string]: any } ) { return request( - "/v1/public/ticket/list", + "/api/v1/public/ticket/list", { method: "GET", params: { diff --git a/packages/ui/src/services/user/typings.d.ts b/packages/ui/src/services/user/typings.d.ts index 4870125..bd7c5c0 100644 --- a/packages/ui/src/services/user/typings.d.ts +++ b/packages/ui/src/services/user/typings.d.ts @@ -170,6 +170,11 @@ declare namespace API { timestamp: number; }; + type CommissionWithdrawRequest = { + amount: number; + content: string; + }; + type Coupon = { id: number; name: string; @@ -816,6 +821,21 @@ declare namespace API { list: UserSubscribeInfo[]; }; + type QueryWithdrawalLogListRequest = { + page: number; + size: number; + }; + + type QueryWithdrawalLogListResponse = { + list: WithdrawalLog[]; + total: number; + }; + + type QueryWithdrawalLogParams = { + page: number; + size: number; + }; + type RechargeOrderRequest = { amount: number; payment: number; @@ -1089,6 +1109,10 @@ declare namespace API { password: string; }; + type UpdateUserRulesRequest = { + rules: string[]; + }; + type UpdateUserSubscribeNoteRequest = { user_subscribe_id: number; note: string; @@ -1118,6 +1142,7 @@ declare namespace API { enable_trade_notify: boolean; auth_methods: UserAuthMethod[]; user_devices: UserDevice[]; + rules: string[]; created_at: number; updated_at: number; deleted_at?: number; @@ -1255,4 +1280,15 @@ declare namespace API { security: string; security_config: SecurityConfig; }; + + type WithdrawalLog = { + id: number; + user_id: number; + amount: number; + content: string; + status: number; + reason?: string; + created_at: number; + updated_at: number; + }; } diff --git a/packages/ui/src/services/user/user.ts b/packages/ui/src/services/user/user.ts index 7226ddd..b8cc248 100644 --- a/packages/ui/src/services/user/user.ts +++ b/packages/ui/src/services/user/user.ts @@ -4,7 +4,7 @@ import request from "@workspace/ui/lib/request"; /** Query User Affiliate Count GET /v1/public/user/affiliate/count */ export async function queryUserAffiliate(options?: { [key: string]: any }) { return request( - "/v1/public/user/affiliate/count", + "/api/v1/public/user/affiliate/count", { method: "GET", ...(options || {}), @@ -19,7 +19,7 @@ export async function queryUserAffiliateList( options?: { [key: string]: any } ) { return request( - "/v1/public/user/affiliate/list", + "/api/v1/public/user/affiliate/list", { method: "GET", params: { @@ -33,7 +33,7 @@ export async function queryUserAffiliateList( /** Query User Balance Log GET /v1/public/user/balance_log */ export async function queryUserBalanceLog(options?: { [key: string]: any }) { return request( - "/v1/public/user/balance_log", + "/api/v1/public/user/balance_log", { method: "GET", ...(options || {}), @@ -46,14 +46,17 @@ export async function updateBindEmail( body: API.UpdateBindEmailRequest, options?: { [key: string]: any } ) { - return request("/v1/public/user/bind_email", { - method: "PUT", - headers: { - "Content-Type": "application/json", - }, - data: body, - ...(options || {}), - }); + return request( + "/api/v1/public/user/bind_email", + { + method: "PUT", + headers: { + "Content-Type": "application/json", + }, + data: body, + ...(options || {}), + } + ); } /** Update Bind Mobile PUT /v1/public/user/bind_mobile */ @@ -61,14 +64,17 @@ export async function updateBindMobile( body: API.UpdateBindMobileRequest, options?: { [key: string]: any } ) { - return request("/v1/public/user/bind_mobile", { - method: "PUT", - headers: { - "Content-Type": "application/json", - }, - data: body, - ...(options || {}), - }); + return request( + "/api/v1/public/user/bind_mobile", + { + method: "PUT", + headers: { + "Content-Type": "application/json", + }, + data: body, + ...(options || {}), + } + ); } /** Bind OAuth POST /v1/public/user/bind_oauth */ @@ -77,7 +83,7 @@ export async function bindOAuth( options?: { [key: string]: any } ) { return request( - "/v1/public/user/bind_oauth", + "/api/v1/public/user/bind_oauth", { method: "POST", headers: { @@ -95,7 +101,7 @@ export async function bindOAuthCallback( options?: { [key: string]: any } ) { return request( - "/v1/public/user/bind_oauth/callback", + "/api/v1/public/user/bind_oauth/callback", { method: "POST", headers: { @@ -110,7 +116,7 @@ export async function bindOAuthCallback( /** Bind Telegram GET /v1/public/user/bind_telegram */ export async function bindTelegram(options?: { [key: string]: any }) { return request( - "/v1/public/user/bind_telegram", + "/api/v1/public/user/bind_telegram", { method: "GET", ...(options || {}), @@ -126,7 +132,7 @@ export async function queryUserCommissionLog( ) { return request< API.Response & { data?: API.QueryUserCommissionLogListResponse } - >("/v1/public/user/commission_log", { + >("/api/v1/public/user/commission_log", { method: "GET", params: { ...params, @@ -135,10 +141,28 @@ export async function queryUserCommissionLog( }); } +/** Commission Withdraw POST /v1/public/user/commission_withdraw */ +export async function commissionWithdraw( + body: API.CommissionWithdrawRequest, + options?: { [key: string]: any } +) { + return request( + "/api/v1/public/user/commission_withdraw", + { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + data: body, + ...(options || {}), + } + ); +} + /** Get Device List GET /v1/public/user/devices */ export async function getDeviceList(options?: { [key: string]: any }) { return request( - "/v1/public/user/devices", + "/api/v1/public/user/devices", { method: "GET", ...(options || {}), @@ -148,10 +172,13 @@ export async function getDeviceList(options?: { [key: string]: any }) { /** Query User Info GET /v1/public/user/info */ export async function queryUserInfo(options?: { [key: string]: any }) { - return request("/v1/public/user/info", { - method: "GET", - ...(options || {}), - }); + return request( + "/api/v1/public/user/info", + { + method: "GET", + ...(options || {}), + } + ); } /** Get Login Log GET /v1/public/user/login_log */ @@ -161,7 +188,7 @@ export async function getLoginLog( options?: { [key: string]: any } ) { return request( - "/v1/public/user/login_log", + "/api/v1/public/user/login_log", { method: "GET", params: { @@ -177,7 +204,7 @@ export async function updateUserNotify( body: API.UpdateUserNotifyRequest, options?: { [key: string]: any } ) { - return request("/v1/public/user/notify", { + return request("/api/v1/public/user/notify", { method: "PUT", headers: { "Content-Type": "application/json", @@ -190,7 +217,7 @@ export async function updateUserNotify( /** Get OAuth Methods GET /v1/public/user/oauth_methods */ export async function getOAuthMethods(options?: { [key: string]: any }) { return request( - "/v1/public/user/oauth_methods", + "/api/v1/public/user/oauth_methods", { method: "GET", ...(options || {}), @@ -203,7 +230,25 @@ export async function updateUserPassword( body: API.UpdateUserPasswordRequest, options?: { [key: string]: any } ) { - return request("/v1/public/user/password", { + return request( + "/api/v1/public/user/password", + { + method: "PUT", + headers: { + "Content-Type": "application/json", + }, + data: body, + ...(options || {}), + } + ); +} + +/** Update User Rules PUT /v1/public/user/rules */ +export async function updateUserRules( + body: API.UpdateUserRulesRequest, + options?: { [key: string]: any } +) { + return request("/api/v1/public/user/rules", { method: "PUT", headers: { "Content-Type": "application/json", @@ -216,7 +261,7 @@ export async function updateUserPassword( /** Query User Subscribe GET /v1/public/user/subscribe */ export async function queryUserSubscribe(options?: { [key: string]: any }) { return request( - "/v1/public/user/subscribe", + "/api/v1/public/user/subscribe", { method: "GET", ...(options || {}), @@ -231,7 +276,7 @@ export async function getSubscribeLog( options?: { [key: string]: any } ) { return request( - "/v1/public/user/subscribe_log", + "/api/v1/public/user/subscribe_log", { method: "GET", params: { @@ -248,7 +293,7 @@ export async function updateUserSubscribeNote( options?: { [key: string]: any } ) { return request( - "/v1/public/user/subscribe_note", + "/api/v1/public/user/subscribe_note", { method: "PUT", headers: { @@ -266,7 +311,7 @@ export async function resetUserSubscribeToken( options?: { [key: string]: any } ) { return request( - "/v1/public/user/subscribe_token", + "/api/v1/public/user/subscribe_token", { method: "PUT", headers: { @@ -284,7 +329,7 @@ export async function unbindDevice( options?: { [key: string]: any } ) { return request( - "/v1/public/user/unbind_device", + "/api/v1/public/user/unbind_device", { method: "PUT", headers: { @@ -302,7 +347,7 @@ export async function unbindOAuth( options?: { [key: string]: any } ) { return request( - "/v1/public/user/unbind_oauth", + "/api/v1/public/user/unbind_oauth", { method: "POST", headers: { @@ -317,7 +362,7 @@ export async function unbindOAuth( /** Unbind Telegram POST /v1/public/user/unbind_telegram */ export async function unbindTelegram(options?: { [key: string]: any }) { return request( - "/v1/public/user/unbind_telegram", + "/api/v1/public/user/unbind_telegram", { method: "POST", ...(options || {}), @@ -330,14 +375,17 @@ export async function unsubscribe( body: API.UnsubscribeRequest, options?: { [key: string]: any } ) { - return request("/v1/public/user/unsubscribe", { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - data: body, - ...(options || {}), - }); + return request( + "/api/v1/public/user/unsubscribe", + { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + data: body, + ...(options || {}), + } + ); } /** Pre Unsubscribe POST /v1/public/user/unsubscribe/pre */ @@ -346,7 +394,7 @@ export async function preUnsubscribe( options?: { [key: string]: any } ) { return request( - "/v1/public/user/unsubscribe/pre", + "/api/v1/public/user/unsubscribe/pre", { method: "POST", headers: { @@ -364,7 +412,7 @@ export async function verifyEmail( options?: { [key: string]: any } ) { return request( - "/v1/public/user/verify_email", + "/api/v1/public/user/verify_email", { method: "POST", headers: { @@ -375,3 +423,21 @@ export async function verifyEmail( } ); } + +/** Query Withdrawal Log GET /v1/public/user/withdrawal_log */ +export async function queryWithdrawalLog( + // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) + params: API.QueryWithdrawalLogParams, + options?: { [key: string]: any } +) { + return request( + "/api/v1/public/user/withdrawal_log", + { + method: "GET", + params: { + ...params, + }, + ...(options || {}), + } + ); +}