套餐添加操作列 & 登录后已实名的更新状态显示 &更新脚本的远程仓库地址

This commit is contained in:
Eamon-meng
2026-04-23 13:43:06 +08:00
parent d9cd5eb41b
commit 1e76275f04
5 changed files with 68 additions and 28 deletions

View File

@@ -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])

View File

@@ -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)
}

View File

@@ -93,7 +93,7 @@ export default function LoginCard() {
<div className="relative w-96 mx-4">
<Link
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"/>

View File

@@ -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 (
<header className={merge(
`flex-none h-16 overflow-hidden`,
@@ -119,13 +120,23 @@ export function Header() {
</Button>
<span className="max-md:hidden"></span>
<div className="max-md:hidden h-5 w-px bg-gray-300 mx-2"/>
<Link
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>
</Link>
{showRealnameAuth ? (
<Link
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>
</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"/>
<a
href="https://wpa1.qq.com/K0s0cvwf?_type=wpa&qidian=true"

View File

@@ -8,7 +8,7 @@ import zod from 'zod'
import {toast} from 'sonner'
import {useStatus} from '@/lib/states'
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 {ColumnDef} from '@tanstack/react-table'
import {Resource} from '@/lib/models/resource'
@@ -21,6 +21,7 @@ import {
isValidResourceType,
ResourceTypeBadge,
} from './utils'
import {Button} from '@/components/ui/button'
const filterSchema = zod.object({
resource_no: zod.string().optional().default(''),
@@ -130,6 +131,27 @@ 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 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 (
<span className={checkip ? 'text-green-500' : 'text-red-500'}>
{checkip ? '启用IP检查' : '停用IP检查'}
</span>
<Button
theme="default"
className="h-7 px-3 text-sm"
onClick={() => handleCheckipChange(row.original.id, row.original.checkip)}
>
{checkip ? '停用IP检查' : '启用IP检查'}
</Button>
)
},
},
]
// 短效资源增加到期时间列
if (!isLong) {
baseColumns.push({
header: '到期时间',
cell: ({row}) => formatDateTime((row.original as Resource<1>).short.expire_at),
})
}
].filter(Boolean)
return baseColumns
}, [isLong])