From 2f9483725db566ebdf65e85d555accda4369b56c Mon Sep 17 00:00:00 2001 From: dy Date: Thu, 21 Dec 2023 14:46:25 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=A4=B4=E5=83=8F=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/patch_player_model_20231221.ts | 33 ++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/patch_player_model_20231221.ts diff --git a/src/patch_player_model_20231221.ts b/src/patch_player_model_20231221.ts new file mode 100644 index 0000000..ceab1a7 --- /dev/null +++ b/src/patch_player_model_20231221.ts @@ -0,0 +1,33 @@ +import {ctor} from "./global"; +import {initMongoDB} from "./setMongodb"; + +async function start() { + await initMongoDB() + + // 刷新活动配置 + console.log(`修复玩家model数据开始...`); + + + await G.mongodb.collection("user").updateMany({},{ + upModel:{id: "1", time: -1}, + model: { + '1': {id: "1", time: -1}, + '2': {id: "2", time: -1} + } + }) + + console.log(`修复玩家model数据完成...`); +} + +ctor(); +start().then(() => { + let s = 0; + setInterval(() => { + s += 1; + console.log(new Date().format("MM-dd hh:mm:ss")); + if (s >= 3) process.exit(1); + }, 1000) + console.log("逻辑执行完成...等待退出!!!"); +}); + + From 85ccd8dd905cf221463623f9efafb145483de018 Mon Sep 17 00:00:00 2001 From: dy Date: Thu, 21 Dec 2023 14:56:30 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E9=80=A0=E5=9E=8B=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/patch_player_model_20231221.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/patch_player_model_20231221.ts b/src/patch_player_model_20231221.ts index ceab1a7..53c60ea 100644 --- a/src/patch_player_model_20231221.ts +++ b/src/patch_player_model_20231221.ts @@ -9,10 +9,12 @@ async function start() { await G.mongodb.collection("user").updateMany({},{ - upModel:{id: "1", time: -1}, - model: { - '1': {id: "1", time: -1}, - '2': {id: "2", time: -1} + $set:{ + upModel:{id: "1", time: -1}, + model: { + '1': {id: "1", time: -1}, + '2': {id: "2", time: -1} + } } }) From b38fc4f21f5ee1e2549c4dbb36875e4776444969 Mon Sep 17 00:00:00 2001 From: dy Date: Thu, 21 Dec 2023 16:10:37 +0800 Subject: [PATCH 3/3] fix use item model --- src/public/user.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/public/user.ts b/src/public/user.ts index a5cb191..55fcd89 100644 --- a/src/public/user.ts +++ b/src/public/user.ts @@ -406,10 +406,10 @@ export class UserFun { if (conf?.cond?.[0] == 'time') { let val = conf.cond[1]; - if (val == -1 && gud.model[conf.id]) { + if (val == -1) { change = true; gud.model[conf.id] = {id: conf.id + '', time: -1}; - } else if (!gud.model[conf.id] || gud.model[conf.id].time < G.time) { + } else if (gud.model[conf.id].time < G.time) { change = true; gud.model[conf.id] = {id: conf.id + '', time: G.time + val * v}; } else {