diff --git a/Cargo.lock b/Cargo.lock index 1da15a9..9379b2d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -413,6 +413,7 @@ dependencies = [ "serde_json", "serde_urlencoded", "serde_yaml", + "tempfile", "thiserror 2.0.18", "time", "tokio", @@ -476,6 +477,7 @@ dependencies = [ "tower-sessions", "tower-sessions-sqlx-store", "tracing", + "tracing-appender", "tracing-subscriber", "url", "urlencoding", diff --git a/Cargo.toml b/Cargo.toml index 44bf7b0..614796a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,7 +20,7 @@ bytes = "1.10.1" rand = "0.8" serde_urlencoded = "0.7" -tokio = { version = "1", features = ["macros", "rt-multi-thread", "process", "signal"] } +tokio = { version = "1", features = ["macros", "rt-multi-thread", "process", "signal", "sync"] } futures = "0.3.31" async-trait = "0.1.87" diff --git a/app/(app)/archives/page.tsx b/app/(app)/archives/page.tsx new file mode 100644 index 0000000..8990dfe --- /dev/null +++ b/app/(app)/archives/page.tsx @@ -0,0 +1,134 @@ +'use client' + +import { BiliArchive, BiliArchivePage, fetcher } from '@/app/lib/api-streamer' +import { humDate } from '@/app/lib/utils' +import { useBiliUsers } from '@/app/lib/use-streamers' +import { IconUserCardVideo } from '@douyinfe/semi-icons' +import { Banner, Layout, Nav, Pagination, Select, Table, Typography } from '@douyinfe/semi-ui' +import { useState } from 'react' +import useSWR from 'swr' + +const statusOptions = [ + { label: '全部状态', value: 'all' }, + { label: '审核中', value: 'is_pubing' }, + { label: '已通过', value: 'pubed' }, + { label: '未通过', value: 'not_pubed' }, +] + +export default function ArchivesPage() { + const { Header, Content } = Layout + const { Text } = Typography + const { biliUsers, isLoading: usersLoading } = useBiliUsers() + const [userId, setUserId] = useState() + const [status, setStatus] = useState('all') + const [pageNumber, setPageNumber] = useState(1) + const key = userId + ? `/v1/users/${userId}/archives?status=${status}&from_page=${pageNumber}&max_pages=1` + : null + const { data, error, isLoading } = useSWR(key, fetcher) + + const columns = [ + { + title: 'BV号', + dataIndex: 'bvid', + render: (bvid: string) => ( + + {bvid} + + ), + }, + { + title: '标题', + dataIndex: 'title', + render: (title: string) => {title}, + }, + { + title: '状态', + dataIndex: 'state_desc', + render: (stateDescription: string, archive: BiliArchive) => + archive.reject_reason || stateDescription || `状态 ${archive.state}`, + }, + { + title: '时长', + dataIndex: 'duration', + render: (duration: number) => `${Math.floor(duration / 60)}:${String(duration % 60).padStart(2, '0')}`, + }, + { + title: '发布时间', + dataIndex: 'ptime', + render: (ptime: number, archive: BiliArchive) => { + const timestamp = ptime || archive.ctime + return timestamp ? humDate(timestamp) : '-' + }, + }, + ] + + return ( + <> +
+
+ +
+ +