剧集更新提示

This commit is contained in:
mtvpls
2026-02-19 22:03:05 +08:00
parent b914133dd7
commit 84fec2eada
11 changed files with 175 additions and 49 deletions

View File

@@ -66,9 +66,9 @@ export class D1Storage implements IStorage {
INSERT INTO play_records (
username, key, title, source_name, cover, year,
episode_index, total_episodes, play_time, total_time,
save_time, search_title
save_time, search_title, new_episodes
)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
ON CONFLICT(username, key) DO UPDATE SET
title = excluded.title,
source_name = excluded.source_name,
@@ -79,7 +79,8 @@ export class D1Storage implements IStorage {
play_time = excluded.play_time,
total_time = excluded.total_time,
save_time = excluded.save_time,
search_title = excluded.search_title
search_title = excluded.search_title,
new_episodes = excluded.new_episodes
`)
.bind(
userName,
@@ -93,7 +94,8 @@ export class D1Storage implements IStorage {
record.play_time,
record.total_time,
record.save_time,
record.search_title || ''
record.search_title || '',
record.new_episodes || null
)
.run();
} catch (err) {
@@ -727,6 +729,7 @@ export class D1Storage implements IStorage {
total_time: row.total_time,
save_time: row.save_time,
search_title: row.search_title || '',
new_episodes: row.new_episodes || undefined,
};
}

View File

@@ -41,6 +41,7 @@ export interface PlayRecord {
save_time: number; // 记录保存时间(时间戳)
search_title?: string; // 搜索时使用的标题
origin?: 'vod' | 'live'; // 来源类型
new_episodes?: number; // 新增的剧集数量(用于显示更新提示)
}
// ---- 收藏类型 ----

View File

@@ -67,9 +67,9 @@ export class PostgresStorage implements IStorage {
INSERT INTO play_records (
username, key, title, source_name, cover, year,
episode_index, total_episodes, play_time, total_time,
save_time, search_title
save_time, search_title, new_episodes
)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13)
ON CONFLICT (username, key) DO UPDATE SET
title = EXCLUDED.title,
source_name = EXCLUDED.source_name,
@@ -80,7 +80,8 @@ export class PostgresStorage implements IStorage {
play_time = EXCLUDED.play_time,
total_time = EXCLUDED.total_time,
save_time = EXCLUDED.save_time,
search_title = EXCLUDED.search_title
search_title = EXCLUDED.search_title,
new_episodes = EXCLUDED.new_episodes
`)
.bind(
userName,
@@ -94,7 +95,8 @@ export class PostgresStorage implements IStorage {
record.play_time,
record.total_time,
record.save_time,
record.search_title || ''
record.search_title || '',
record.new_episodes || null
)
.run();
} catch (err) {
@@ -301,6 +303,7 @@ export class PostgresStorage implements IStorage {
total_time: row.total_time,
save_time: row.save_time,
search_title: row.search_title || '',
new_episodes: row.new_episodes || undefined,
};
}

View File

@@ -12,6 +12,7 @@ export interface PlayRecord {
total_time: number; // 总进度(秒)
save_time: number; // 记录保存时间(时间戳)
search_title: string; // 搜索时使用的标题
new_episodes?: number; // 新增的剧集数量(用于显示更新提示)
}
// 收藏数据结构