diff --git a/publish.ps1 b/publish.ps1 index 14ee313..01b81ed 100644 --- a/publish.ps1 +++ b/publish.ps1 @@ -9,8 +9,8 @@ if ($confrim -ne "y") { exit 0 } -docker build -t repo.lanhuip.com:8554/lanhu/web:latest . -docker build -t repo.lanhuip.com:8554/lanhu/web:$($args[0]) . +docker build -t repo.lanhuip.com/lanhu/web:latest . +docker build -t repo.lanhuip.com/lanhu/web:$($args[0]) . -docker push repo.lanhuip.com:8554/lanhu/web:latest -docker push repo.lanhuip.com:8554/lanhu/web:$($args[0]) +docker push repo.lanhuip.com/lanhu/web:latest +docker push repo.lanhuip.com/lanhu/web:$($args[0]) diff --git a/src/actions/resource.ts b/src/actions/resource.ts index 47e74e9..b85873a 100644 --- a/src/actions/resource.ts +++ b/src/actions/resource.ts @@ -103,3 +103,10 @@ export async function getPriceHome(props: CreateResourceReq) { discounted?: string }>('/api/resource/price', props) } + +export async function updateCheckip(props: { + id: number + checkip: boolean +}) { + return callByUser('/api/resource/update/checkip', props) +} diff --git a/src/app/(auth)/login/login-card.tsx b/src/app/(auth)/login/login-card.tsx index 77ad0f3..6077b18 100644 --- a/src/app/(auth)/login/login-card.tsx +++ b/src/app/(auth)/login/login-card.tsx @@ -93,7 +93,7 @@ export default function LoginCard() {
返回首页 diff --git a/src/app/admin/clients.tsx b/src/app/admin/clients.tsx index 8eac354..9eb4cf7 100644 --- a/src/app/admin/clients.tsx +++ b/src/app/admin/clients.tsx @@ -93,7 +93,8 @@ function ContentResolved() { export function Header() { const navbar = useLayoutStore(store => store.navbar) const toggleNavbar = useLayoutStore(store => store.toggleNavbar) - + const profile = use(useProfileStore(store => store.profile)) + const showRealnameAuth = profile?.id_type === 0 return (
欢迎来到,蓝狐代理
- - - 实名认证 - + {showRealnameAuth ? ( + + + 实名认证 + + ) : ( + + + 已实名 + + )}
{ + try { + const result = await updateCheckip({ + id: id, + checkip: !currentCheckip, + }) + + if (result.success) { + toast.success(`IP检查已${!currentCheckip ? '启用' : '停用'}`) + await refresh(data.page, data.size) + } + else { + throw new Error(result.message || '操作失败') + } + } + catch (e) { + toast.error(e instanceof Error ? e.message : '更新IP检查状态失败') + } + } + console.log(data.list, 'data.list') + // 表格列定义 const columns = useMemo | Resource<2>>[]>(() => { const resourceKey = isLong ? 'long' : 'short' @@ -218,7 +240,11 @@ export default function ResourceList({resourceType}: ResourceListProps) { { header: '开通时间', cell: ({row}) => formatDateTime(row.original.created_at), - }, + }, // 短效资源增加到期时间列 + !isLong ? { + header: '到期时间', + cell: ({row}) => formatDateTime((row.original as Resource<1>).short.expire_at), + } : undefined, { header: '状态', cell: ({row}) => { @@ -231,25 +257,21 @@ export default function ResourceList({resourceType}: ResourceListProps) { }, }, { - header: 'IP检查状态', + header: '操作', cell: ({row}) => { const checkip = row.original.checkip return ( - - {checkip ? '启用IP检查' : '停用IP检查'} - + ) }, }, - ] - - // 短效资源增加到期时间列 - if (!isLong) { - baseColumns.push({ - header: '到期时间', - cell: ({row}) => formatDateTime((row.original as Resource<1>).short.expire_at), - }) - } + ].filter(Boolean) return baseColumns }, [isLong])