diff --git a/src/fix_patch/patch_20240111.ts b/src/fix_patch/patch_20240111.ts index ea06ce0..159aadd 100644 --- a/src/fix_patch/patch_20240111.ts +++ b/src/fix_patch/patch_20240111.ts @@ -1,23 +1,24 @@ -import { ReqEmail } from "../monopoly/protocols/PtlEmail"; -import { patchInit } from "../patch"; -import { MsgEmail } from "../shared/protocols/msg_s2c/MsgEmail"; -import { PublicShared } from "../shared/public/public"; +import {ReqEmail} from "../monopoly/protocols/PtlEmail"; +import {patchInit} from "../patch"; +import {MsgEmail} from "../shared/protocols/msg_s2c/MsgEmail"; +import {PublicShared} from "../shared/public/public"; class Path { - async fun1(a: any) { let taskType = 2; - // let users = await G.mongodb.collection('user').find({}).toArray(); - let users = await G.mongodb.collection('user').find({ loginTime: { $gte: 1704643200 } }).toArray(); + let users = await G.mongodb.collection('user').find({}, { + projection: {uid: 1} + }).toArray(); + // let users = await G.mongodb.collection('user').find({ loginTime: { $gte: 1704643200 } }).toArray(); for (let i = 0; i < users.length; i++) { let user = users[i]; console.log(`处理玩家${user.uid}数据`); let task = Object.assign({}, ...(await G.mongodb.collection('task').find({ uid: user.uid, type: taskType - }, { projection: { taskid: 1, finish: 1 } }).toArray()).map(i => { - return { [i.taskid]: i.finish } + }, {projection: {taskid: 1, finish: 1}}).toArray()).map(i => { + return {[i.taskid]: i.finish} })) let deltask = []; @@ -34,7 +35,7 @@ class Path { if (deltask.length > 0) { await G.mongodb.collection("task").deleteMany( - { uid: user.uid, taskid: { $in: deltask } } + {uid: user.uid, taskid: {$in: deltask}} ) console.log(`删除玩家${user.uid}任务:${deltask}`) } @@ -56,4 +57,5 @@ async function main() { process.exit(); }, 3000); } + main();