diff --git a/lib/cache/cache_manager.js b/lib/cache/cache_manager.js index ba643b51..c9f7b95f 100644 --- a/lib/cache/cache_manager.js +++ b/lib/cache/cache_manager.js @@ -40,7 +40,7 @@ export async function getOrSetDataWithCustomCache( ) { const dataFromCache = await getDataFromCache(key) if (dataFromCache) { - console.log('[缓存-->>API]:', key) + // console.log('[缓存-->>API]:', key) // 避免过多的缓存日志输出 return dataFromCache } const data = await getDataFunction(...getDataArgs) diff --git a/lib/notion/getAllTags.js b/lib/notion/getAllTags.js index d8430ff7..db5ea55b 100644 --- a/lib/notion/getAllTags.js +++ b/lib/notion/getAllTags.js @@ -28,7 +28,7 @@ export function getAllTags({ const AllTagInfos = {} // 遍历所有文章 allPosts.forEach(post => { - post.tags.forEach(tag => { + post?.tags?.forEach(tag => { // 如果标签已经存在 if (AllTagInfos[tag]) { if ( diff --git a/lib/notion/getPostBlocks.js b/lib/notion/getPostBlocks.js index 19ca3b51..fb486d61 100644 --- a/lib/notion/getPostBlocks.js +++ b/lib/notion/getPostBlocks.js @@ -8,17 +8,17 @@ import { deepClone, delay } from '../utils' import notionAPI from '@/lib/notion/getNotionAPI' /** - * 获取文章内容 + * 获取文章内容块 * @param {*} id * @param {*} from * @param {*} slice * @returns */ export async function getPage(id, from = null, slice) { + const cacheKey = `page_content_${id}` return await getOrSetDataWithCache( - `page_content_${id}_${slice}`, + cacheKey, async (id, slice) => { - const cacheKey = `page_block_${id}` let pageBlock = await getDataFromCache(cacheKey) if (pageBlock) { // console.debug('[API<<--缓存]', `from:${from}`, cacheKey)