补齐论坛核心能力:讨论锁定、发帖本地草稿、标签精确筛选,以及私信与通知分流。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-07 06:32:06 +08:00
parent 0f83183620
commit 10185178e2
28 changed files with 1165 additions and 266 deletions

View File

@@ -15,18 +15,18 @@ export type FeedCache = {
/** 仅存内存:SPA 内返回可恢复,浏览器刷新自动清空 */
const store = new Map<string, FeedCache>();
function cacheKey(boardId: number, keyword: string, sort: FeedSort) {
return `${boardId}:${keyword}:${sort}`;
function cacheKey(boardId: number, keyword: string, sort: FeedSort, tag = '') {
return `${boardId}:${keyword}:${tag}:${sort}`;
}
/** 读取帖子列表缓存(从详情页返回时恢复浏览位置) */
export function getFeedCache(boardId: number, keyword: string, sort: FeedSort): FeedCache | null {
return store.get(cacheKey(boardId, keyword, sort)) ?? null;
export function getFeedCache(boardId: number, keyword: string, sort: FeedSort, tag = ''): FeedCache | null {
return store.get(cacheKey(boardId, keyword, sort, tag)) ?? null;
}
/** 保存帖子列表缓存 */
export function setFeedCache(boardId: number, keyword: string, sort: FeedSort, data: FeedCache) {
store.set(cacheKey(boardId, keyword, sort), data);
export function setFeedCache(boardId: number, keyword: string, sort: FeedSort, data: FeedCache, tag = '') {
store.set(cacheKey(boardId, keyword, sort, tag), data);
}
/** 清除所有帖子列表缓存 */