Merge remote-tracking branch 'origin/bugfix' into bugfix
This commit is contained in:
commit
4596fb537c
@ -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()
|
||||
|
||||
}
|
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();
|
@ -1,27 +1,9 @@
|
||||
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) {
|
||||
const con = {
|
||||
"1001_659cf813920babad7462d78f":{
|
||||
"item": {
|
||||
"1": 100,
|
||||
"12": 100,
|
||||
"2": 100,
|
||||
"6": 100
|
||||
},
|
||||
"attr": {
|
||||
"rmbmoney": 100000,
|
||||
"jinbi": 200000
|
||||
}
|
||||
},
|
||||
"16_6575db20f6ef8b7da5c8f1fd": {
|
||||
"item": {
|
||||
"1": 55400000,
|
||||
@ -58,19 +40,6 @@ class Path {
|
||||
"jinbi": 630000000
|
||||
}
|
||||
},
|
||||
"13_6574d24964743d942d4c2621": {
|
||||
"item": {
|
||||
"1": 20600000,
|
||||
"18": 1920,
|
||||
"12": 17800,
|
||||
"2": 85400,
|
||||
"6": 255
|
||||
},
|
||||
"attr": {
|
||||
"rmbmoney": 15400,
|
||||
"jinbi": 1060000000
|
||||
}
|
||||
},
|
||||
"10_6573ecd9a884822d24482a1a": {
|
||||
"item": {
|
||||
"1": 103200000,
|
||||
@ -555,18 +524,6 @@ class Path {
|
||||
"jinbi": 430000000
|
||||
}
|
||||
},
|
||||
"13_658796c52d0c66fa1adb86fc": {
|
||||
"item": {
|
||||
"1": 21000000,
|
||||
"12": 81300,
|
||||
"2": 69800,
|
||||
"6": 275
|
||||
},
|
||||
"attr": {
|
||||
"rmbmoney": 12400,
|
||||
"jinbi": 1140000000
|
||||
}
|
||||
},
|
||||
"11_65743bb09beef4c060ed46e7": {
|
||||
"item": {
|
||||
"10": 300,
|
||||
|
51
src/fix_patch/patch_20240110.ts
Normal file
51
src/fix_patch/patch_20240110.ts
Normal file
@ -0,0 +1,51 @@
|
||||
import { patchInit } from "../patch";
|
||||
|
||||
|
||||
class Path {
|
||||
|
||||
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) {
|
||||
for (let taskid of unFinishTask) {
|
||||
let con = G.gc.task[taskType][taskid];
|
||||
if (!con) {
|
||||
await G.mongodb.collection("task").deleteOne({
|
||||
uid: user.uid, taskid: taskid
|
||||
});
|
||||
console.log(`删除玩家${user.uid}任务:${taskid}`);
|
||||
}
|
||||
if (unFinishTask.includes(con.pretask)) {
|
||||
await G.mongodb.collection("task").deleteOne({
|
||||
uid: user.uid, taskid: taskid
|
||||
});
|
||||
console.log(`删除玩家${user.uid}任务:${taskid}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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';
|
||||
|
||||
|
||||
export type CollectionFightLog = fightResult & { uid: string, type: string };
|
||||
export type CollectionFightLog = fightResult & { uid: string, type: string, ttl: Date};
|
@ -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) {
|
||||
@ -133,11 +137,11 @@ export class FightFun {
|
||||
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() || []
|
||||
}
|
||||
}
|
@ -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[]
|
||||
|
@ -260,7 +260,10 @@ export class PayFun {
|
||||
let selectPrize = await G.ioredis.get(`pay:${payId}:${player.uid}`);
|
||||
if (selectPrize) {
|
||||
prize.push(...JSON.parse(selectPrize))
|
||||
G.ioredis.del(`pay:${payId}:${player.uid}`)
|
||||
//支付A check -> 玩家支付 -> 网络延迟
|
||||
//支付B check -> 玩家支付 -> pay -> del
|
||||
//支付A -> pay 时,这里可能被清了,导致给玩家发放了空的奖励,因此,这里不清除
|
||||
//G.ioredis.del(`pay:${payId}:${player.uid}`)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,8 @@ import {getGud, setGud} from './gud';
|
||||
import {addGameLog} from "../gameLog";
|
||||
import {PushGiftFun} from "./pushgift";
|
||||
import { ActionLog } from './actionLog/actionLog';
|
||||
import { roleDataType } from '../shared/fightControl/fightType';
|
||||
import { PlayerShared } from '../shared/public/player';
|
||||
|
||||
|
||||
export type call = {
|
||||
@ -41,6 +43,41 @@ export type call = {
|
||||
};
|
||||
|
||||
export class PlayerFun {
|
||||
/**
|
||||
* 通过uid获取战斗数据
|
||||
* @param uid
|
||||
* @returns
|
||||
*/
|
||||
static async getDefaultFightDataByUid(uid:string){
|
||||
let gud = await getGud(uid);
|
||||
let posObj = gud.heroPos;
|
||||
let roles: k_v<roleDataType> = {};
|
||||
if (gud.selectMatrix && gud.matrixPos) {
|
||||
posObj = gud.matrixPos[gud.selectMatrix];
|
||||
}
|
||||
let heros = await HeroFun.getHeros({uid:uid}, Object.values(posObj).filter(_id => _id != '') as string[]);
|
||||
let otherBuff = UserFun.getOtherBuff(gud)
|
||||
|
||||
Object.entries(posObj).forEach(obj => {
|
||||
let pos = obj[0];
|
||||
let _id = obj[1];
|
||||
let hero = heros.filter(h => h._id == _id)[0];
|
||||
|
||||
if (hero) {
|
||||
roles[pos] = {
|
||||
...hero,
|
||||
attr: {
|
||||
...HeroShared.getHeroBasicAttr(hero, { ...otherBuff, allBuff: HeroShared.getAllBuff(heros) }, Number(pos))
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
player: { ...gud, buff: PlayerShared.getBuff(gud) },
|
||||
roles: roles
|
||||
};
|
||||
}
|
||||
/**
|
||||
* 获取玩家atn数量
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user