From 8c5521713baa50a52e95a7ee770cd9add80e9ed2 Mon Sep 17 00:00:00 2001 From: shinya Date: Fri, 11 Jul 2025 02:42:05 +0800 Subject: [PATCH] fix: try to fix year --- src/app/play/page.tsx | 2 ++ src/components/VideoCard.tsx | 5 +++-- src/lib/db.ts | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/app/play/page.tsx b/src/app/play/page.tsx index ec0b1f1..d449220 100644 --- a/src/app/play/page.tsx +++ b/src/app/play/page.tsx @@ -513,6 +513,7 @@ function PlayPageClient() { // 更新状态保存详情 setVideoTitle(detailData.title || videoTitleRef.current); + setVideoYear(detailData.year); setVideoCover(detailData.poster); setDetail(detailData); @@ -930,6 +931,7 @@ function PlayPageClient() { console.log('播放进度已保存:', { title: videoTitleRef.current, episode: currentEpisodeIndexRef.current + 1, + year: detailRef.current?.year || 'unknown', progress: `${Math.floor(currentTime)}/${Math.floor(duration)}`, }); } catch (err) { diff --git a/src/components/VideoCard.tsx b/src/components/VideoCard.tsx index 3621874..ab64b3a 100644 --- a/src/components/VideoCard.tsx +++ b/src/components/VideoCard.tsx @@ -96,8 +96,9 @@ export default function VideoCard({ aggregateData?.mostFrequentDoubanId ?? douban_id ); const actualEpisodes = aggregateData?.mostFrequentEpisodes ?? episodes; - const actualYear = - (isAggregate ? aggregateData?.first.year : year) || 'unknown'; + const actualYear = isAggregate + ? aggregateData?.first.year || 'unknown' + : year; const actualQuery = query || ''; const actualSearchType = isAggregate ? aggregateData?.first.episodes.length === 1 diff --git a/src/lib/db.ts b/src/lib/db.ts index f20de74..a5638e9 100644 --- a/src/lib/db.ts +++ b/src/lib/db.ts @@ -60,7 +60,7 @@ export class DbManager { userName: string, source: string, id: string, - record: Omit + record: PlayRecord ): Promise { const key = generateStorageKey(source, id); await this.storage.setPlayRecord(userName, key, record); @@ -129,7 +129,7 @@ export class DbManager { userName: string, source: string, id: string, - favoriteData?: Omit + favoriteData?: Favorite ): Promise { const isFav = await this.isFavorited(userName, source, id);