修复文章丢失

This commit is contained in:
tangly1024.com
2023-08-04 10:22:06 +08:00
parent dd5fbc0a46
commit 37c29c0c8c

View File

@@ -3,16 +3,21 @@ export default function getAllPageIds (collectionQuery, collectionId, collection
if (!collectionQuery && !collectionView) { if (!collectionQuery && !collectionView) {
return [] return []
} }
let pageIds = []
// 优先按照第一个视图排序 // 优先按照第一个视图排序
if (viewIds && viewIds.length > 0) { let pageIds = []
const ids = collectionView[viewIds[0]].value.page_sort try {
// console.log('PageIds: 从viewId获取', viewIds) if (viewIds && viewIds.length > 0) {
for (const id of ids) { const ids = collectionQuery[collectionId][viewIds[0]]?.collection_group_results?.blockIds
pageIds.push(id) for (const id of ids) {
pageIds.push(id)
}
} }
// 否则按照数据库原始排序 } catch (error) {
} else if (collectionQuery && Object.values(collectionQuery).length > 0) {
}
// 否则按照数据库原始排序
if (pageIds.length === 0 && collectionQuery && Object.values(collectionQuery).length > 0) {
const pageSet = new Set() const pageSet = new Set()
Object.values(collectionQuery[collectionId]).forEach(view => { Object.values(collectionQuery[collectionId]).forEach(view => {
view?.blockIds?.forEach(id => pageSet.add(id)) // group视图 view?.blockIds?.forEach(id => pageSet.add(id)) // group视图