Merge branch 'bugfix' of http://git.legu.cc/qixin/HJ_Server into bugfix
This commit is contained in:
commit
d8a47e85b2
51
src/fix_patch/patch_20240110.ts
Normal file
51
src/fix_patch/patch_20240110.ts
Normal file
@ -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();
|
Loading…
Reference in New Issue
Block a user