Compare commits

...

4 Commits

Author SHA1 Message Date
amtoaer
2c10218644 chore: 调整间距 2026-04-07 18:01:09 +08:00
amtoaer
203f7e5c35 chore: 交换列顺序 2026-04-07 17:49:54 +08:00
amtoaer
f5fb51d703 fix: 默认时间戳视为 None 2026-04-07 17:37:20 +08:00
amtoaer
34e2140afa feat: 视频源页显示最新视频时间 2026-04-07 17:22:46 +08:00
4 changed files with 26 additions and 5 deletions

View File

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

View File

@@ -104,7 +104,8 @@ pub async fn get_video_sources_details(
collection::Column::Name,
collection::Column::Path,
collection::Column::Rule,
collection::Column::Enabled
collection::Column::Enabled,
collection::Column::LatestRowAt
])
.into_model::<VideoSourceDetail>()
.all(&db),
@@ -115,7 +116,8 @@ pub async fn get_video_sources_details(
favorite::Column::Name,
favorite::Column::Path,
favorite::Column::Rule,
favorite::Column::Enabled
favorite::Column::Enabled,
favorite::Column::LatestRowAt
])
.into_model::<VideoSourceDetail>()
.all(&db),
@@ -127,7 +129,8 @@ pub async fn get_video_sources_details(
submission::Column::Path,
submission::Column::Enabled,
submission::Column::Rule,
submission::Column::UseDynamicApi
submission::Column::UseDynamicApi,
submission::Column::LatestRowAt
])
.into_model::<VideoSourceDetail>()
.all(&db),
@@ -138,7 +141,8 @@ pub async fn get_video_sources_details(
watch_later::Column::Id,
watch_later::Column::Path,
watch_later::Column::Enabled,
watch_later::Column::Rule
watch_later::Column::Rule,
watch_later::Column::LatestRowAt
])
.into_model::<VideoSourceDetail>()
.all(&db)
@@ -152,6 +156,7 @@ pub async fn get_video_sources_details(
rule_display: None,
use_dynamic_api: None,
enabled: false,
latest_row_at: None,
})
}
for sources in [&mut collections, &mut favorites, &mut submissions, &mut watch_later] {
@@ -159,6 +164,7 @@ pub async fn get_video_sources_details(
if let Some(rule) = &item.rule {
item.rule_display = Some(rule.to_string());
}
item.latest_row_at = item.latest_row_at.filter(|dt| dt.and_utc().timestamp() != 0);
});
}
Ok(ApiResponse::ok(VideoSourcesDetailsResponse {

View File

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

View File

@@ -366,8 +366,9 @@
<Table.Row>
<Table.Head class="w-[20%]">名称</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-[15%]">启用状态</Table.Head>
<Table.Head class="w-[10%]">启用状态</Table.Head>
<Table.Head class="w-[10%] text-right">操作</Table.Head>
</Table.Row>
</Table.Header>
@@ -387,6 +388,17 @@
</span>
</div>
</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>
{#if source.rule && source.rule.length > 0}
<Tooltip.Root disableHoverableContent={true}>