Merge branch 'bugfix' of http://git.legu.cc/qixin/HJ_Server into bugfix
This commit is contained in:
commit
f1963d2e53
@ -24,7 +24,10 @@ export default async function (call: ApiCall<ReqOpen, ResOpen>) {
|
|||||||
await PayFun.delPayLog(
|
await PayFun.delPayLog(
|
||||||
call.uid, { payId: G.gc.zhanling.payId, val: [] }
|
call.uid, { payId: G.gc.zhanling.payId, val: [] }
|
||||||
);
|
);
|
||||||
|
// 战令重置的时候需要删除所有的任务进度,但是每天的任务进度不做处理,因为每天会自然重置,怕玩家会刷
|
||||||
|
// ZhanLingTasks.clearLog(call.uid, 'day');
|
||||||
|
ZhanLingTasks.clearLog(call.uid, 'week');
|
||||||
|
ZhanLingTasks.clearLog(call.uid, 'round');
|
||||||
data = (await G.mongodb.cEvent('zhanling').findOneAndUpdate({
|
data = (await G.mongodb.cEvent('zhanling').findOneAndUpdate({
|
||||||
uid: call.uid,
|
uid: call.uid,
|
||||||
type: 'zhanling'
|
type: 'zhanling'
|
||||||
|
119
src/fix_patch/patch_20240109-1.ts
Normal file
119
src/fix_patch/patch_20240109-1.ts
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
import { patchFun, patchInit } from "../patch";
|
||||||
|
import { PublicShared } from "../shared/public/public";
|
||||||
|
import { JJCFun } from "../public/jjc";
|
||||||
|
|
||||||
|
function getRankPrize(rank: number, conf?: typeof G.gc.jjc_ph['']) {
|
||||||
|
if (!conf) {
|
||||||
|
conf = Object.values(G.gc.jjc_ph).filter(v => rank >= v.ph[0] && rank <= v.ph[1])[0];
|
||||||
|
}
|
||||||
|
if (conf) {
|
||||||
|
return [...conf.prize, { a: 'item', t: '11', n: typeof conf.rongyuprize == 'number' ? conf.rongyuprize : PublicShared.eval(conf.rongyuprize, { a: rank }) }];
|
||||||
|
} else {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Path {
|
||||||
|
|
||||||
|
async addEmail(email, isCross = false) {
|
||||||
|
let { prize, uid, ...e } = email;
|
||||||
|
let lng = await G.redis.rawGet(`user:lng:${uid}`);
|
||||||
|
let sendEmail = {
|
||||||
|
_id: null,
|
||||||
|
uid: uid,
|
||||||
|
type: e.type,
|
||||||
|
title: e.lngTitle ? (e.lngTitle[lng] || e.lngTitle['ja']) : e.title,
|
||||||
|
content: e.lngContent ? (e.lngContent[lng] || e.lngContent['ja']) : e.content,
|
||||||
|
createTime: e.createTime || G.time,
|
||||||
|
contentInsertArr: e.contentInsertArr || []
|
||||||
|
} as any;
|
||||||
|
|
||||||
|
/**跨服邮件给sid标识*/
|
||||||
|
// if (isCross) {
|
||||||
|
// sendEmail.sid = uid.split('_')[0];
|
||||||
|
// }
|
||||||
|
if ((prize === null || prize === void 0 ? void 0 : prize.length) > 0) {
|
||||||
|
sendEmail.prizeData = {
|
||||||
|
prize: email.prize,
|
||||||
|
isGet: false
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if (email.g123log && Object.keys(email.g123log).length > 0)
|
||||||
|
sendEmail.g123log = email.g123log;
|
||||||
|
|
||||||
|
if (email.lngTitle) {
|
||||||
|
sendEmail.lngTitle = email.lngTitle;
|
||||||
|
sendEmail.lngContent = email.lngContent;
|
||||||
|
}
|
||||||
|
//太亏了!换其他清理机制,getAllEmail是性能消耗大户
|
||||||
|
//todo.. 换其他清理机制
|
||||||
|
// if (!isCross) {
|
||||||
|
// let emailList = await this.getAllEmail(uid);
|
||||||
|
// if (emailList.length >= 50) {
|
||||||
|
// emailList.sort((a, b) => {
|
||||||
|
// let noPrizeA = a.prizeData == undefined ? 0 : 1;
|
||||||
|
// let noPrizeB = b.prizeData == undefined ? 0 : 1;
|
||||||
|
// let getA = a.prizeData?.isGet == true ? 0 : 1;
|
||||||
|
// let getB = b.prizeData?.isGet == true ? 0 : 1;
|
||||||
|
// if (noPrizeA != noPrizeB) {
|
||||||
|
// return noPrizeA - noPrizeB;
|
||||||
|
// } else if (getA != getB) {
|
||||||
|
// return getA - getB;
|
||||||
|
// }
|
||||||
|
// return a.createTime - b.createTime;
|
||||||
|
// });
|
||||||
|
// this.removeEmail(uid, emailList[0]._id);
|
||||||
|
// G.server.sendMsgByUid(uid, 'msg_s2c/EmailDel', emailList[0]._id);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//@ts-ignore
|
||||||
|
await G.mongodb.collection('email').insertOne({
|
||||||
|
ttl: new Date(), ...G.mongodb.conversionIdObj(sendEmail)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
async sendEmail(uid: string, rank: number, prize: atn[]) {
|
||||||
|
|
||||||
|
if (uid.indexOf('npc_') != -1) return;
|
||||||
|
|
||||||
|
await this.addEmail({
|
||||||
|
uid: uid,
|
||||||
|
type: 'system',
|
||||||
|
title: G.gc.jjc_com.email.titel,
|
||||||
|
content: G.gc.jjc_com.email.content,
|
||||||
|
prize: prize,
|
||||||
|
contentInsertArr: [rank]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
async fun1(a: any) {
|
||||||
|
for (let conf of Object.values(G.gc.jjc_ph)) {
|
||||||
|
let players = await JJCFun.getRankListUid(conf.ph[0] - 1, conf.ph[1]);
|
||||||
|
|
||||||
|
for (let index = 0; index < players.length; index++) {
|
||||||
|
let uid = players[index];
|
||||||
|
await this.sendEmail(uid, conf.ph[0] + index, getRankPrize(conf.ph[0] + index, conf));
|
||||||
|
console.log("sendEmail", uid, conf.ph[0] + index)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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();
|
684
src/fix_patch/patch_20240109.ts
Normal file
684
src/fix_patch/patch_20240109.ts
Normal file
@ -0,0 +1,684 @@
|
|||||||
|
import { patchFun, patchInit } from "../patch";
|
||||||
|
|
||||||
|
class Path {
|
||||||
|
|
||||||
|
async fun1(a: any) {
|
||||||
|
const con = {
|
||||||
|
"16_6575db20f6ef8b7da5c8f1fd": {
|
||||||
|
"item": {
|
||||||
|
"1": 55400000,
|
||||||
|
"12": 10600,
|
||||||
|
"2": 223000,
|
||||||
|
"6": 690
|
||||||
|
},
|
||||||
|
"attr": {
|
||||||
|
"rmbmoney": 30500,
|
||||||
|
"jinbi": 2850000000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"15_6575a14b2f930bd5e51ccde9": {
|
||||||
|
"item": {
|
||||||
|
"1": 137200000,
|
||||||
|
"12": 16600,
|
||||||
|
"2": 273700,
|
||||||
|
"6": 1735
|
||||||
|
},
|
||||||
|
"attr": {
|
||||||
|
"rmbmoney": 35200,
|
||||||
|
"jinbi": 3420000000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"10_6573c51480a92f081d78e1d9": {
|
||||||
|
"item": {
|
||||||
|
"1": 35600000,
|
||||||
|
"12": 13000,
|
||||||
|
"2": 67800,
|
||||||
|
"6": 1180
|
||||||
|
},
|
||||||
|
"attr": {
|
||||||
|
"rmbmoney": 12400,
|
||||||
|
"jinbi": 630000000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"10_6573ecd9a884822d24482a1a": {
|
||||||
|
"item": {
|
||||||
|
"1": 103200000,
|
||||||
|
"18": 9490,
|
||||||
|
"12": 28000,
|
||||||
|
"2": 421600,
|
||||||
|
"6": 1300
|
||||||
|
},
|
||||||
|
"attr": {
|
||||||
|
"rmbmoney": 53400,
|
||||||
|
"jinbi": 5210000000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"11_657412487fe3541fe7241a60": {
|
||||||
|
"item": {
|
||||||
|
"1": 35000000,
|
||||||
|
"12": 99300,
|
||||||
|
"2": 110900,
|
||||||
|
"6": 460
|
||||||
|
},
|
||||||
|
"attr": {
|
||||||
|
"rmbmoney": 19200,
|
||||||
|
"jinbi": 1830000000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"11_657436eb3bc021c4e335f356": {
|
||||||
|
"item": {
|
||||||
|
"1": 197200000,
|
||||||
|
"12": 243700,
|
||||||
|
"2": 597200,
|
||||||
|
"6": 2475
|
||||||
|
},
|
||||||
|
"attr": {
|
||||||
|
"rmbmoney": 97400,
|
||||||
|
"jinbi": 9930000000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"11_657428e87fe3541fe7245b75": {
|
||||||
|
"item": {
|
||||||
|
"1": 71200000,
|
||||||
|
"12": 64300,
|
||||||
|
"2": 219300,
|
||||||
|
"6": 910
|
||||||
|
},
|
||||||
|
"attr": {
|
||||||
|
"rmbmoney": 37300,
|
||||||
|
"jinbi": 3630000000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"10_6573aeb2602e0a72e8279b54": {
|
||||||
|
"item": {
|
||||||
|
"1": 17800000,
|
||||||
|
"12": 22300,
|
||||||
|
"2": 58100,
|
||||||
|
"6": 240
|
||||||
|
},
|
||||||
|
"attr": {
|
||||||
|
"rmbmoney": 10500,
|
||||||
|
"jinbi": 940000000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"11_657447453bc021c4e3362403": {
|
||||||
|
"item": {
|
||||||
|
"1": 322000000,
|
||||||
|
"18": 31290,
|
||||||
|
"12": 134800,
|
||||||
|
"2": 1297200,
|
||||||
|
"6": 4035
|
||||||
|
},
|
||||||
|
"attr": {
|
||||||
|
"rmbmoney": 162900,
|
||||||
|
"jinbi": 16160000000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"11_657405957b27be6c2f4cac11": {
|
||||||
|
"item": {
|
||||||
|
"1": 18600000,
|
||||||
|
"18": 1050,
|
||||||
|
"12": 74500,
|
||||||
|
"2": 79900,
|
||||||
|
"6": 245
|
||||||
|
},
|
||||||
|
"attr": {
|
||||||
|
"rmbmoney": 12000,
|
||||||
|
"jinbi": 980000000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"14_6575004f7aecd430eb86fbb5": {
|
||||||
|
"item": {
|
||||||
|
"1": 44000000,
|
||||||
|
"18": 3440,
|
||||||
|
"12": 104800,
|
||||||
|
"2": 182600,
|
||||||
|
"6": 545
|
||||||
|
},
|
||||||
|
"attr": {
|
||||||
|
"rmbmoney": 25300,
|
||||||
|
"jinbi": 2270000000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"16_6575d6ac2e4ba33a00a04cbc": {
|
||||||
|
"item": {
|
||||||
|
"1": 36600000,
|
||||||
|
"12": 13000,
|
||||||
|
"2": 108200,
|
||||||
|
"6": 470
|
||||||
|
},
|
||||||
|
"attr": {
|
||||||
|
"rmbmoney": 19100,
|
||||||
|
"jinbi": 1870000000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"12_6574823b27bd4264da470583": {
|
||||||
|
"item": {
|
||||||
|
"1": 8800000,
|
||||||
|
"12": 123000,
|
||||||
|
"2": 37500,
|
||||||
|
"6": 115
|
||||||
|
},
|
||||||
|
"attr": {
|
||||||
|
"rmbmoney": 7300,
|
||||||
|
"jinbi": 530000000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"16_6575b61caff1b610d8bc6c96": {
|
||||||
|
"item": {
|
||||||
|
"24": 6,
|
||||||
|
"10": 200,
|
||||||
|
"12": 55000,
|
||||||
|
"600": 20,
|
||||||
|
"18": 1400,
|
||||||
|
"1": 16200000,
|
||||||
|
"2": 64900,
|
||||||
|
"6": 180,
|
||||||
|
"9": 3500
|
||||||
|
},
|
||||||
|
"attr": {
|
||||||
|
"rmbmoney": 14400,
|
||||||
|
"jinbi": 840000000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"14_6574f2e66c7af0fe3713b718": {
|
||||||
|
"item": {
|
||||||
|
"1": 48800000,
|
||||||
|
"12": 12700,
|
||||||
|
"2": 90900,
|
||||||
|
"6": 655
|
||||||
|
},
|
||||||
|
"attr": {
|
||||||
|
"rmbmoney": 12400,
|
||||||
|
"jinbi": 1100000000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"11_65740da4deb68620911e96ef": {
|
||||||
|
"item": {
|
||||||
|
"1": 64200000,
|
||||||
|
"18": 5580,
|
||||||
|
"12": 28300,
|
||||||
|
"2": 265400,
|
||||||
|
"6": 820
|
||||||
|
},
|
||||||
|
"attr": {
|
||||||
|
"rmbmoney": 33800,
|
||||||
|
"jinbi": 3270000000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"15_657594c3a7981612a8ea7e0e": {
|
||||||
|
"item": {
|
||||||
|
"1": 96800000,
|
||||||
|
"18": 8870,
|
||||||
|
"12": 3700,
|
||||||
|
"2": 397200,
|
||||||
|
"6": 1230
|
||||||
|
},
|
||||||
|
"attr": {
|
||||||
|
"rmbmoney": 50400,
|
||||||
|
"jinbi": 4920000000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"11_657434f8290f4393568f16fe": {
|
||||||
|
"item": {
|
||||||
|
"1": 129000000,
|
||||||
|
"12": 198300,
|
||||||
|
"2": 392100,
|
||||||
|
"6": 1630
|
||||||
|
},
|
||||||
|
"attr": {
|
||||||
|
"jinbi": 6500000000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"14_657512ee7aecd430eb872b5d": {
|
||||||
|
"item": {
|
||||||
|
"1": 121800000,
|
||||||
|
"12": 36400,
|
||||||
|
"2": 363400,
|
||||||
|
"6": 1530
|
||||||
|
},
|
||||||
|
"attr": {
|
||||||
|
"rmbmoney": 31500,
|
||||||
|
"jinbi": 6150000000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"11_657454089beef4c060edab88": {
|
||||||
|
"item": {
|
||||||
|
"1": 96600000,
|
||||||
|
"18": 8660,
|
||||||
|
"12": 149200,
|
||||||
|
"2": 392900,
|
||||||
|
"6": 1215
|
||||||
|
},
|
||||||
|
"attr": {
|
||||||
|
"rmbmoney": 49800,
|
||||||
|
"jinbi": 4890000000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"10_6573e8aa80a92f081d7930b4": {
|
||||||
|
"item": {
|
||||||
|
"1": 242400000,
|
||||||
|
"18": 16210,
|
||||||
|
"12": 84100,
|
||||||
|
"2": 978800,
|
||||||
|
"6": 3040
|
||||||
|
},
|
||||||
|
"attr": {
|
||||||
|
"rmbmoney": 123100,
|
||||||
|
"jinbi": 12180000000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"11_6573fd7a08e89e5a6859446e": {
|
||||||
|
"item": {
|
||||||
|
"1": 178200000,
|
||||||
|
"18": 16230,
|
||||||
|
"12": 10900,
|
||||||
|
"2": 717000,
|
||||||
|
"6": 2225
|
||||||
|
},
|
||||||
|
"attr": {
|
||||||
|
"rmbmoney": 92000,
|
||||||
|
"jinbi": 8990000000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"11_65744fe2d0256beb85eed193": {
|
||||||
|
"item": {
|
||||||
|
"1": 262800000,
|
||||||
|
"18": 25540,
|
||||||
|
"12": 55800,
|
||||||
|
"2": 1057600,
|
||||||
|
"6": 3275
|
||||||
|
},
|
||||||
|
"attr": {
|
||||||
|
"rmbmoney": 134000,
|
||||||
|
"jinbi": 13190000000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"11_657440e7ee44bd9935bbbd7c": {
|
||||||
|
"item": {
|
||||||
|
"1": 83000000,
|
||||||
|
"18": 7160,
|
||||||
|
"12": 250900,
|
||||||
|
"2": 341800,
|
||||||
|
"6": 1055
|
||||||
|
},
|
||||||
|
"attr": {
|
||||||
|
"rmbmoney": 43300,
|
||||||
|
"jinbi": 4220000000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"11_657420932dd070117eb15e92": {
|
||||||
|
"item": {
|
||||||
|
"1": 307400000,
|
||||||
|
"18": 29210,
|
||||||
|
"12": 50200,
|
||||||
|
"2": 1239200,
|
||||||
|
"6": 3880
|
||||||
|
},
|
||||||
|
"attr": {
|
||||||
|
"jinbi": 15470000000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"14_65750da36439ef15582d6e6d": {
|
||||||
|
"item": {
|
||||||
|
"1": 105000000,
|
||||||
|
"12": 93900,
|
||||||
|
"2": 361000,
|
||||||
|
"6": 1335
|
||||||
|
},
|
||||||
|
"attr": {
|
||||||
|
"rmbmoney": 54100,
|
||||||
|
"jinbi": 5310000000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"12_6574762427bd4264da46ce63": {
|
||||||
|
"item": {
|
||||||
|
"1": 44400000,
|
||||||
|
"18": 3390,
|
||||||
|
"12": 15900,
|
||||||
|
"2": 185000,
|
||||||
|
"6": 555
|
||||||
|
},
|
||||||
|
"attr": {
|
||||||
|
"rmbmoney": 25000,
|
||||||
|
"jinbi": 2290000000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"16_6575e1625685671e63fe001f": {
|
||||||
|
"item": {
|
||||||
|
"1": 12600000,
|
||||||
|
"2": 51400,
|
||||||
|
"6": 155
|
||||||
|
},
|
||||||
|
"attr": {
|
||||||
|
"rmbmoney": 9200,
|
||||||
|
"jinbi": 710000000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"10_6573e236a884822d244816a0": {
|
||||||
|
"item": {
|
||||||
|
"1": 76200000,
|
||||||
|
"18": 6760,
|
||||||
|
"12": 79600,
|
||||||
|
"2": 310200,
|
||||||
|
"6": 945
|
||||||
|
},
|
||||||
|
"attr": {
|
||||||
|
"rmbmoney": 40700,
|
||||||
|
"jinbi": 3870000000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"10_6573a17268053554fe606611": {
|
||||||
|
"item": {
|
||||||
|
"1": 109200000,
|
||||||
|
"18": 9410,
|
||||||
|
"12": 58000,
|
||||||
|
"2": 428000,
|
||||||
|
"6": 2365
|
||||||
|
},
|
||||||
|
"attr": {
|
||||||
|
"rmbmoney": 55000,
|
||||||
|
"jinbi": 5240000000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"15_657595a3a7981612a8ea8009": {
|
||||||
|
"item": {
|
||||||
|
"1": 19200000,
|
||||||
|
"18": 830,
|
||||||
|
"12": 74800,
|
||||||
|
"2": 84100,
|
||||||
|
"6": 1115
|
||||||
|
},
|
||||||
|
"attr": {
|
||||||
|
"rmbmoney": 11300,
|
||||||
|
"jinbi": 990000000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"11_657438a83bc021c4e335f86e": {
|
||||||
|
"item": {
|
||||||
|
"1": 71200000,
|
||||||
|
"18": 6300,
|
||||||
|
"12": 55600,
|
||||||
|
"2": 292500,
|
||||||
|
"6": 905
|
||||||
|
},
|
||||||
|
"attr": {
|
||||||
|
"rmbmoney": 37200,
|
||||||
|
"jinbi": 3600000000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"10_6573e0395fe4caaf29a9b83c": {
|
||||||
|
"item": {
|
||||||
|
"1": 9000000,
|
||||||
|
"12": 184000,
|
||||||
|
"2": 45800,
|
||||||
|
"6": 135
|
||||||
|
},
|
||||||
|
"attr": {
|
||||||
|
"rmbmoney": 6400,
|
||||||
|
"jinbi": 530000000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"10_6573e596dc05fa03150d7db1": {
|
||||||
|
"item": {
|
||||||
|
"1": 12800000,
|
||||||
|
"18": 410,
|
||||||
|
"12": 15400,
|
||||||
|
"2": 60000,
|
||||||
|
"6": 175
|
||||||
|
},
|
||||||
|
"attr": {
|
||||||
|
"rmbmoney": 8200,
|
||||||
|
"jinbi": 690000000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"14_65752c79c85dd4cf1a874893": {
|
||||||
|
"item": {
|
||||||
|
"1": 14200000,
|
||||||
|
"12": 33700,
|
||||||
|
"2": 64500,
|
||||||
|
"6": 185
|
||||||
|
},
|
||||||
|
"attr": {
|
||||||
|
"rmbmoney": 8900,
|
||||||
|
"jinbi": 790000000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"12_657455ed6b804f4a6d4b53a2": {
|
||||||
|
"item": {
|
||||||
|
"1": 160800000,
|
||||||
|
"18": 14900,
|
||||||
|
"12": 4800,
|
||||||
|
"2": 650900,
|
||||||
|
"6": 2025
|
||||||
|
},
|
||||||
|
"attr": {
|
||||||
|
"rmbmoney": 82000,
|
||||||
|
"jinbi": 8080000000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"12_657481316ad7b8861da8a914": {
|
||||||
|
"item": {
|
||||||
|
"1": 5600000,
|
||||||
|
"18": 450,
|
||||||
|
"12": 34600,
|
||||||
|
"2": 25500,
|
||||||
|
"6": 65
|
||||||
|
},
|
||||||
|
"attr": {
|
||||||
|
"rmbmoney": 7800,
|
||||||
|
"jinbi": 300000000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"4_6571c11bb0b5337a4d3a63a0": {
|
||||||
|
"item": {
|
||||||
|
"24": 7,
|
||||||
|
"10": 400,
|
||||||
|
"12": 15600,
|
||||||
|
"600": 50,
|
||||||
|
"18": 190,
|
||||||
|
"1": 5200000,
|
||||||
|
"2": 16300,
|
||||||
|
"6": 10,
|
||||||
|
"9": 8500
|
||||||
|
},
|
||||||
|
"attr": {
|
||||||
|
"rmbmoney": 8800,
|
||||||
|
"jinbi": 310000000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"10_6573714bc7069a58e96ba077": {
|
||||||
|
"item": {
|
||||||
|
"1": 14400000,
|
||||||
|
"18": 610,
|
||||||
|
"12": 11800,
|
||||||
|
"2": 66400,
|
||||||
|
"6": 190
|
||||||
|
},
|
||||||
|
"attr": {
|
||||||
|
"rmbmoney": 9000,
|
||||||
|
"jinbi": 770000000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"11_65744ba29beef4c060ed803c": {
|
||||||
|
"item": {
|
||||||
|
"1": 331800000,
|
||||||
|
"12": 14800,
|
||||||
|
"2": 1001400,
|
||||||
|
"6": 4155
|
||||||
|
},
|
||||||
|
"attr": {
|
||||||
|
"rmbmoney": 167500,
|
||||||
|
"jinbi": 16670000000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"16_6575d57c5685671e63fdb6ee": {
|
||||||
|
"item": {
|
||||||
|
"1": 13600000,
|
||||||
|
"12": 42700,
|
||||||
|
"2": 44500,
|
||||||
|
"6": 420
|
||||||
|
},
|
||||||
|
"attr": {
|
||||||
|
"rmbmoney": 7000,
|
||||||
|
"jinbi": 430000000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"11_65743bb09beef4c060ed46e7": {
|
||||||
|
"item": {
|
||||||
|
"10": 300,
|
||||||
|
"12": 8100,
|
||||||
|
"600": 30,
|
||||||
|
"18": 920,
|
||||||
|
"1": 18400000,
|
||||||
|
"2": 69600,
|
||||||
|
"6": 170,
|
||||||
|
"9": 4500
|
||||||
|
},
|
||||||
|
"attr": {
|
||||||
|
"rmbmoney": 13700,
|
||||||
|
"jinbi": 950000000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"10_6573bb4b68053554fe60940c": {
|
||||||
|
"item": {
|
||||||
|
"1": 19400000,
|
||||||
|
"18": 1080,
|
||||||
|
"12": 63000,
|
||||||
|
"2": 83100,
|
||||||
|
"6": 235
|
||||||
|
},
|
||||||
|
"attr": {
|
||||||
|
"rmbmoney": 12300,
|
||||||
|
"jinbi": 1010000000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"16_6575d97df2211cd2ff29ba12": {
|
||||||
|
"item": {
|
||||||
|
"1": 3400000,
|
||||||
|
"12": 11100,
|
||||||
|
"2": 16700,
|
||||||
|
"6": 50
|
||||||
|
},
|
||||||
|
"attr": {
|
||||||
|
"rmbmoney": 5000,
|
||||||
|
"jinbi": 250000000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"11_657434c6d0256beb85ee6fae": {
|
||||||
|
"item": {
|
||||||
|
"1": 80600000,
|
||||||
|
"18": 7360,
|
||||||
|
"12": 232000,
|
||||||
|
"2": 332200,
|
||||||
|
"6": 1025
|
||||||
|
},
|
||||||
|
"attr": {
|
||||||
|
"rmbmoney": 42100,
|
||||||
|
"jinbi": 4090000000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"16_6575b6d0f6ef8b7da5c84bf0": {
|
||||||
|
"item": {
|
||||||
|
"1": 70600000,
|
||||||
|
"12": 29700,
|
||||||
|
"2": 218200,
|
||||||
|
"6": 900
|
||||||
|
},
|
||||||
|
"attr": {
|
||||||
|
"rmbmoney": 36000,
|
||||||
|
"jinbi": 3610000000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"10_6587fbf00c11d852663c5bbb": {
|
||||||
|
"item": {
|
||||||
|
"1": 26800000,
|
||||||
|
"18": 1940,
|
||||||
|
"12": 168000,
|
||||||
|
"2": 118300,
|
||||||
|
"6": 350
|
||||||
|
},
|
||||||
|
"attr": {
|
||||||
|
"rmbmoney": 15300,
|
||||||
|
"jinbi": 1410000000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"10_657397c2f31ed0c046ef3730": {
|
||||||
|
"item": {
|
||||||
|
"1": 220800000,
|
||||||
|
"18": 1900,
|
||||||
|
"12": 8800,
|
||||||
|
"2": 701400,
|
||||||
|
"6": 2780
|
||||||
|
},
|
||||||
|
"attr": {
|
||||||
|
"rmbmoney": 112100,
|
||||||
|
"jinbi": 11100000000
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const uids = Object.keys(con);
|
||||||
|
let _users = await G.mongodb.find('user', { uid: { $in: uids } })
|
||||||
|
for (let i = 0; i < _users.length; i++) {
|
||||||
|
let user = _users[i]
|
||||||
|
const uid = user.uid
|
||||||
|
const _delattr = con[uid]["attr"]
|
||||||
|
const _delitem = con[uid]["item"]
|
||||||
|
let _setUserData = {}
|
||||||
|
let _dellog = { "attr": {}, "item": {} }
|
||||||
|
for (let t in _delattr) {
|
||||||
|
if (t == "rmbmoney") {
|
||||||
|
let v = user.rmbmoney - _delattr[t]
|
||||||
|
if (v < 0) { v = 0 }
|
||||||
|
_setUserData[t] = v
|
||||||
|
_dellog["attr"][t] = { "old": user.rmbmoney, "new": v }
|
||||||
|
}
|
||||||
|
else if (t == "jinbi") {
|
||||||
|
let v = user.jinbi - _delattr[t]
|
||||||
|
if (v < 0) { v = 0 }
|
||||||
|
_setUserData[t] = v
|
||||||
|
_dellog["attr"][t] = { "old": user.jinbi, "new": v }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const itemIds = Object.keys(_delitem);
|
||||||
|
// 删除item
|
||||||
|
let _itemlist = await G.mongodb.collection('item').find({ "uid": uid, "itemId": { "$in": itemIds } }).toArray();
|
||||||
|
for (let i = 0; i < _itemlist.length; i++) {
|
||||||
|
const _item = _itemlist[i]
|
||||||
|
const _itemid = _item.itemId
|
||||||
|
const del = _delitem[_itemid] || 0
|
||||||
|
let v = _item.num - del
|
||||||
|
if (v < 0) { v = 0 }
|
||||||
|
let _setItemData = {}
|
||||||
|
_setItemData["num"] = v
|
||||||
|
_dellog["item"][_itemid] = { "old": _item.num, "new": v }
|
||||||
|
await G.mongodb.collection('item').updateOne({ "uid": uid, "itemId": _itemid }, { "$set": _setItemData });
|
||||||
|
}
|
||||||
|
await G.mongodb.collection('user').updateOne({ "uid": uid }, { "$set": _setUserData });
|
||||||
|
// 输出日志
|
||||||
|
console.log(uid, ":", _dellog);
|
||||||
|
}
|
||||||
|
|
||||||
|
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();
|
@ -1,4 +1,4 @@
|
|||||||
import {fightResult} from '../shared/fightControl/fightType';
|
import {fightResult} from '../shared/fightControl/fightType';
|
||||||
|
|
||||||
|
|
||||||
export type CollectionFightLog = fightResult & { uid: string, type: string };
|
export type CollectionFightLog = fightResult & { uid: string, type: string, ttl: Date};
|
@ -1,43 +1,43 @@
|
|||||||
import {ApiCall, TsrpcError} from 'tsrpc';
|
import { ApiCall, TsrpcError } from 'tsrpc';
|
||||||
import {FightControl} from '../shared/fightControl/fightCntrol';
|
import { FightControl } from '../shared/fightControl/fightCntrol';
|
||||||
import {formatNpcData} from '../shared/fightControl/fightFun';
|
import { formatNpcData } from '../shared/fightControl/fightFun';
|
||||||
import {fightResult, joinFightData, roleDataType} from '../shared/fightControl/fightType';
|
import { fightResult, joinFightData, roleDataType } from '../shared/fightControl/fightType';
|
||||||
import {rankInfo} from '../shared/protocols/type';
|
import { rankInfo } from '../shared/protocols/type';
|
||||||
import {HeroShared} from '../shared/public/hero';
|
import { HeroShared } from '../shared/public/hero';
|
||||||
import {PlayerShared} from '../shared/public/player';
|
import { PlayerShared } from '../shared/public/player';
|
||||||
import {HeroFun} from './hero';
|
import { HeroFun } from './hero';
|
||||||
import {UserFun} from './user';
|
import { UserFun } from './user';
|
||||||
import {re, string} from "mathjs";
|
import { re, string } from "mathjs";
|
||||||
import {getGud} from './gud';
|
import { getGud } from './gud';
|
||||||
import {PushGiftFun} from "./pushgift";
|
import { PushGiftFun } from "./pushgift";
|
||||||
|
|
||||||
type fightType = 'tanxian' | 'pata' | 'jjc' | 'gbtx' | 'qjzzd' | 'meirishilian' | 'wzrycross';
|
type fightType = 'tanxian' | 'pata' | 'jjc' | 'gbtx' | 'qjzzd' | 'meirishilian' | 'wzrycross';
|
||||||
|
|
||||||
|
|
||||||
let fights:{[key:string]:FightControl} = {
|
let fights: { [key: string]: FightControl } = {
|
||||||
|
|
||||||
};
|
};
|
||||||
function clearFights (){
|
function clearFights() {
|
||||||
//定时清理战斗
|
//定时清理战斗
|
||||||
setInterval(()=>{
|
setInterval(() => {
|
||||||
let now = Date.now();
|
let now = Date.now();
|
||||||
for (let key in fights){
|
for (let key in fights) {
|
||||||
if (now - fights[key].startTime > 30000){
|
if (now - fights[key].startTime > 30000) {
|
||||||
console.log("清理战斗",key);
|
console.log("清理战斗", key);
|
||||||
try{
|
try {
|
||||||
fights[key].release();
|
fights[key].release();
|
||||||
}catch(e){
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
delete fights[key];
|
delete fights[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},5000);
|
}, 5000);
|
||||||
}
|
}
|
||||||
clearFights();
|
clearFights();
|
||||||
|
|
||||||
export class FightFun {
|
export class FightFun {
|
||||||
static fightIndex:number = 0;
|
static fightIndex: number = 0;
|
||||||
|
|
||||||
static fight(data: joinFightData[], maxRoundNums = 30, fightType: "pvp" | "pve" = 'pvp') {
|
static fight(data: joinFightData[], maxRoundNums = 30, fightType: "pvp" | "pve" = 'pvp') {
|
||||||
this.fightIndex++;
|
this.fightIndex++;
|
||||||
@ -80,16 +80,20 @@ export class FightFun {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
player: {...player, buff: PlayerShared.getBuff(player)},
|
player: { ...player, buff: PlayerShared.getBuff(player) },
|
||||||
roles: roles
|
roles: roles
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**挑战竞技场 */
|
/**挑战竞技场 */
|
||||||
static async fightJJc(call: ApiCall, rankInfo: rankInfo) {
|
static async fightJJc(call: ApiCall, rankInfo: rankInfo) {
|
||||||
if (rankInfo.player.uid.indexOf('npc_') != -1) return await this.fightNpc(call, G.gc.jjc_npc[rankInfo.player.uid].npcId, 'jjc', await this.getPlayerFightData(call.conn.uid));
|
let result;
|
||||||
|
|
||||||
let result = this.fight([await this.getPlayerFightData(call.conn.uid), await this.getPlayerFightData(rankInfo.player.uid)]);
|
if (rankInfo.player.uid.indexOf('npc_') != -1) {
|
||||||
|
result = await this.fightNpc(call, G.gc.jjc_npc[rankInfo.player.uid].npcId, 'jjc', await this.getPlayerFightData(call.conn.uid));
|
||||||
|
} else {
|
||||||
|
result = this.fight([await this.getPlayerFightData(call.conn.uid), await this.getPlayerFightData(rankInfo.player.uid)]);
|
||||||
|
}
|
||||||
|
|
||||||
// 竞技场 战败触发推送礼包
|
// 竞技场 战败触发推送礼包
|
||||||
if (result.winSide != 0) {
|
if (result.winSide != 0) {
|
||||||
@ -130,14 +134,14 @@ export class FightFun {
|
|||||||
* @param result
|
* @param result
|
||||||
*/
|
*/
|
||||||
static async saveLog(uid: string, type: string, result: fightResult) {
|
static async saveLog(uid: string, type: string, result: fightResult) {
|
||||||
let writeList = ['ganhai', 'jjc', 'hbzbJfs', 'hbzbZbs', 'slzd', 'clsl']
|
let writeList = ['ganhai', 'jjc', 'hbzbJfs', 'hbzbZbs', 'slzd', 'clsl']
|
||||||
if (uid.indexOf('npc') != -1 || !writeList.includes(type)) return;
|
if (uid.indexOf('npc') != -1 || !writeList.includes(type)) return;
|
||||||
|
|
||||||
G.mongodb.collection('fightLog').insertOne({uid, type, ...result})
|
G.mongodb.collection('fightLog').insertOne({ uid, type, ...result, ttl: new Date() })
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static async readLog(uid: string, type: string, len = 20) {
|
static async readLog(uid: string, type: string, len = 20) {
|
||||||
return await G.mongodb.collection('fightLog').find({uid, type}).limit(len).toArray() || []
|
return await G.mongodb.collection('fightLog').find({ uid, type }).limit(len).sort({ _id: -1 }).toArray() || []
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user