From 7b7ba7d01d416eae8f5a3fa367d16c46a6eeda6c Mon Sep 17 00:00:00 2001 From: Eamon <17516219072@163.com> Date: Thu, 11 Jun 2026 16:09:07 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BD=91=E5=85=B3=E5=88=97=E8=A1=A8=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E6=93=8D=E4=BD=9C=E9=87=8D=E5=BB=BA=E7=AB=AF=E5=8F=A3?= =?UTF-8?q?=E6=B1=A0=20&=20=E9=87=8D=E5=BB=BA=E4=BB=A3=E7=90=86=E9=93=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/actions/gateway.ts | 6 ++++ src/app/(root)/gateway/page.tsx | 58 +++++++++++++++++++++++++++++++-- 2 files changed, 62 insertions(+), 2 deletions(-) diff --git a/src/actions/gateway.ts b/src/actions/gateway.ts index ed0f0aa..177a5c0 100644 --- a/src/actions/gateway.ts +++ b/src/actions/gateway.ts @@ -27,3 +27,9 @@ export async function updateGateway(data: { id: number; status: number }) { export async function clear(data: { proxy_id: number }) { return callByUser("/api/admin/channel/sync/clear-expired", data) } +export async function createProxyPort(data: { id: number }) { + return callByUser("/api/admin/proxy/sync/ports", data) +} +export async function createProxyChains(data: { id: number }) { + return callByUser("/api/admin/proxy/sync/chains", data) +} diff --git a/src/app/(root)/gateway/page.tsx b/src/app/(root)/gateway/page.tsx index 8aca882..66de8d6 100644 --- a/src/app/(root)/gateway/page.tsx +++ b/src/app/(root)/gateway/page.tsx @@ -3,7 +3,13 @@ import { format } from "date-fns" import { Suspense, useCallback, useState } from "react" import { toast } from "sonner" -import { clear, getGatewayPage, updateGateway } from "@/actions/gateway" +import { + clear, + createProxyChains, + createProxyPort, + getGatewayPage, + updateGateway, +} from "@/actions/gateway" import { Auth } from "@/components/auth" import { DataTable, useDataTable } from "@/components/data-table" import { Page } from "@/components/page" @@ -64,6 +70,46 @@ export default function GatewayPage() { } } + const createPort = async (val: Gateway) => { + setLoading(true) + try { + const result = await createProxyPort({ + id: val.id, + }) + + if (result.success) { + toast.success(`重建端口池成功!`) + } else { + toast.error(result.message || "请稍后重试一下~") + } + } catch (error) { + const message = error instanceof Error ? error.message : error + toast.error(`清理过期连接失败: ${message}`) + } finally { + setLoading(false) + } + } + + const createChains = async (val: Gateway) => { + setLoading(true) + try { + const result = await createProxyChains({ + id: val.id, + }) + + if (result.success) { + toast.success(`重建代理链成功!!!`) + } else { + toast.error(result.message || "请稍后重试一下~") + } + } catch (error) { + const message = error instanceof Error ? error.message : error + toast.error(`清理过期连接失败: ${message}`) + } finally { + setLoading(false) + } + } + return (
@@ -123,7 +169,7 @@ export default function GatewayPage() { meta: { pin: "right" }, header: "操作", cell: ({ row }) => ( -
+
+ + + +
), },