Compare commits

...

52 Commits

Author SHA1 Message Date
xichaoyin
724145f9c8 Merge remote-tracking branch 'origin/bugfix' into release
# Conflicts:
#	src/public/fight.ts
#	src/public/player.ts
#	zoeninfo.sh
2024-01-15 09:44:23 +08:00
xichaoyin
6370e88116 fix:皮肤头像 2024-01-12 20:12:18 +08:00
xichaoyin
1060c5ccc7 fix:添加黄旗金币和黄旗兑换币的监控 2024-01-12 18:18:08 +08:00
xichaoyin
e9fba7ed05 fix:
1:头像框脚本
2:添加监控数据
2024-01-12 17:50:10 +08:00
a46b8f671c 先不清空,最后一个玩家时可能会有异常 2024-01-12 16:32:09 +08:00
945d406131 Merge branch 'bugfix' of http://git.legu.cc/qixin/HJ_Server into bugfix 2024-01-12 16:08:41 +08:00
af03f2f6c5 外网insertMany报错兼容 2024-01-12 16:08:30 +08:00
xichaoyin
8780716d44 脚本 2024-01-12 15:44:56 +08:00
08a9dd335a 发奖发错了 2024-01-11 22:52:24 +08:00
b23d311dbd slzd不需要回复次数 2024-01-11 21:19:48 +08:00
69945c3964 回退层数逻辑 2024-01-11 21:01:00 +08:00
00804b9b49 矿洞结算bug 2024-01-11 20:23:08 +08:00
b5a9f6f530 积分容错 2024-01-11 19:14:56 +08:00
yushunrui
d6bafb7704 fix:竞技场第一名头像特殊处理,可以用道具直接解锁 2024-01-11 18:20:06 +08:00
xichaoyin
fd7b8d945d fix:任务修复脚本 2024-01-11 17:06:39 +08:00
7d85f554f4 聊天分组bug 2024-01-11 16:06:35 +08:00
yushunrui
6eb61ece9c fix:处理活动和新年头像框 2024-01-12 23:53:59 +08:00
yushunrui
184bdd304e 脚本提交,兑换掉落修改礼包内容, 玩家新年头像框刷成永久 2024-01-12 23:32:40 +08:00
yushunrui
8c86b05fe1 Merge remote-tracking branch 'origin/bugfix' into bugfix 2024-01-12 23:13:23 +08:00
yushunrui
c7ce70fcc0 fix:处理了头像框和聊天框得逻辑 2024-01-12 23:10:39 +08:00
yushunrui
ac4432fea8 fix:头像框 聊天框,造型逻辑修改 2024-01-12 22:52:56 +08:00
xichaoyin
847613db4a fix:丛林狩猎定时器修复 2024-01-11 14:51:17 +08:00
2c3d53899e 去掉多余的环境变量,解决pm2集群启动失败问题 2024-01-11 11:23:08 +08:00
xichaoyin
325ed8745c fix:时区脚本修复 2024-01-11 11:20:14 +08:00
45c5a195ed addhp不应该取整 2024-01-10 23:08:14 +08:00
8e9553386f Merge branch 'bugfix' of http://git.legu.cc/qixin/HJ_Server into bugfix 2024-01-10 21:55:12 +08:00
c09c9dec89 配件修正 2024-01-10 21:55:02 +08:00
yushunrui
b80263ed16 fix:竞技场第一名头像特殊处理,可以用道具直接解锁 2024-01-10 21:17:04 +08:00
yushunrui
363787fb39 Revert "fix:竞技场第一名头像特殊处理,可以用道具直接解锁"
This reverts commit 0a94965e30.
2024-01-10 21:16:13 +08:00
yushunrui
0a94965e30 fix:竞技场第一名头像特殊处理,可以用道具直接解锁 2024-01-10 21:14:10 +08:00
yushunrui
138ee2675c Merge remote-tracking branch 'origin/bugfix' into bugfix 2024-01-10 20:38:15 +08:00
yushunrui
8aab7b6322 fix:处理人才计划任务领取标识在刷 新一轮的时候没有重置 2024-01-10 20:37:58 +08:00
yushunrui
48cd24d309 fix:超值基金设置奖励逻辑设置为同步 2024-01-11 18:45:59 +08:00
72b215451b Merge branch 'bugfix' of http://git.legu.cc/qixin/HJ_Server into bugfix 2024-01-10 16:57:21 +08:00
104a1edadc 天赋技能 2024-01-10 16:57:11 +08:00
yushunrui
7feff43ee6 Merge remote-tracking branch 'origin/bugfix' into bugfix 2024-01-10 16:45:22 +08:00
yushunrui
a26aa7dab3 fix:处理强化伙伴活动初始没有任务进度的逻辑 2024-01-10 16:44:53 +08:00
xichaoyin
ca3e973afd patch:终身卡周奖励补发脚本 2024-01-10 15:50:49 +08:00
xichaoyin
0932d3ee47 patch:终身卡周奖励补发脚本 2024-01-10 15:46:41 +08:00
xichaoyin
452f5f3d14 patch:任务修复脚本 2024-01-10 15:19:38 +08:00
xichaoyin
0a296d739a fix:屏蔽检测生成新的任务逻辑 2024-01-10 14:52:41 +08:00
yushunrui
4596fb537c Merge remote-tracking branch 'origin/bugfix' into bugfix 2024-01-10 14:09:36 +08:00
d8a47e85b2 Merge branch 'bugfix' of http://git.legu.cc/qixin/HJ_Server into bugfix 2024-01-10 14:01:01 +08:00
f802242b35 fix:自选礼包异常 2024-01-10 14:00:48 +08:00
xichaoyin
51ddb55637 fix:玩家邮件修复脚本 2024-01-10 13:38:27 +08:00
f1963d2e53 Merge branch 'bugfix' of http://git.legu.cc/qixin/HJ_Server into bugfix 2024-01-09 22:31:04 +08:00
0ddd611c59 去掉无效刷新 2024-01-09 22:30:35 +08:00
xichaoyin
666b7e51c5 fix:fightlog添加ttl 2024-01-09 22:23:42 +08:00
xichaoyin
0d736e4854 fix:jjc战斗日志添加_id倒序 2024-01-09 22:14:56 +08:00
yushunrui
b0a3c17927 fix:玩家道具扣除逻辑脚本提交 2024-01-10 18:32:23 +08:00
yushunrui
24cae9a4e9 fix:战令任务每轮重置进度 2024-01-10 16:19:56 +08:00
yushunrui
1c256ab58b fix:竞技场第一名头像特殊处理,可以用道具直接解锁 2024-01-09 22:00:30 +08:00
16 changed files with 1078 additions and 58 deletions

View File

@ -12,11 +12,38 @@ export default async function (call: ApiCall<ReqOpen, ResOpen>) {
// 无此活动
return call.error('', { code: -1, message: globalThis.lng.huodong_open_1 })
}
let db = await G.mongodb.cEvent(`chuanshuozhilu${call.req.hdid}`).findOne({ uid: call.uid, type: `chuanshuozhilu${call.req.hdid}` });
let _info = db?.info || {}
// 如果初始没有数据,就判断玩家是否有活动对应的影响,生成一下初始化数据
if (!db) {
let _dbType: `chuanshuozhilu${number}` = `chuanshuozhilu${call.req.hdid}`
const hid = _hdinfo.data.hid
let heros = await G.mongodb.collection("hero").find({uid: call.uid, heroId: hid})
.sort({ "zhanli": -1 }).limit(1).toArray();
if (heros) {
let hero = heros[0]
const lv = hero.lv || 0
const jieji = hero.jieji || 0
let setInfo = {"lv": lv, "jieji": jieji}
await G.mongodb.cEvent(_dbType).updateOne(
{ uid: call.uid, type: _dbType },
{ $set: G.mongodb.createTreeObj({ key: `info.${hid}`, val: setInfo})},
{ upsert: true}
)
if (!cache[call.uid]) cache[call.uid] = {hid:{}};
if (!cache[call.uid][hid]) cache[call.uid][hid] = setInfo;
_info[hid] = setInfo
G.server.sendMsgByUid(call.uid, 'msg_s2c/HongDianChange', ['huodonghd']);
}
}
call.succ({
info: db?.info || {},
info: _info,
hdinfo: _hdinfo
});
}

View File

@ -35,6 +35,7 @@ export default async function (call: ApiCall<ReqRec, ResRec>) {
_mydata.lunci += 1
_setData["taskval"] = _mydata.taskval
_setData["lunci"] = _mydata.lunci
_setData["finishid"] = _mydata.finishid
}
// 设置任务改变数据

View File

@ -16,8 +16,8 @@ export default async function (call: ApiCall<ReqRec, ResRec>) {
if (call.req.index > day) return call.errorCode(-3);
if (rec.includes(call.req.index)) return call.errorCode(-4);
G.mongodb.cEvent(type).updateOne({uid: call.uid, type: type}, {$push: {rec: call.req.index}}, {upsert: true});
// 从异步改成同步
await G.mongodb.cEvent(type).updateOne({uid: call.uid, type: type}, {$push: {rec: call.req.index}}, {upsert: true});
await PlayerFun.sendPrize(call, [].concat(conf.prize[call.req.index]));

View File

@ -24,7 +24,10 @@ export default async function (call: ApiCall<ReqOpen, ResOpen>) {
await PayFun.delPayLog(
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({
uid: call.uid,
type: 'zhanling'

View File

@ -30,6 +30,6 @@ export default async function (call: ApiCall<ReqOpen, ResOpen>) {
});
UserFun.activeHeadFrame(call.uid, 'jjc_rank', data["rank"] + 1);
JJCFun.checkUpdatePlayer()
//JJCFun.checkUpdatePlayer()
}

View 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();

View 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();

View File

@ -0,0 +1,117 @@
import { ReqEmail } from "../monopoly/protocols/PtlEmail";
import { patchInit } from "../patch";
import { MsgEmail } from "../shared/protocols/msg_s2c/MsgEmail";
import { PublicShared } from "../shared/public/public";
class Path {
async addEmail(email: ReqEmail & { createTime?: number; }) {
let { prize, uid, ...e } = email;
let lng = await G.redis.rawGet(`user:lng:${uid}`)
let sendEmail: MsgEmail = {
_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 || []
};
if (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
}
await G.mongodb.collection('email').insertOne({
ttl: new Date(), ...G.mongodb.conversionIdObj(sendEmail)
});
}
async fun1(a: any) {
let taskType = 2;
let users = await G.mongodb.collection('user').find({ loginTime: { $gte: 1704643200 } }).toArray();
for (let i = 0; i < users.length; i++) {
let user = users[i];
let unFinishTask = (await G.mongodb.collection('task').find({
uid: user.uid, type: taskType, finish: 0
}, { projection: { taskid: 1 } }).toArray()).map(i => i.taskid);
if (unFinishTask.length >= 2) {
let deltask = unFinishTask.sort().slice(1);
await G.mongodb.collection("task").deleteOne({
uid: user.uid, taskid: { $in: deltask }
});
console.log(`删除玩家${user.uid}任务:${deltask}`);
}
}
}
/**
*
*/
async fun2(a: any) {
let logs = await G.mongodb.collection("payLogNew").find(
{ key: "zhongshenka", del_time: { $exists: false } }, { projection: { _id: 0, } }
).toArray();
if (logs.length == 0) {
console.log("没有终身卡数据,不发放终身卡");
return
}
let wzt = PublicShared.getToWeekMondayZeroTime();
let con = G.gc.payEmail.zhongshenka.filter(e => e.day == 7)[0];
for (let i = 0; i < logs.length; i++) {
// 查询玩家邮件
let emails = await G.mongodb.collection('email').find({
uid: logs[i].uid, title: con.title, createTime: { $gte: wzt }
}).toArray();
if (emails.length == 0) {
// 发送邮件
this.addEmail({
uid: logs[i].uid,
type: "system",
title: con.title,
content: con.content,
contentInsertArr: [],
createTime: G.time,
prize: con.prize,
})
console.log("发放终身卡", logs[i].uid);
} else {
console.log("本周已发送过 不发放终身卡", logs[i].uid);
}
}
}
async run() {
await this.fun1(1);
await this.fun2(1);
}
}
async function main() {
await patchInit()
let patch = new Path();
await patch.run();
console.log("逻辑执行完成,等待退出");
setTimeout(function () {
console.log('结束程序');
process.exit();
}, 3000);
}
main();

View File

@ -0,0 +1,61 @@
import {ReqEmail} from "../monopoly/protocols/PtlEmail";
import {patchInit} from "../patch";
import {MsgEmail} from "../shared/protocols/msg_s2c/MsgEmail";
import {PublicShared} from "../shared/public/public";
class Path {
async fun1(a: any) {
let taskType = 2;
let users = await G.mongodb.collection('user').find({}, {
projection: {uid: 1}
}).toArray();
// let users = await G.mongodb.collection('user').find({ loginTime: { $gte: 1704643200 } }).toArray();
for (let i = 0; i < users.length; i++) {
let user = users[i];
console.log(`处理玩家${user.uid}数据`);
let task = Object.assign({}, ...(await G.mongodb.collection('task').find({
uid: user.uid, type: taskType
}, {projection: {taskid: 1, finish: 1}}).toArray()).map(i => {
return {[i.taskid]: i.finish}
}))
let deltask = [];
let sortTask = Object.keys(task).sort();
for (let taskid of sortTask) {
if (task[taskid] == 1) continue;
let con = G.gc.task[taskType][taskid];
if (task[con.followtask]) {
let i = sortTask.indexOf(taskid);
deltask.push(...sortTask.slice(i + 1).map(i => Number(i)));
}
}
if (deltask.length > 0) {
await G.mongodb.collection("task").deleteMany(
{uid: user.uid, taskid: {$in: deltask}}
)
console.log(`删除玩家${user.uid}任务:${deltask}`)
}
}
}
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();

View File

@ -1,4 +1,4 @@
import {fightResult} from '../shared/fightControl/fightType';
export type CollectionFightLog = fightResult & { uid: string, type: string };
export type CollectionFightLog = fightResult & { uid: string, type: string, ttl: Date};

View File

@ -19,7 +19,8 @@ export class DxltFun {
}
/**回退层数 */
static backLayer(data: ResOpen) {
let num = data.curLayer - G.gc.dxlt_com.dayResetBackLayer;
//let num = data.curLayer - G.gc.dxlt_com.dayResetBackLayer;
let num = (data.curLayer-30) - (data.curLayer-30)%5+1
data.curLayer = num < 1 ? 1 : num;
data.over = G.gc.dxlt_layer[data.curLayer].type == 2;
}

View File

@ -1,15 +1,15 @@
import { ApiCall, TsrpcError } from 'tsrpc';
import { FightControl } from '../shared/fightControl/fightCntrol';
import { formatNpcData } from '../shared/fightControl/fightFun';
import { fightResult, joinFightData, roleDataType } from '../shared/fightControl/fightType';
import { rankInfo } from '../shared/protocols/type';
import { HeroShared } from '../shared/public/hero';
import { PlayerShared } from '../shared/public/player';
import { HeroFun } from './hero';
import { UserFun } from './user';
import { re, string } from "mathjs";
import { getGud } from './gud';
import { PushGiftFun } from "./pushgift";
import {ApiCall, TsrpcError} from 'tsrpc';
import {FightControl} from '../shared/fightControl/fightCntrol';
import {formatNpcData} from '../shared/fightControl/fightFun';
import {fightResult, joinFightData, roleDataType} from '../shared/fightControl/fightType';
import {rankInfo} from '../shared/protocols/type';
import {HeroShared} from '../shared/public/hero';
import {PlayerShared} from '../shared/public/player';
import {HeroFun} from './hero';
import {UserFun} from './user';
import {re, string} from "mathjs";
import {getGud} from './gud';
import {PushGiftFun} from "./pushgift";
type fightType = 'tanxian' | 'pata' | 'jjc' | 'gbtx' | 'qjzzd' | 'meirishilian' | 'wzrycross' | 'hqjg';
@ -87,9 +87,13 @@ export class FightFun {
/**挑战竞技场 */
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) {
@ -137,14 +141,14 @@ export class FightFun {
* @param result
*/
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;
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) {
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() || []
}
}

View File

@ -94,37 +94,37 @@ export class JJCFun {
* @param uTimeOffset
* @param isUpdate
*/
static async checkUpdatePlayer(min: number = 0, max: number = 1000, uTimeOffset: number = 600, isUpdate: boolean = true) {
// 获取指定排名用户uid
let sortInfo = await this.getRankListUid(min, max)
if (!sortInfo.length) return []
let updateArr = []
// static async checkUpdatePlayer(min: number = 0, max: number = 1000, uTimeOffset: number = 600, isUpdate: boolean = true) {
// // 获取指定排名用户uid
// let sortInfo = await this.getRankListUid(min, max)
// if (!sortInfo.length) return []
// let updateArr = []
let users = await G.redis.hGetAll('rank:jjc:data')
// let users = await G.redis.hGetAll('rank:jjc:data')
for (let i = 0; i < sortInfo.length; i++) {
let uid = sortInfo[i]
let rankInfo = users[uid]
if (!rankInfo?.player) continue
// 比对utime判断是否更新数据
if (!rankInfo.player.isNpc) {
if (!rankInfo.utime || (rankInfo.utime && rankInfo.utime < (G.time - uTimeOffset))) {
updateArr.push(rankInfo)
}
}
}
// 更新数据
if (isUpdate && updateArr.length > 0) {
let playerArrInfo = await G.mongodb.collection("user").find({uid: {$in: updateArr.map(i => i.uid)}}).toArray()
for (let i = 0; i < playerArrInfo.length; i++) {
let playerInfo = playerArrInfo[i]
let index = updateArr.findIndex(x => x.player.uid == playerInfo.uid)
updateArr[index].player = playerInfo
updateArr[index].utime = G.time
this.updatePlayerData(playerInfo.uid, updateArr[index]);
}
}
}
// for (let i = 0; i < sortInfo.length; i++) {
// let uid = sortInfo[i]
// let rankInfo = users[uid]
// if (!rankInfo?.player) continue
// // 比对utime判断是否更新数据
// if (!rankInfo.player.isNpc) {
// if (!rankInfo.utime || (rankInfo.utime && rankInfo.utime < (G.time - uTimeOffset))) {
// updateArr.push(rankInfo)
// }
// }
// }
// // 更新数据
// if (isUpdate && updateArr.length > 0) {
// let playerArrInfo = await G.mongodb.collection("user").find({uid: {$in: updateArr.map(i => i.uid)}}).toArray()
// for (let i = 0; i < playerArrInfo.length; i++) {
// let playerInfo = playerArrInfo[i]
// let index = updateArr.findIndex(x => x.player.uid == playerInfo.uid)
// updateArr[index].player = playerInfo
// updateArr[index].utime = G.time
// this.updatePlayerData(playerInfo.uid, updateArr[index]);
// }
// }
// }
/**
* uid[]

View File

@ -155,7 +155,7 @@ export class PlayerFun {
all.push(this.addItem(call, item));
}
// 记录消耗
addGameLog(call.uid, call.service.name, call.req, { need: val })
addGameLog(call.uid, call.service.name, call.req, {need: val})
await Promise.all(all);
G.emit('USE_ITEM', call.conn.gud, needArr.map(need => {
return { ...need, n: Math.abs(need.n) };

View File

@ -305,8 +305,11 @@ export class UserFun {
change = true;
gud.headFrames[conf.id] = -1;
}
else if(conf?.cond?.[0] == "jjc_rank") {
change = true;
gud.headFrames[conf.id] = -1;
}
}
if (change) {
PlayerFun.changeAttr(uid, {headFrames: gud.headFrames});
G.server.sendMsgByUid(uid, 'msg_s2c/PlayerChange', {headFrames: gud.headFrames});

View File

@ -78,8 +78,8 @@ async function clearRedis() {
G.redis.fromatKey('equip'),
G.redis.fromatKey('shiwu'),
G.redis.fromatKey('tanxian'),
G.redis.fromatKey('gbtx'),
G.redis.fromatKey('dxlt'),
//G.redis.fromatKey('gbtx'),
//G.redis.fromatKey('dxlt'),
])
}