完善获取文章列表

This commit is contained in:
tangly1024
2022-05-09 13:52:44 +08:00
parent d200420c31
commit adac140892
4 changed files with 41 additions and 25 deletions

View File

@@ -211,13 +211,18 @@ async function getPageRecordMapByNotionAPI({ pageId, from }) {
}
const collection = Object.values(pageRecordMap.collection)[0]?.value
const collectionId = rawMetadata?.collection_id
const collectionQuery = pageRecordMap.collection_query
const collectionView = pageRecordMap.collection_view
const schema = collection?.schema
const tagOptions = getTagOptions(schema)
const categoryOptions = getCategoryOptions(schema)
const viewIds = rawMetadata?.view_ids
const data = []
const pageIds = getAllPageIds(collectionQuery)
const pageIds = getAllPageIds(collectionQuery, collectionId, collectionView, viewIds)
if (pageIds?.length === 0) {
console.error('获取到的文章列表为空请检查notion模板', collectionQuery, collection, pageRecordMap)
}
for (let i = 0; i < pageIds.length; i++) {
const id = pageIds[i]
const properties = (await getPageProperties(id, block, schema)) || null
@@ -243,6 +248,9 @@ async function getPageRecordMapByNotionAPI({ pageId, from }) {
return {
collection,
collectionQuery,
collectionId,
collectionView,
viewIds,
block,
schema,
tagOptions,