脚本目录
This commit is contained in:
xcy 2023-12-21 18:16:54 +08:00
parent 5bf5f59bfa
commit 122041f404
9 changed files with 145 additions and 19 deletions

View File

@ -1,8 +1,8 @@
import {ctor} from "./global"; import {ctor} from "../global";
import {initMongoDB} from "./setMongodb"; import {initMongoDB} from "../setMongodb";
import {ReqEmail} from "./monopoly/protocols/PtlEmail"; import {ReqEmail} from "../monopoly/protocols/PtlEmail";
import {MsgEmail} from "./shared/protocols/msg_s2c/MsgEmail"; import {MsgEmail} from "../shared/protocols/msg_s2c/MsgEmail";
import {yangchengmubiao} from "./shared/protocols/event/yangchengmubiao/PtlOpen"; import {yangchengmubiao} from "../shared/protocols/event/yangchengmubiao/PtlOpen";
/** /**

View File

@ -1,5 +1,5 @@
import {ctor} from "./global"; import {ctor} from "../global";
import {initMongoDB} from "./setMongodb"; import {initMongoDB} from "../setMongodb";
async function start() { async function start() {
await initMongoDB() await initMongoDB()

View File

@ -1,6 +1,6 @@
import {ctor} from "./global"; import {ctor} from "../global";
import {initMongoDB} from "./setMongodb"; import {initMongoDB} from "../setMongodb";
import {yangchengmubiao} from "./shared/protocols/event/yangchengmubiao/PtlOpen"; import {yangchengmubiao} from "../shared/protocols/event/yangchengmubiao/PtlOpen";
async function start() { async function start() {
await initMongoDB() await initMongoDB()

View File

@ -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("逻辑执行完成...等待退出!!!");
});

View File

@ -1,5 +1,5 @@
import {initMongoDB} from "./setMongodb"; import {initMongoDB} from "../setMongodb";
import {ctor} from "./global"; import {ctor} from "../global";
async function start() { async function start() {
await initMongoDB(); await initMongoDB();

View File

@ -1,5 +1,5 @@
import {ctor} from './global'; import {ctor} from '../global';
import {initMongoDB} from './setMongodb'; import {initMongoDB} from '../setMongodb';
async function start() { async function start() {
//连接mongodb //连接mongodb

View File

@ -1,5 +1,5 @@
import {ctor} from "./global"; import {ctor} from "../global";
import {initMongoDB} from "./setMongodb"; import {initMongoDB} from "../setMongodb";
async function start() { async function start() {
await initMongoDB() await initMongoDB()

View File

@ -1,6 +1,6 @@
import {ctor} from './global'; import {ctor} from '../global';
import {initMongoDB} from './setMongodb'; import {initMongoDB} from '../setMongodb';
import {initRedis} from './setRedis'; import {initRedis} from '../setRedis';
async function start() { async function start() {
//连接mongodb //连接mongodb