活动刷新脚本
This commit is contained in:
xichaoyin 2024-01-06 17:30:57 +08:00
parent 2d62a387b6
commit 29f7133f10

View File

@ -0,0 +1,98 @@
import { log } from "console";
import { patchFun, patchInit } from "../patch";
import { TanXianFun } from "../public/tanxian";
import { PublicShared } from "../shared/public/public";
class Path {
async fun1(a: any) {
let hd = [{
"hdid": 3001, // 唯一活动id 传说之路
"htype": 3, // 后端唯一识别标识
"stype": 300, // 前端唯一识别标识(看前端需要是否修改)
"ttype": 1, // 0 按照开服时间计算1 玩家注册时间计算 4 屏蔽此活动
"stime": 30, // 活动开始天数
"rtime": 60, // 活动显示结束天数
"etime": 60, // 活动实际结束
"name": "xinfupeiyang",
"icon": "icon_qiridenglu",
"showtime": "仅供参考,会复写正确值",
"data": {
//干部id
hid: '5002',
//任务
task: [
{ idx: 0, total: 80, type: 'lv', prize: [{ a: 'item', t: '1', n: 500000 }], des: 'intr_cszl_des_2' },
{ idx: 1, total: 4, type: 'jieji', prize: [{ a: 'item', t: '12', n: 500 }], des: 'intr_cszl_des_1' },
{ idx: 2, total: 120, type: 'lv', prize: [{ a: 'item', t: '1', n: 500000 }], des: 'intr_cszl_des_2' },
{ idx: 3, total: 5, type: 'jieji', prize: [{ a: 'item', t: '12', n: 1000 }], des: 'intr_cszl_des_1' },
{ idx: 4, total: 160, type: 'lv', prize: [{ a: 'item', t: '1', n: 800000 }], des: 'intr_cszl_des_2' },
{ idx: 5, total: 6, type: 'jieji', prize: [{ a: 'item', t: '12', n: 1500 }], des: 'intr_cszl_des_1' },
{ idx: 6, total: 200, type: 'lv', prize: [{ a: 'item', t: '1', n: 1200000 }], des: 'intr_cszl_des_2' },
{ idx: 7, total: 7, type: 'jieji', prize: [{ a: 'item', t: '12', n: 2000 }], des: 'intr_cszl_des_1' },
{ idx: 8, total: 240, type: 'lv', prize: [{ a: 'item', t: '1', n: 2000000 }], des: 'intr_cszl_des_2' },
{ idx: 9, total: 8, type: 'jieji', prize: [{ a: 'item', t: '5002', n: 20 }], des: 'intr_cszl_des_1' }
],
//宝箱
box: { total: 10, prize: [{ a: 'item', t: '610', n: 1 }] }
}
},
{
"hdid": 3002, // 唯一活动id 传说之路 心腹培养
"htype": 3, // 后端唯一识别标识
"stype": 300, // 前端唯一识别标识(看前端需要是否修改)
"ttype": 1, // 0 按照开服时间计算1 玩家注册时间计算 4 屏蔽此活动
"stime": 60, // 活动开始天数
"rtime": 90, // 活动显示结束天数
"etime": 90, // 活动实际结束
"name": "xinfupeiyang",
"icon": "icon_xfdj",
"showtime": "仅供参考,会复写正确值",
"data": {
//干部id
hid: '5004',
//任务
task: [
{ idx: 0, total: 100, type: 'lv', prize: [{ a: 'item', t: '1', n: 500000 }], des: 'intr_cszl_des_2' },
{ idx: 1, total: 5, type: 'jieji', prize: [{ a: 'item', t: '12', n: 500 }], des: 'intr_cszl_des_1' },
{ idx: 2, total: 140, type: 'lv', prize: [{ a: 'item', t: '1', n: 500000 }], des: 'intr_cszl_des_2' },
{ idx: 3, total: 6, type: 'jieji', prize: [{ a: 'item', t: '12', n: 1000 }], des: 'intr_cszl_des_1' },
{ idx: 4, total: 180, type: 'lv', prize: [{ a: 'item', t: '1', n: 800000 }], des: 'intr_cszl_des_2' },
{ idx: 5, total: 7, type: 'jieji', prize: [{ a: 'item', t: '12', n: 1500 }], des: 'intr_cszl_des_1' },
{ idx: 6, total: 220, type: 'lv', prize: [{ a: 'item', t: '1', n: 1200000 }], des: 'intr_cszl_des_2' },
{ idx: 7, total: 8, type: 'jieji', prize: [{ a: 'item', t: '12', n: 2000 }], des: 'intr_cszl_des_1' },
{ idx: 8, total: 260, type: 'lv', prize: [{ a: 'item', t: '1', n: 2000000 }], des: 'intr_cszl_des_2' },
{ idx: 9, total: 9, type: 'jieji', prize: [{ a: 'item', t: '5004', n: 20 }], des: 'intr_cszl_des_1' }
],
//宝箱
box: { total: 10, prize: [{ a: 'item', t: '610', n: 1 }] }
}
}]
for (let i = 0; i < hd.length; i++) {
G.mongodb.collection('hdinfo').updateOne(
{ hdid: hd[i].hdid }, { $set: { ["data.task"]: hd[i].data.task } }, { upsert: true }
)
}
return "sucess!!!"
}
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();