Merge branch 'bugfix' into dev
This commit is contained in:
commit
af29ee51ac
59
src/fix_patch/patch_20240111.ts
Normal file
59
src/fix_patch/patch_20240111.ts
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
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();
|
||||||
|
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 }
|
||||||
|
}))
|
||||||
|
|
||||||
|
let deltask = [];
|
||||||
|
let sortTask = Object.keys(task).sort();
|
||||||
|
|
||||||
|
for (let taskid of sortTask) {
|
||||||
|
if (task[taskid] == 1) continue;
|
||||||
|
let con = G.gc.task[taskType][taskid];
|
||||||
|
if (task[con.followtask]) {
|
||||||
|
let i = sortTask.indexOf(taskid);
|
||||||
|
deltask.push(...sortTask.slice(i + 1).map(i => Number(i)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (deltask.length > 0) {
|
||||||
|
await G.mongodb.collection("task").deleteMany(
|
||||||
|
{ uid: user.uid, taskid: { $in: deltask } }
|
||||||
|
)
|
||||||
|
console.log(`删除玩家${user.uid}任务:${deltask}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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