feat: 视频源页显示最新视频时间

This commit is contained in:
amtoaer
2026-04-07 17:22:46 +08:00
parent 91ab64a068
commit 34e2140afa
4 changed files with 25 additions and 5 deletions

View File

@@ -1,5 +1,6 @@
use bili_sync_entity::rule::Rule; use bili_sync_entity::rule::Rule;
use bili_sync_entity::*; use bili_sync_entity::*;
use sea_orm::prelude::DateTime;
use sea_orm::{DerivePartialModel, FromQueryResult}; use sea_orm::{DerivePartialModel, FromQueryResult};
use serde::Serialize; use serde::Serialize;
@@ -218,6 +219,7 @@ pub struct VideoSourceDetail {
#[serde(default)] #[serde(default)]
pub use_dynamic_api: Option<bool>, pub use_dynamic_api: Option<bool>,
pub enabled: bool, pub enabled: bool,
pub latest_row_at: Option<DateTime>,
} }
#[derive(Serialize)] #[derive(Serialize)]

View File

@@ -104,7 +104,8 @@ pub async fn get_video_sources_details(
collection::Column::Name, collection::Column::Name,
collection::Column::Path, collection::Column::Path,
collection::Column::Rule, collection::Column::Rule,
collection::Column::Enabled collection::Column::Enabled,
collection::Column::LatestRowAt
]) ])
.into_model::<VideoSourceDetail>() .into_model::<VideoSourceDetail>()
.all(&db), .all(&db),
@@ -115,7 +116,8 @@ pub async fn get_video_sources_details(
favorite::Column::Name, favorite::Column::Name,
favorite::Column::Path, favorite::Column::Path,
favorite::Column::Rule, favorite::Column::Rule,
favorite::Column::Enabled favorite::Column::Enabled,
favorite::Column::LatestRowAt
]) ])
.into_model::<VideoSourceDetail>() .into_model::<VideoSourceDetail>()
.all(&db), .all(&db),
@@ -127,7 +129,8 @@ pub async fn get_video_sources_details(
submission::Column::Path, submission::Column::Path,
submission::Column::Enabled, submission::Column::Enabled,
submission::Column::Rule, submission::Column::Rule,
submission::Column::UseDynamicApi submission::Column::UseDynamicApi,
submission::Column::LatestRowAt
]) ])
.into_model::<VideoSourceDetail>() .into_model::<VideoSourceDetail>()
.all(&db), .all(&db),
@@ -138,7 +141,8 @@ pub async fn get_video_sources_details(
watch_later::Column::Id, watch_later::Column::Id,
watch_later::Column::Path, watch_later::Column::Path,
watch_later::Column::Enabled, watch_later::Column::Enabled,
watch_later::Column::Rule watch_later::Column::Rule,
watch_later::Column::LatestRowAt
]) ])
.into_model::<VideoSourceDetail>() .into_model::<VideoSourceDetail>()
.all(&db) .all(&db)
@@ -152,6 +156,7 @@ pub async fn get_video_sources_details(
rule_display: None, rule_display: None,
use_dynamic_api: None, use_dynamic_api: None,
enabled: false, enabled: false,
latest_row_at: None,
}) })
} }
for sources in [&mut collections, &mut favorites, &mut submissions, &mut watch_later] { for sources in [&mut collections, &mut favorites, &mut submissions, &mut watch_later] {

View File

@@ -224,6 +224,7 @@ export interface VideoSourceDetail {
ruleDisplay: string | null; ruleDisplay: string | null;
useDynamicApi: boolean | null; useDynamicApi: boolean | null;
enabled: boolean; enabled: boolean;
latestRowAt: string | null;
} }
export interface VideoSourcesDetailsResponse { export interface VideoSourcesDetailsResponse {

View File

@@ -364,9 +364,10 @@
<Table.Root> <Table.Root>
<Table.Header> <Table.Header>
<Table.Row> <Table.Row>
<Table.Head class="w-[20%]">名称</Table.Head> <Table.Head class="w-[15%]">名称</Table.Head>
<Table.Head class="w-[30%]">下载路径</Table.Head> <Table.Head class="w-[30%]">下载路径</Table.Head>
<Table.Head class="w-[15%]">过滤规则</Table.Head> <Table.Head class="w-[15%]">过滤规则</Table.Head>
<Table.Head class="w-[20%]">最新视频时间</Table.Head>
<Table.Head class="w-[15%]">启用状态</Table.Head> <Table.Head class="w-[15%]">启用状态</Table.Head>
<Table.Head class="w-[10%] text-right">操作</Table.Head> <Table.Head class="w-[10%] text-right">操作</Table.Head>
</Table.Row> </Table.Row>
@@ -408,6 +409,17 @@
</Badge> </Badge>
{/if} {/if}
</Table.Cell> </Table.Cell>
<Table.Cell>
{#if source.latestRowAt}
<Badge variant="secondary" class="flex w-fit items-center gap-1.5">
{new Date(source.latestRowAt).toLocaleString('zh-CN')}
</Badge>
{:else}
<Badge variant="secondary" class="flex w-fit items-center gap-1.5">
-
</Badge>
{/if}
</Table.Cell>
<Table.Cell> <Table.Cell>
{#if source.enabled} {#if source.enabled}
<Badge <Badge