Compare commits
2 Commits
8e50a7264b
...
01f4f5343d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
01f4f5343d | ||
|
|
7b7ba7d01d |
@@ -27,3 +27,9 @@ export async function updateGateway(data: { id: number; status: number }) {
|
||||
export async function clear(data: { proxy_id: number }) {
|
||||
return callByUser<PageRecord>("/api/admin/channel/sync/clear-expired", data)
|
||||
}
|
||||
export async function createProxyPort(data: { id: number }) {
|
||||
return callByUser<PageRecord>("/api/admin/proxy/sync/ports", data)
|
||||
}
|
||||
export async function createProxyChains(data: { id: number }) {
|
||||
return callByUser<PageRecord>("/api/admin/proxy/sync/chains", data)
|
||||
}
|
||||
|
||||
@@ -118,6 +118,7 @@ export default function ChannelPage() {
|
||||
const onFilter = handleSubmit(() => {
|
||||
table.pagination.onPageChange(1)
|
||||
})
|
||||
console.log(table, "table")
|
||||
|
||||
return (
|
||||
<Page>
|
||||
@@ -291,56 +292,63 @@ export default function ChannelPage() {
|
||||
accessorFn: row => row.user?.phone || "-",
|
||||
},
|
||||
{
|
||||
header: "套餐号",
|
||||
header: "套餐号/提取编号",
|
||||
accessorKey: "resource.resource_no",
|
||||
cell: ({ row }) => {
|
||||
const resource_no = row.original.resource?.resource_no
|
||||
const batchNo = row.original.batch_no
|
||||
const type = row.original.resource?.type
|
||||
return (
|
||||
<Link
|
||||
href={`./resources?resource_no=${resource_no}&type=${type}`}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="text-blue-600"
|
||||
>
|
||||
{resource_no}
|
||||
</Link>
|
||||
<div className="flex flex-col font-mono text-xs">
|
||||
<span>
|
||||
套餐号  :
|
||||
<Link
|
||||
href={`./resources?resource_no=${resource_no}&type=${type}`}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="text-blue-600"
|
||||
>
|
||||
{resource_no}
|
||||
</Link>
|
||||
</span>
|
||||
<span>
|
||||
提取编号:
|
||||
<Link
|
||||
href={`./batch?batch_no=${batchNo}`}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="text-blue-600"
|
||||
>
|
||||
{batchNo}
|
||||
</Link>
|
||||
</span>
|
||||
</div>
|
||||
)
|
||||
},
|
||||
},
|
||||
{
|
||||
header: "提取编号",
|
||||
accessorKey: "batch_no",
|
||||
header: "网关",
|
||||
accessorKey: "host",
|
||||
cell: ({ row }) => {
|
||||
const batchNo = row.original.batch_no
|
||||
return (
|
||||
<Link
|
||||
href={`./batch?batch_no=${batchNo}`}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="text-blue-600"
|
||||
>
|
||||
{batchNo}
|
||||
</Link>
|
||||
<span>
|
||||
{row.original.host}:{row.original.port}
|
||||
</span>
|
||||
)
|
||||
},
|
||||
},
|
||||
{
|
||||
header: "节点",
|
||||
accessorFn: row => row.ip || row.edge_ref || row.edge_id,
|
||||
accessorFn: row => row.edge_ref || row.ip || row.edge_id,
|
||||
},
|
||||
{
|
||||
header: "自动配置",
|
||||
header: "地区",
|
||||
cell: ({ row }) => {
|
||||
const prov = row.original.filter_prov
|
||||
const city = row.original.filter_city
|
||||
const isp = row.original.filter_isp
|
||||
const parts = []
|
||||
if (prov && prov !== "all") parts.push(prov)
|
||||
if (city && city !== "all") parts.push(city)
|
||||
if (isp && isp !== "all") {
|
||||
parts.push(ispMap[Number(isp)] || isp)
|
||||
}
|
||||
return (
|
||||
<div className="text-sm">
|
||||
{parts.length > 0 ? parts.join(" / ") : "不限"}
|
||||
@@ -349,14 +357,11 @@ export default function ChannelPage() {
|
||||
},
|
||||
},
|
||||
{
|
||||
header: "网关地址",
|
||||
accessorKey: "host",
|
||||
header: "运营商",
|
||||
// accessorFn: row => row.filter_isp || "",
|
||||
cell: ({ row }) => {
|
||||
return (
|
||||
<span>
|
||||
{row.original.host}:{row.original.port}
|
||||
</span>
|
||||
)
|
||||
const isp = row.original.filter_isp
|
||||
return ispMap[Number(isp)] || isp
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -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 (
|
||||
<Page>
|
||||
<div className="flex justify-between items-stretch">
|
||||
@@ -123,7 +169,7 @@ export default function GatewayPage() {
|
||||
meta: { pin: "right" },
|
||||
header: "操作",
|
||||
cell: ({ row }) => (
|
||||
<div className="flex gap-2">
|
||||
<div className="flex gap-2 ">
|
||||
<Button
|
||||
onClick={() =>
|
||||
handleToggle(row.original.id, row.original.status)
|
||||
@@ -140,6 +186,14 @@ export default function GatewayPage() {
|
||||
清理过期连接
|
||||
</Button>
|
||||
</Auth>
|
||||
<Auth scope={ScopeProxyWrite}>
|
||||
<Button onClick={() => createPort(row.original)}>
|
||||
重建端口池
|
||||
</Button>
|
||||
<Button onClick={() => createChains(row.original)}>
|
||||
重建代理链
|
||||
</Button>
|
||||
</Auth>
|
||||
</div>
|
||||
),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user