diff --git a/src/fix_patch/patch_20240110.ts b/src/fix_patch/patch_20240110.ts new file mode 100644 index 0000000..103ec36 --- /dev/null +++ b/src/fix_patch/patch_20240110.ts @@ -0,0 +1,51 @@ +import { patchInit } from "../patch"; + + +class Path { + + async fun1(a: any) { + let taskType = 2; + let users = await G.mongodb.collection('user').find({ loginTime: { $gte: 1704643200 } }).toArray(); + for (let i = 0; i < users.length; i++) { + let user = users[i]; + let unFinishTask = (await G.mongodb.collection('task').find({ + uid: user.uid, type: taskType, finish: 0 + }, { projection: { taskid: 1 } }).toArray()).map(i => i.taskid); + + if (unFinishTask.length >= 2) { + for (let taskid of unFinishTask) { + let con = G.gc.task[taskType][taskid]; + if (!con) { + await G.mongodb.collection("task").deleteOne({ + uid: user.uid, taskid: taskid + }); + console.log(`删除玩家${user.uid}任务:${taskid}`); + } + if (unFinishTask.includes(con.pretask)) { + await G.mongodb.collection("task").deleteOne({ + uid: user.uid, taskid: taskid + }); + console.log(`删除玩家${user.uid}任务:${taskid}`); + } + } + } + } + } + + + async run() { + await this.fun1(1); + } +} + +async function main() { + await patchInit() + let patch = new Path(); + await patch.run(); + console.log("逻辑执行完成,等待退出"); + setTimeout(function () { + console.log('结束程序'); + process.exit(); + }, 3000); +} +main();