mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-06-06 15:10:29 +00:00
最后更新时间
This commit is contained in:
@@ -2,7 +2,7 @@ import BLOG from '@/blog.config'
|
||||
import { NotionAPI } from 'notion-client'
|
||||
import { getDataFromCache, setDataToCache } from '@/lib/cache/cache_manager'
|
||||
|
||||
export async function getPostBlocks (id, from, slice, retryCount = 3) {
|
||||
export async function getPostBlocks(id, from, slice, retryCount = 3) {
|
||||
const cacheKey = 'page_block_' + id
|
||||
let pageBlock = await getDataFromCache(cacheKey)
|
||||
if (pageBlock) {
|
||||
@@ -32,13 +32,13 @@ export async function getPostBlocks (id, from, slice, retryCount = 3) {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 获取到的blockMap删除不需要的字段
|
||||
* @param {*} id 页面ID
|
||||
* @param {*} pageBlock 页面元素
|
||||
* @param {*} slice 截取数量
|
||||
* @returns
|
||||
*/
|
||||
function filterPostBlocks (id, pageBlock, slice) {
|
||||
function filterPostBlocks(id, pageBlock, slice) {
|
||||
const clonePageBlock = deepClone(pageBlock)
|
||||
let count = 0
|
||||
|
||||
@@ -51,8 +51,6 @@ function filterPostBlocks (id, pageBlock, slice) {
|
||||
count++
|
||||
delete b?.role
|
||||
delete b?.value?.version
|
||||
delete b?.value?.created_time
|
||||
delete b?.value?.last_edited_time
|
||||
delete b?.value?.created_by_table
|
||||
delete b?.value?.created_by_id
|
||||
delete b?.value?.last_edited_by_table
|
||||
@@ -67,7 +65,7 @@ function filterPostBlocks (id, pageBlock, slice) {
|
||||
return clonePageBlock
|
||||
}
|
||||
|
||||
function deepClone (obj) {
|
||||
function deepClone(obj) {
|
||||
const newObj = Array.isArray(obj) ? [] : {}
|
||||
if (obj && typeof obj === 'object') {
|
||||
for (const key in obj) {
|
||||
|
||||
Reference in New Issue
Block a user