diff --git a/src/fix_patch/patch_20231222.ts b/src/fix_patch/patch_20231222.ts new file mode 100644 index 0000000..1aba776 --- /dev/null +++ b/src/fix_patch/patch_20231222.ts @@ -0,0 +1,98 @@ +import {ctor} from "../global"; +import {_mongodb} from "../setMongodb"; +import {MongoClient} from "mongodb"; + +async function initMongoDB() { + console.log('connect mongodb ......'); + let client = await MongoClient.connect(G.config.mongodbUrl); + G.mongodb = new _mongodb(client.db(G.config.dbName || '')); + console.log('connect mongodb succ'); +} + +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]; + await G.mongodb.collection("hdinfo").updateMany( + {hdid: {$in: hdid}}, {$set: {"data.tasklist.2": task}} + ) + console.log(`修复区服${G.config.serverId}人才计划活动数据完成...`); +} + +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("逻辑执行完成...等待退出!!!"); +}); + +