From 122041f40492bf4d4727fe1b85e6642885d0919d Mon Sep 17 00:00:00 2001 From: xcy <871622040@qq.com> Date: Thu, 21 Dec 2023 18:16:54 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=84=9A=E6=9C=AC=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../patch_20231215.ts} | 10 +- .../patch_20231220.ts} | 4 +- .../patch_20231221.ts} | 6 +- src/fix_patch/patch_20231221_1.ts | 126 ++++++++++++++++++ src/{ => fix_patch}/patch_email_find.ts | 4 +- .../patch_fix_all_user_hero_shiwu.ts | 4 +- .../patch_player_model_20231221.ts | 4 +- .../patch_queryEmail.ts} | 0 .../patch_shop_redis2db.ts} | 6 +- 9 files changed, 145 insertions(+), 19 deletions(-) rename src/{path_20231215.ts => fix_patch/patch_20231215.ts} (99%) rename src/{path_20231220.ts => fix_patch/patch_20231220.ts} (94%) rename src/{path_20231221.ts => fix_patch/patch_20231221.ts} (95%) create mode 100644 src/fix_patch/patch_20231221_1.ts rename src/{ => fix_patch}/patch_email_find.ts (85%) rename src/{ => fix_patch}/patch_fix_all_user_hero_shiwu.ts (96%) rename src/{ => fix_patch}/patch_player_model_20231221.ts (90%) rename src/{queryEmail.ts => fix_patch/patch_queryEmail.ts} (100%) rename src/{path_shop_redis2db.ts => fix_patch/patch_shop_redis2db.ts} (84%) diff --git a/src/path_20231215.ts b/src/fix_patch/patch_20231215.ts similarity index 99% rename from src/path_20231215.ts rename to src/fix_patch/patch_20231215.ts index 297a5b1..0a77b3d 100644 --- a/src/path_20231215.ts +++ b/src/fix_patch/patch_20231215.ts @@ -1,8 +1,8 @@ -import {ctor} from "./global"; -import {initMongoDB} from "./setMongodb"; -import {ReqEmail} from "./monopoly/protocols/PtlEmail"; -import {MsgEmail} from "./shared/protocols/msg_s2c/MsgEmail"; -import {yangchengmubiao} from "./shared/protocols/event/yangchengmubiao/PtlOpen"; +import {ctor} from "../global"; +import {initMongoDB} from "../setMongodb"; +import {ReqEmail} from "../monopoly/protocols/PtlEmail"; +import {MsgEmail} from "../shared/protocols/msg_s2c/MsgEmail"; +import {yangchengmubiao} from "../shared/protocols/event/yangchengmubiao/PtlOpen"; /** diff --git a/src/path_20231220.ts b/src/fix_patch/patch_20231220.ts similarity index 94% rename from src/path_20231220.ts rename to src/fix_patch/patch_20231220.ts index 5649024..7f1681b 100644 --- a/src/path_20231220.ts +++ b/src/fix_patch/patch_20231220.ts @@ -1,5 +1,5 @@ -import {ctor} from "./global"; -import {initMongoDB} from "./setMongodb"; +import {ctor} from "../global"; +import {initMongoDB} from "../setMongodb"; async function start() { await initMongoDB() diff --git a/src/path_20231221.ts b/src/fix_patch/patch_20231221.ts similarity index 95% rename from src/path_20231221.ts rename to src/fix_patch/patch_20231221.ts index 11098b7..8028e1f 100644 --- a/src/path_20231221.ts +++ b/src/fix_patch/patch_20231221.ts @@ -1,6 +1,6 @@ -import {ctor} from "./global"; -import {initMongoDB} from "./setMongodb"; -import {yangchengmubiao} from "./shared/protocols/event/yangchengmubiao/PtlOpen"; +import {ctor} from "../global"; +import {initMongoDB} from "../setMongodb"; +import {yangchengmubiao} from "../shared/protocols/event/yangchengmubiao/PtlOpen"; async function start() { await initMongoDB() diff --git a/src/fix_patch/patch_20231221_1.ts b/src/fix_patch/patch_20231221_1.ts new file mode 100644 index 0000000..1f31185 --- /dev/null +++ b/src/fix_patch/patch_20231221_1.ts @@ -0,0 +1,126 @@ +import {ctor} from "../global"; +import {initMongoDB} from "../setMongodb"; +import {yangchengmubiao} from "../shared/protocols/event/yangchengmubiao/PtlOpen"; +import {number} from "mathjs"; +import {PublicShared} from "../shared/public/public"; + +async function start() { + await initMongoDB() + + const task = { + '2001': { + 'prize': [{'a': 'item', 't': '4', 'n': 5}, {'a': 'item', 't': '626', 'n': 10}], + 'tujing': '', + 'title': 'intr_yczm_day_des_2', + 'type': 2, + 'pval': 50, + 'cond': [], + 'stype': 118 + }, + '2002': { + 'prize': [{'a': 'item', 't': '4', 'n': 5}, {'a': 'item', 't': '626', 'n': 10}], + 'tujing': '', + 'title': 'intr_yczm_day_des_2', + 'type': 2, + 'pval': 100, + 'cond': [], + 'stype': 118 + }, + '2003': { + 'prize': [{'a': 'item', 't': '4', 'n': 10}, {'a': 'item', 't': '626', 'n': 20}], + 'tujing': '', + 'title': 'intr_yczm_day_des_2', + 'type': 2, + 'pval': 200, + 'cond': [], + 'stype': 118 + }, + '2004': { + 'prize': [{'a': 'item', 't': '4', 'n': 10}, {'a': 'item', 't': '600', 'n': 20}], + 'tujing': '', + 'title': 'intr_yczm_day_des_2', + 'type': 2, + 'pval': 250, + 'cond': [], + 'stype': 118 + }, + '2005': { + 'prize': [{'a': 'item', 't': '4', 'n': 10}, {'a': 'item', 't': '600', 'n': 20}], + 'tujing': '', + 'title': 'intr_yczm_day_des_2', + 'type': 2, + 'pval': 300, + 'cond': [], + 'stype': 118 + }, + '2006': { + 'prize': [{'a': 'item', 't': '4', 'n': 10}, {'a': 'item', 't': '619', 'n': 1}], + 'tujing': '', + 'title': 'intr_yczm_day_des_2', + 'type': 2, + 'pval': 400, + 'cond': [], + 'stype': 118 + }, + '2007': { + 'prize': [{'a': 'item', 't': '4', 'n': 10}, {'a': 'item', 't': '619', 'n': 1}], + 'tujing': '', + 'title': 'intr_yczm_day_des_2', + 'type': 2, + 'pval': 500, + 'cond': [], + 'stype': 118 + } + }; + let hdid = [100, 101]; + let openday = PublicShared.getOpenServerDay(); + let openhdlist = await G.mongodb.collection("hdinfo").find( + {hdid: {$in: hdid}, stime: {$lte: openday}, etime: {$gte: openday}} + ).toArray(); + + // 没有开启的活动 返回 + if (openhdlist.length <= 0) { + return; + } else { + hdid = openhdlist.map(hd => hd.hdid); + } + + let datas: yangchengmubiao[]; + datas = await G.mongodb.cEvent(`yangchengmubiao${hdid[0]}`).find( + {type: `yangchengmubiao${hdid[0]}`} + ).toArray(); + + for (let i = 0; i < datas.length; i++) { + let data = datas[i]; + let finishid = new Set(data.finishid["2"]); + // 查找任务未完成 但设置了领奖标识 + for (let taskid in task) { + let con = task[taskid]; + let taskval = data.taskval || {}; + if (finishid.has(number(taskid)) && (taskval[taskid] || 0) < con.pval) { + finishid.delete(number(taskid)); + } + } + // 没有删除的 + if (finishid.size == data.finishid["2"].length) { + continue + } + await G.mongodb.collection("event").updateOne( + {"uid": data.uid, "type": data.type}, {$set: {"finishid.2": [...finishid]}} + ) + console.log(`修复玩家${data.uid}人才计划${data.type}数据完成...`); + } +} + +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("逻辑执行完成...等待退出!!!"); +}); + + diff --git a/src/patch_email_find.ts b/src/fix_patch/patch_email_find.ts similarity index 85% rename from src/patch_email_find.ts rename to src/fix_patch/patch_email_find.ts index 140648d..900687a 100644 --- a/src/patch_email_find.ts +++ b/src/fix_patch/patch_email_find.ts @@ -1,5 +1,5 @@ -import {initMongoDB} from "./setMongodb"; -import {ctor} from "./global"; +import {initMongoDB} from "../setMongodb"; +import {ctor} from "../global"; async function start() { await initMongoDB(); diff --git a/src/patch_fix_all_user_hero_shiwu.ts b/src/fix_patch/patch_fix_all_user_hero_shiwu.ts similarity index 96% rename from src/patch_fix_all_user_hero_shiwu.ts rename to src/fix_patch/patch_fix_all_user_hero_shiwu.ts index 31c8032..6bcea4d 100644 --- a/src/patch_fix_all_user_hero_shiwu.ts +++ b/src/fix_patch/patch_fix_all_user_hero_shiwu.ts @@ -1,5 +1,5 @@ -import {ctor} from './global'; -import {initMongoDB} from './setMongodb'; +import {ctor} from '../global'; +import {initMongoDB} from '../setMongodb'; async function start() { //连接mongodb diff --git a/src/patch_player_model_20231221.ts b/src/fix_patch/patch_player_model_20231221.ts similarity index 90% rename from src/patch_player_model_20231221.ts rename to src/fix_patch/patch_player_model_20231221.ts index 53c60ea..063eab9 100644 --- a/src/patch_player_model_20231221.ts +++ b/src/fix_patch/patch_player_model_20231221.ts @@ -1,5 +1,5 @@ -import {ctor} from "./global"; -import {initMongoDB} from "./setMongodb"; +import {ctor} from "../global"; +import {initMongoDB} from "../setMongodb"; async function start() { await initMongoDB() diff --git a/src/queryEmail.ts b/src/fix_patch/patch_queryEmail.ts similarity index 100% rename from src/queryEmail.ts rename to src/fix_patch/patch_queryEmail.ts diff --git a/src/path_shop_redis2db.ts b/src/fix_patch/patch_shop_redis2db.ts similarity index 84% rename from src/path_shop_redis2db.ts rename to src/fix_patch/patch_shop_redis2db.ts index ab437f2..a3736d5 100644 --- a/src/path_shop_redis2db.ts +++ b/src/fix_patch/patch_shop_redis2db.ts @@ -1,6 +1,6 @@ -import {ctor} from './global'; -import {initMongoDB} from './setMongodb'; -import {initRedis} from './setRedis'; +import {ctor} from '../global'; +import {initMongoDB} from '../setMongodb'; +import {initRedis} from '../setRedis'; async function start() { //连接mongodb