From 51ddb556375fa7191facfaed04138537e9138ee8 Mon Sep 17 00:00:00 2001 From: xichaoyin Date: Wed, 10 Jan 2024 13:38:27 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E7=8E=A9=E5=AE=B6=E9=82=AE=E4=BB=B6?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/fix_patch/patch_20240110.ts | 51 +++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 src/fix_patch/patch_20240110.ts 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();