Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
165151b9d2 | ||
|
|
1e76275f04 |
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "lanhu-web",
|
"name": "lanhu-web",
|
||||||
"version": "1.9.0",
|
"version": "1.10.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev -H 0.0.0.0 --turbopack",
|
"dev": "next dev -H 0.0.0.0 --turbopack",
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ if ($confrim -ne "y") {
|
|||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
docker build -t repo.lanhuip.com:8554/lanhu/web:latest .
|
docker build -t repo.lanhuip.com/lanhu/web:latest .
|
||||||
docker build -t repo.lanhuip.com:8554/lanhu/web:$($args[0]) .
|
docker build -t repo.lanhuip.com/lanhu/web:$($args[0]) .
|
||||||
|
|
||||||
docker push repo.lanhuip.com:8554/lanhu/web:latest
|
docker push repo.lanhuip.com/lanhu/web:latest
|
||||||
docker push repo.lanhuip.com:8554/lanhu/web:$($args[0])
|
docker push repo.lanhuip.com/lanhu/web:$($args[0])
|
||||||
|
|||||||
@@ -103,3 +103,10 @@ export async function getPriceHome(props: CreateResourceReq) {
|
|||||||
discounted?: string
|
discounted?: string
|
||||||
}>('/api/resource/price', props)
|
}>('/api/resource/price', props)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function updateCheckip(props: {
|
||||||
|
id: number
|
||||||
|
checkip: boolean
|
||||||
|
}) {
|
||||||
|
return callByUser('/api/resource/update/checkip', props)
|
||||||
|
}
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ export default function LoginCard() {
|
|||||||
<div className="relative w-96 mx-4">
|
<div className="relative w-96 mx-4">
|
||||||
<Link
|
<Link
|
||||||
href="/"
|
href="/"
|
||||||
className="absolute -top-8 right-0 inline-flex items-center text-sm transition-colors"
|
className="absolute -top-8 right-0 inline-flex items-center text-sm transition-colors px-10"
|
||||||
>
|
>
|
||||||
<HomeIcon size={18} className="mr-1"/>
|
<HomeIcon size={18} className="mr-1"/>
|
||||||
返回首页
|
返回首页
|
||||||
|
|||||||
@@ -93,7 +93,8 @@ function ContentResolved() {
|
|||||||
export function Header() {
|
export function Header() {
|
||||||
const navbar = useLayoutStore(store => store.navbar)
|
const navbar = useLayoutStore(store => store.navbar)
|
||||||
const toggleNavbar = useLayoutStore(store => store.toggleNavbar)
|
const toggleNavbar = useLayoutStore(store => store.toggleNavbar)
|
||||||
|
const profile = use(useProfileStore(store => store.profile))
|
||||||
|
const showRealnameAuth = profile?.id_type === 0
|
||||||
return (
|
return (
|
||||||
<header className={merge(
|
<header className={merge(
|
||||||
`flex-none h-16 overflow-hidden`,
|
`flex-none h-16 overflow-hidden`,
|
||||||
@@ -119,13 +120,23 @@ export function Header() {
|
|||||||
</Button>
|
</Button>
|
||||||
<span className="max-md:hidden">欢迎来到,蓝狐代理</span>
|
<span className="max-md:hidden">欢迎来到,蓝狐代理</span>
|
||||||
<div className="max-md:hidden h-5 w-px bg-gray-300 mx-2"/>
|
<div className="max-md:hidden h-5 w-px bg-gray-300 mx-2"/>
|
||||||
<Link
|
{showRealnameAuth ? (
|
||||||
href="/admin/identify"
|
<Link
|
||||||
className="max-md:hidden flex items-center gap-1.5 text-sm text-blue-600 hover:text-blue-800 transition-colors"
|
href="/admin/identify"
|
||||||
>
|
className="max-md:hidden flex items-center gap-1.5 text-sm text-blue-600 hover:text-blue-800 transition-colors"
|
||||||
<IdCard size={16}/>
|
>
|
||||||
<span>实名认证</span>
|
<IdCard size={16}/>
|
||||||
</Link>
|
<span>实名认证</span>
|
||||||
|
</Link>
|
||||||
|
) : (
|
||||||
|
<Link
|
||||||
|
href=""
|
||||||
|
className="max-md:hidden flex items-center gap-1.5 text-sm text-green-400 hover:text-green-400 transition-colors"
|
||||||
|
>
|
||||||
|
<IdCard size={16}/>
|
||||||
|
<span>已实名</span>
|
||||||
|
</Link>
|
||||||
|
)}
|
||||||
<div className="max-md:hidden h-5 w-px bg-gray-300 mx-2"/>
|
<div className="max-md:hidden h-5 w-px bg-gray-300 mx-2"/>
|
||||||
<a
|
<a
|
||||||
href="https://wpa1.qq.com/K0s0cvwf?_type=wpa&qidian=true"
|
href="https://wpa1.qq.com/K0s0cvwf?_type=wpa&qidian=true"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import {ReactNode} from 'react'
|
import {ReactNode, Suspense} from 'react'
|
||||||
import {Shell, Content, Header, Navbar, Mask} from './clients'
|
import {Shell, Content, Header, Navbar, Mask} from './clients'
|
||||||
|
|
||||||
export default function Template(props: {
|
export default function Template(props: {
|
||||||
@@ -13,7 +13,9 @@ export default function Template(props: {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="col-start-2 row-start-1 bg-card overflow-hidden relative z-20">
|
<div className="col-start-2 row-start-1 bg-card overflow-hidden relative z-20">
|
||||||
<Header/>
|
<Suspense>
|
||||||
|
<Header/>
|
||||||
|
</Suspense>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<svg className="col-start-2 row-start-2 w-full h-full z-20 pointer-events-none" preserveAspectRatio="none">
|
<svg className="col-start-2 row-start-2 w-full h-full z-20 pointer-events-none" preserveAspectRatio="none">
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import zod from 'zod'
|
|||||||
import {toast} from 'sonner'
|
import {toast} from 'sonner'
|
||||||
import {useStatus} from '@/lib/states'
|
import {useStatus} from '@/lib/states'
|
||||||
import {ExtraResp} from '@/lib/api'
|
import {ExtraResp} from '@/lib/api'
|
||||||
import {listResourceLong, listResourceShort} from '@/actions/resource'
|
import {listResourceLong, listResourceShort, updateCheckip} from '@/actions/resource'
|
||||||
import DataTable from '@/components/data-table'
|
import DataTable from '@/components/data-table'
|
||||||
import {ColumnDef} from '@tanstack/react-table'
|
import {ColumnDef} from '@tanstack/react-table'
|
||||||
import {Resource} from '@/lib/models/resource'
|
import {Resource} from '@/lib/models/resource'
|
||||||
@@ -21,6 +21,7 @@ import {
|
|||||||
isValidResourceType,
|
isValidResourceType,
|
||||||
ResourceTypeBadge,
|
ResourceTypeBadge,
|
||||||
} from './utils'
|
} from './utils'
|
||||||
|
import {Button} from '@/components/ui/button'
|
||||||
|
|
||||||
const filterSchema = zod.object({
|
const filterSchema = zod.object({
|
||||||
resource_no: zod.string().optional().default(''),
|
resource_no: zod.string().optional().default(''),
|
||||||
@@ -130,11 +131,32 @@ export default function ResourceList({resourceType}: ResourceListProps) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleCheckipChange = async (id: number, currentCheckip: boolean) => {
|
||||||
|
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<ColumnDef<Resource<1> | Resource<2>>[]>(() => {
|
const columns = useMemo<ColumnDef<Resource<1> | Resource<2>>[]>(() => {
|
||||||
const resourceKey = isLong ? 'long' : 'short'
|
const resourceKey = isLong ? 'long' : 'short'
|
||||||
|
|
||||||
const baseColumns: ColumnDef<Resource<1> | Resource<2>>[] = [
|
const baseColumns = ([
|
||||||
{
|
{
|
||||||
header: '套餐编号',
|
header: '套餐编号',
|
||||||
cell: ({row}) => {
|
cell: ({row}) => {
|
||||||
@@ -218,7 +240,11 @@ export default function ResourceList({resourceType}: ResourceListProps) {
|
|||||||
{
|
{
|
||||||
header: '开通时间',
|
header: '开通时间',
|
||||||
cell: ({row}) => formatDateTime(row.original.created_at),
|
cell: ({row}) => formatDateTime(row.original.created_at),
|
||||||
},
|
}, // 短效资源增加到期时间列
|
||||||
|
!isLong ? {
|
||||||
|
header: '到期时间',
|
||||||
|
cell: ({row}) => formatDateTime((row.original as Resource<1>).short.expire_at),
|
||||||
|
} : undefined,
|
||||||
{
|
{
|
||||||
header: '状态',
|
header: '状态',
|
||||||
cell: ({row}) => {
|
cell: ({row}) => {
|
||||||
@@ -231,25 +257,21 @@ export default function ResourceList({resourceType}: ResourceListProps) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
header: 'IP检查状态',
|
header: '操作',
|
||||||
cell: ({row}) => {
|
cell: ({row}) => {
|
||||||
const checkip = row.original.checkip
|
const checkip = row.original.checkip
|
||||||
return (
|
return (
|
||||||
<span className={checkip ? 'text-green-500' : 'text-red-500'}>
|
<Button
|
||||||
{checkip ? '启用IP检查' : '停用IP检查'}
|
theme="default"
|
||||||
</span>
|
className="h-7 px-3 text-sm"
|
||||||
|
onClick={() => handleCheckipChange(row.original.id, row.original.checkip)}
|
||||||
|
>
|
||||||
|
{checkip ? '停用IP检查' : '启用IP检查'}
|
||||||
|
</Button>
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
]
|
] satisfies ((ColumnDef<Resource<1> | Resource<2>> | undefined)[])).filter(Boolean) as ColumnDef<Resource<1> | Resource<2>>[]
|
||||||
|
|
||||||
// 短效资源增加到期时间列
|
|
||||||
if (!isLong) {
|
|
||||||
baseColumns.push({
|
|
||||||
header: '到期时间',
|
|
||||||
cell: ({row}) => formatDateTime((row.original as Resource<1>).short.expire_at),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
return baseColumns
|
return baseColumns
|
||||||
}, [isLong])
|
}, [isLong])
|
||||||
|
|||||||
Reference in New Issue
Block a user