core: change domain.union to namespaces

This commit is contained in:
undefined committed 2024-10-07 23:15:06 +08:00
1 parent 4b7a080de7
commit 89188d1598
7 files changed
+46 -90

No files matched your search

+1 -3
View File
@@ -136,14 +136,12 @@ export async function calcLevel(domainId: string, report: Function) {
}
async function runInDomain(domainId: string, report: Function) {
const info = await domain.get(domainId);
const domainIds = [domainId, ...(info.union || [])];
const results: Record<keyof typeof RpTypes, ND> = {};
const udict = Counter();
await db.collection('domain.user').updateMany({ domainId }, { $set: { rpInfo: {} } });
for (const type in RpTypes) {
results[type] = new Proxy({}, { get: (self, key) => self[key] || RpTypes[type].base });
await RpTypes[type].run(domainIds, results[type], report);
await RpTypes[type].run([domainId], results[type], report);
const bulk = db.collection('domain.user').initializeUnorderedBulkOp();
for (const uid in results[type]) {
const udoc = await UserModel.getById(domainId, +uid);