Compare commits

...

25 Commits

Author SHA1 Message Date
dy
ab872cf185 cehua json 2024-01-02 09:50:33 +08:00
dy
428033b26f Merge branch 'bugfix' into release 2023-12-31 17:43:30 +08:00
dy
7aaa0699f9 fix 竞技场头像激活 2023-12-31 17:42:56 +08:00
dy
64a9ea7360 fix 黑帮争霸用户为空时协议报错 2023-12-31 17:22:07 +08:00
dy
61a8ae0fc9 fix 黑帮争霸取参错误 2023-12-31 17:04:59 +08:00
dy
4448b2dfa8 Merge branch 'bugfix' into release 2023-12-31 16:30:16 +08:00
17ae62472e Merge branch 'bugfix' of http://git.legu.cc/qixin/HJ_Server into bugfix 2023-12-31 16:29:22 +08:00
b75e7155b8 增加错误捕获 2023-12-31 16:24:07 +08:00
dy
087b8ff146 Merge branch 'feature/json' into release 2023-12-31 16:01:52 +08:00
dy
d8a7fa14d0 Merge remote-tracking branch 'origin/bugfix' into release 2023-12-31 15:59:30 +08:00
dy
71c0506a72 修复玩家出现的饰品和配件数据错误导致的进不去游戏 2023-12-31 15:22:51 +08:00
dy
1090852522 修复玩家出现的饰品和配件数据错误导致的进不去游戏 2023-12-31 15:21:41 +08:00
dy
09b74e3490 黑帮争霸刷新玩家数据 2023-12-31 14:26:40 +08:00
dy
ec1b76ed5f 竞技场检测头像框是否激活 2023-12-31 13:43:47 +08:00
dy
42daf348b9 消费竞赛定时器 2023-12-31 13:35:38 +08:00
dy
a84f20361f 累充 2023-12-31 11:45:44 +08:00
dy
f3ec6df093 消费竞赛 2023-12-31 11:24:38 +08:00
dy
96675a9ff1 累计充值 2023-12-31 09:48:26 +08:00
xcy
a177c18efe fix:
修复排名数据问题
2023-12-30 18:04:01 +08:00
xcy
18b380f620 fix:
脚本冲突解决
2023-12-30 17:04:56 +08:00
xcy
f99d556736 Merge branch 'bugfix' of http://git.legu.cc/qixin/HJ_Server into bugfix 2023-12-30 17:04:25 +08:00
xcy
d034105a62 fix:
修复排名数据不对
2023-12-30 17:02:25 +08:00
dy
6fd4e79fbe 累计充值 2023-12-30 16:32:26 +08:00
dy
6fae6cd61e 破冰礼包 2023-12-30 16:07:54 +08:00
xcy
45cec85960 patch:
修复元旦活动任务脚本
2023-12-30 15:10:35 +08:00
22 changed files with 678 additions and 156 deletions

View File

@ -3,16 +3,21 @@ import { ReqUpdateHbzbCrossUser, ResUpdateHbzbCrossUser } from "../../cross/prot
/**更新跨服数据库里,黑帮争霸的玩家数据 */
export default async function (call: ApiCall<ReqUpdateHbzbCrossUser, ResUpdateHbzbCrossUser>) {
let setData = {
let setData: any = {
"data": {
player: call.req.user.player,
roles: call.req.user.roles,
uid: call.req.uid
},
};
if (call.req.isNew) {
setData = {
...setData,
"jifen": -999999,
"rank": -999999,
"zbsgroup": ""
};
}
}
G.mongodb.collection('hbzb_user_cross').updateOne({uid: setData.data.uid}, {$set: setData}, {upsert: true});
call.succ({});
}

View File

@ -3,6 +3,7 @@ import { HuoDongFun } from "../../../public/huodongfun";
import {PayFun} from '../../../public/pay';
import {ReqOpen, ResOpen} from "../../../shared/protocols/event/leijichongzhi/PtlOpen";
import {PublicShared} from '../../../shared/public/public';
import {checkNextRound} from "./ApiRec";
export default async function (call: ApiCall<ReqOpen, ResOpen>) {
let _hdinfo = await HuoDongFun.getHdidInfo(call, call.req.hdid)
@ -16,17 +17,22 @@ export default async function (call: ApiCall<ReqOpen, ResOpen>) {
let sTime = db?.sTime || PublicShared.getToDayZeroTime(G.time);
if (!db) {
G.mongodb.cEvent(_dbType).updateOne(
await G.mongodb.cEvent(_dbType).updateOne(
{uid: call.uid, type: _dbType},
{$set: {sTime: sTime, recIndex: []}},
{upsert: true}
);
}
db = await checkNextRound(call, db, _hdinfo.data.tasks)
let payNum = (await PayFun.getPayDaysAllPayNum(call.uid, _hdinfo.stime, _hdinfo.rtime)) * 10
payNum = payNum - (db.round || 0) * R.sort((a, b) => b.total - a.total)(_hdinfo.data.tasks)[0].total
call.succ({
sTime: sTime,
recIndex: db?.recIndex || [],
payNum: (await PayFun.getPayDaysAllPayNum(call.uid, _hdinfo.stime, _hdinfo.rtime)) * 10,
hdinfo: _hdinfo
payNum: payNum,
hdinfo: _hdinfo,
round: db.round || 0
});
}

View File

@ -21,17 +21,29 @@ export default async function (call: ApiCall<ReqRec, ResRec>) {
if (db.recIndex.includes(call.req.index)) return call.error('', {code: -2});
let payNum = (await PayFun.getPayDaysAllPayNum(call.uid, _hdinfo.stime, _hdinfo.rtime)) * 10;
payNum = payNum - (db.round || 0) * R.sort((a, b) => b.total - a.total)(_hdinfo.data.tasks)[0].total
if (payNum < conf.total) return call.error('', {code: -3});
await PlayerFun.sendPrize(call, conf.prize);
G.mongodb.cEvent(_dbType).updateOne(
await G.mongodb.cEvent(_dbType).updateOne(
{uid: call.uid, type: _dbType},
{$push: {recIndex: call.req.index}}
);
await checkNextRound(call, db, _hdinfo.data.tasks)
HongDianChange.sendChangeKey(call.uid, ['huodonghd'])
call.succ({
prize: conf.prize
});
}
export async function checkNextRound(call: ApiCall, event, tasks) {
let _dbType: `leijichongzhi${number}` = `leijichongzhi${call.req.hdid}`
if ((event?.recIndex?.length || 0) < tasks.length) return event
return (await G.mongodb.cEvent(_dbType).findOneAndUpdate(
{uid: call.uid, type: _dbType},
{$set: {recIndex: []}, $inc: {round: 1}}, {returnDocument: 'after'}
)).value;
}

View File

@ -29,5 +29,5 @@ export default async function (call: ApiCall<ReqReceive, ResReceive>) {
call.succ({})
HongDianChange.sendChangeKey(call.uid, ['pobinglibao']);
HongDianChange.sendChangeKey(call.uid, ['huodonghd']);
}

View File

@ -21,23 +21,18 @@ export default async function (call: ApiCall<ReqOpen, ResOpen>) {
let limit = _hd.data?.rank?.slice(-1)?.[0]?.rank?.slice(-1)?.[0] || call.req.limit || 100
let rmbuse = await G.crossmongodb.collection('rmbuse').find({
time: {
$gte: _hd.stime,
$lte: _hd.etime + 10
}
}).sort({change: 1}).limit(limit).toArray()
let rmbuse = await G.crossmongodb.collection('rmbuse').find({type: `xfjs_${G.huodong.xfjsId}`}).sort({change: 1}).limit(limit).toArray()
let list: any = rmbuse.map(i => ({...i, total: R.negate(i.change)}))
let rankList = sortRankList(_hd.data.rank, list)
let users = await G.crossmongodb.collection('huodong_user').find({uid: {$in: rankList.map(i => i._id).filter(i => i._id != 'system')}}).toArray()
let users = await G.crossmongodb.collection('huodong_user').find({uid: {$in: rankList.map(i => i._id).filter(i => i != 'system')}}).toArray()
rankList = rankList.map(i => ({...i, player: users.find(v => v.uid == i.uid) || {}}))
// 活动结束前半小时,缓存过期时间改为10
let exTime = (G.time + 1800) > _hd.etime ? 10 : 60
// 活动结束前半小时,缓存过期时间改为5
let exTime = (G.time + 1800) > _hd.etime ? 5 : 10
G.crossioredis.setex(`rank:xiaofeijingsai`, exTime, JSON.stringify(rankList));
@ -53,14 +48,13 @@ export default async function (call: ApiCall<ReqOpen, ResOpen>) {
*/
export function sortRankList(rank, list) {
let rankList = []
let ccc = 0
rank.map(i => {
for (let k = i.rank[0] - 1; k < i.rank[1]; k++) {
if (list[k]?.total >= i.need[0].n) {
rankList.push({...list[k - ccc], rank: k, _id: list[k - ccc].uid})
if (list[0]?.total >= i.need[0].n) {
rankList.push({...list[0], rank: k, _id: list[0].uid})
list = R.tail(list)
} else {
rankList.push({_id: 'system', total: i.need[0].n, rank: k, player: {}})
ccc += 1
}
}
})
@ -68,11 +62,14 @@ export function sortRankList(rank, list) {
}
// 获取自己的信息
async function getMyData(call, rankList) {
async function getMyData(call: ApiCall, rankList) {
let myData = rankList.find(i => i._id == call.uid)
if (myData) return myData
let myCut: any = await G.crossmongodb.collection('rmbuse').findOne({uid: call.uid})
let myCut: any = await G.crossmongodb.collection('rmbuse').findOne({
uid: call.uid,
type: `xfjs_${G.huodong.xfjsId}`
})
let myUser = await G.mongodb.collection('user').findOne({uid: call.uid})
G.crossmongodb.collection('huodong_user').updateOne({uid: call.uid}, {$set: myUser}, {upsert: true})
@ -81,5 +78,5 @@ async function getMyData(call, rankList) {
myCut = {_id: myUser.uid, total: 0}
}
return {player: myUser, ...myCut, total: R.negate(myCut.total), rank: -1, _id: myUser.uid}
return {player: myUser, ...myCut, total: R.negate(myCut.change) || 0, rank: -1, _id: myUser.uid}
}

View File

@ -12,6 +12,7 @@ export default async function (call: ApiCall<ReqhdGetList, ReshdGetList>) {
// 消费竞赛是跨服活动,活动开启时,同步当前用户信息到跨服数据库
G.huodong.xfjs = !!_hdList.find(i => i.htype == 11);
if (G.huodong.xfjs) {
G.huodong.xfjsId = _hdList.find(i => i.htype == 11).hdid
let myUser = await G.mongodb.collection('user').findOne({uid: call.uid})
G.crossmongodb.collection('huodong_user').updateOne({uid: call.uid}, {$set: myUser}, {upsert: true})
}

View File

@ -9,10 +9,8 @@ export default async function (call: ApiCall<ReqOpen, ResOpen>) {
let dbData = await getHbzbData(call.uid);
let data: typeof dbData.data = dbData?.data || {} as any;
if (dbData == null) {
//如果没有,则同步到跨服
await updateHbzbCrossUser(await call.conn.getDefaultFightData(), true);
}
await updateHbzbCrossUser(await call.conn.getDefaultFightData(), dbData == null);
if (!data.refreshTime || data.refreshTime < PublicShared.getToDayZeroTime()) {
data.winNum = 0;
@ -31,8 +29,10 @@ export default async function (call: ApiCall<ReqOpen, ResOpen>) {
//todo 健壮性处理
return call.errorCode(-4)
}
if (callRes.res.enemy.length)
data.enemy = callRes.res.enemy.map(e => { return { ...e, result: null }; });
if (callRes.res?.enemy?.length)
data.enemy = callRes.res.enemy.map(e => {
return {...e, result: null};
});
}
G.mongodb.cPlayerInfo('hbzb').updateOne(
@ -44,6 +44,7 @@ export default async function (call: ApiCall<ReqOpen, ResOpen>) {
call.succ({
...data,
enemy: data.enemy || [],
rank: await getMyRank(call.uid)
});
}

View File

@ -21,34 +21,7 @@ export default async function (call: ApiCall<ReqGetList, ResGetList>) {
color[heroCon[v.heroId].colour] += 1;
});
// 修复配件数据
let peijianids = [];
Object.values(list).map(hero => {
hero.peijian && Object.values(hero.peijian).map(
i => peijianids.push(G.mongodb.conversionId(PeijianShared.fmt(i)._id))
)
});
let peijians = (await G.mongodb.collection("peijian").find(
{uid: call.uid, _id: {$in: peijianids}}, {projection: {_id: 1}}
).toArray()).map(temp => G.mongodb.conversionId(temp._id));
let changes = {};
Object.values(list).map(hero => {
for (let pos in hero.peijian) {
if (!peijians.includes(PeijianShared.fmt(hero.peijian[pos])._id)) {
hero.peijian[pos] = "";
changes[hero._id] = hero.peijian;
}
}
})
for (let oid in changes) {
// 修复数据
G.mongodb.collection("hero").updateOne(
G.mongodb.conversionIdObj({_id: oid}), {$set: {peijian: changes[oid]}}
)
}
await checkDataAndFix(call, list)
// 记录玩家最大等级,颜色相关数据 注册任务用
await G.mongodb.collection('playerInfo', 'usertasklog').updateOne({uid: call.conn.uid, type: 'usertasklog'},
@ -69,3 +42,63 @@ export default async function (call: ApiCall<ReqGetList, ResGetList>) {
gbzj: (await G.mongodb.cPlayerInfo('gbzj').findOne({uid: call.uid, type: 'gbzj'}))?.rec || {}
});
}
/**
*
* @param call
* @param list
*/
async function checkDataAndFix(call: ApiCall, list: ResGetList['list']) {
try {
// 修复配件数据
let peijianids = [];
Object.values(list).map(hero => {
hero.peijian && Object.values(hero.peijian).map(
i => peijianids.push(G.mongodb.conversionId(PeijianShared.fmt(i)._id))
)
});
let peijians = (await G.mongodb.collection("peijian").find(
{uid: call.uid, _id: {$in: peijianids}}, {projection: {_id: 1}}
).toArray()).map(temp => G.mongodb.conversionId(temp._id));
let shiwuIds = R.flatten(R.values(list).map(hero => R.values(hero.shiwu).map(i => G.mongodb.conversionId(i._id))))
let shiwus = (await G.mongodb.collection("shiwu").find(
{uid: call.uid, _id: {$in: shiwuIds}}, {projection: {_id: 1}}
).toArray()).map(i => G.mongodb.conversionId(i._id));
let peijianChanges = {};
let shiwuChanges = {};
Object.values(list).map(hero => {
for (let pos in hero.peijian) {
if (!peijians.includes(PeijianShared.fmt(hero.peijian[pos])._id)) {
hero.peijian[pos] = "";
peijianChanges[hero._id] = hero.peijian;
}
}
for (let pos in hero.shiwu) {
if (!shiwus.includes(hero.shiwu[pos]._id)) {
hero.shiwu = R.omit([pos], hero.shiwu)
shiwuChanges[hero._id] = hero.shiwu;
}
}
})
for (let oid in peijianChanges) {
// 修复数据
G.mongodb.collection("hero").updateOne(
G.mongodb.conversionIdObj({_id: oid}), {$set: {peijian: peijianChanges[oid]}}
)
}
for (let oid in shiwuChanges) {
// 修复数据
G.mongodb.collection("hero").updateOne(
G.mongodb.conversionIdObj({_id: oid}), {$set: {shiwu: shiwuChanges[oid]}}
)
}
} catch (e) {
console.log('======修复英雄配件和饰物报错====',e)
}
}

View File

@ -367,17 +367,21 @@ export class HuoDongHongDianFun {
/**破冰礼包红点 */
static async pobinglibao(call: ApiCall, _hd: ReqAddHuoDong): Promise<hongdianVal> {
let gift = _hd?.data?.gift?.find(i => i.free == true && !i.payId)
if (!gift) return {show: false}
if (gift) return {show: true}
let payLog = await PayFun.getPayLog(call.uid, gift.payId)
payLog = payLog?.filter(i => i.time >= _hd.stime && i.time <= _hd.etime) || []
if (!payLog || !payLog.length) return {show: false}
let payIds = _hd?.data?.gift?.filter(i=>i.payId).map(i=>i.payId)
let payLogs = await PayFun.getPayLogs(call.uid, payIds)
// 取奖励列表,判断是否有可领取奖励
let data = await G.mongodb.cEvent('pobinglibao').findOne({uid: call.uid, type: 'pobinglibao'})
let rec = data?.record?.[call.req.id].length
if (rec && (rec >= 3 || data?.record?.[gift.id] == call.req.recId)) return {show: false}
return {show: true}
for (let item of _hd?.data?.gift){
let rec = data?.record?.[item.id]?.length
if (item.free== true && !item.payId) return {show: true}
if (payLogs[item.payId]?.length && (!rec || rec < PublicShared.getDiff(payLogs[item.payId][0].time))) return {show: true}
}
return {show:false}
}
/**元旦活动红点 */

View File

@ -2,6 +2,7 @@ import {ApiCall} from "tsrpc";
import {JJCFun} from '../../public/jjc';
import {ReqOpen, ResOpen} from "../../shared/protocols/jjc/PtlOpen";
import {PublicShared} from '../../shared/public/public';
import {UserFun} from "../../public/user";
export default async function (call: ApiCall<ReqOpen, ResOpen>) {
const dbData = await JJCFun.getMyData(call.uid);
@ -28,6 +29,7 @@ export default async function (call: ApiCall<ReqOpen, ResOpen>) {
...enemy
});
UserFun.activeHeadFrame(call.uid, 'jjc_rank', data["rank"] + 1);
JJCFun.checkUpdatePlayer()
}

View File

@ -0,0 +1,155 @@
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 hdid = 1703860546; // 正式服活动id
// let hdid = 1703917224; // 测试服活动id
let today_zero_time = PublicShared.getToDayZeroTime();
// 查询今天登录的用户
let today_login_users = await G.mongodb.collection("user").find(
{ loginTime: { $gte: today_zero_time } },
{ projection: { uid: 1 } }
).toArray();
for (let i = 0; i < today_login_users.length; i++) {
let uid = today_login_users[i].uid;
let init: boolean = false;
let hdata: any = await G.mongodb.cEvent(`yuandan${hdid}`).findOne({
uid: uid, type: `yuandan${hdid}`
});
if (!hdata) {
init = true;
hdata = {
uid: uid,
gift: {},
qiandao: {},
gameNum: 0,
exchange: {},
taskfinish: [],
taskval: {
"1": 1,
"2": 0,
"3": 0,
"4": 0,
"5": 0,
"6": 0,
"7": 0,
"8": 0,
"9": 0
},
qiandaoTime: 1,
refreshTime: G.time,
type: `yuandan${hdid}`,
}
}
let taskval = {};
// taskid=1, stype=123 今日登录
taskval["1"] = 1;
// taskid=2, stype=158 今日参与抓娃娃次数
taskval["2"] = hdata.gameNum;
// taskid=3, stype=127 挑战 n 次清缴真主党
let myData = await G.mongodb.cPlayerInfo('qjzzd').findOne({ uid: uid, type: 'qjzzd' });
if (myData?.refreFightTime > PublicShared.getToDayZeroTime()) {
taskval["3"] = myData?.useFightNum || 0;
} else {
taskval["3"] = 0;
}
// taskid=4, stype=155 领取每日任务最终宝箱
let task = await G.mongodb.collection('task').findOne({ uid: uid, taskid: 25 });
if (task && task.lasttime >= today_zero_time && task.finish == 1) {
taskval["4"] = 1;
} else {
taskval["4"] = 0;
}
// taskid=5, stype=142 势力 配置xx 捐献进行 n 次捐献
let jxdata = await G.mongodb.collection('gonghuiUser').findOne({ uid: uid });
if (jxdata && jxdata.jx?.refreshTime > today_zero_time) {
if (jxdata.jx?.record) {
taskval["5"] = jxdata.jx.record["2"] || 0
}else{
taskval["5"] = 0
}
} else {
taskval["5"] = 0;
}
// taskid=6, stype=156 每日钻石消耗
taskval["6"] = 0;
let uselogs = (await G.mongodb.collection('rmbuse').find(
{ uid: uid, cTime: { $gte: today_zero_time }, isAdd: false },
{ projection: { change: 1 } }
).toArray()).forEach(e => { taskval["6"] += -e.change; });
// taskid=7, stype=122 进行 n 次快速探险
taskval["7"] = 0;
const data = await G.mongodb.collection('tanxian').findOne({ uid: uid });
if (data?.resetTime > PublicShared.getToDayZeroTime()) {
taskval["7"] = data.useFastGuaJiNum || 0
}
// taskid=8, stype=157 获得vip经验
let orde_logs = await G.mongodb.collection('payOrderLog' as any).find(
{ uid: uid, ctime: { $gte: today_zero_time * 1000 } },
).toArray();
taskval["8"] = 0;
orde_logs.forEach(e => {
let pay = G.gc.pay[e.payId];
if (pay) taskval["8"] += pay.payExp[0].n;
})
// taskid=9, stype=157 获得vip经验
taskval["9"] = 0;
orde_logs.forEach(e => {
let pay = G.gc.pay[e.payId];
if (pay) taskval["9"] += pay.payExp[0].n;
})
if (!init) {
await G.mongodb.cEvent(`yuandan${hdid}`).updateOne(
{ uid: uid, type: `yuandan${hdid}` },
{ $set: { taskval: taskval } }
)
} else {
hdata.taskval = taskval;
await G.mongodb.cEvent(`yuandan${hdid}`).updateOne({ uid: uid, type: `yuandan${hdid}` }, { $set: hdata }, { upsert: true })
}
console.log("玩家执行完成:", uid, taskval);
}
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

@ -1,6 +1,15 @@
import { Db, MongoClient } from "mongodb";
let logDB:Db;
let errorLogDB:Db;
/**
* G123的测试服
*/
function isG123stg(){
return G.config.mongodbUrl.indexOf('.stg.')!=-1;
}
async function connGameLogDB() {
console.log('connect gamelog mongodb ......');
let logDBUrl:string;
@ -14,9 +23,39 @@ async function connGameLogDB() {
maxIdleTimeMS: 5*60*1000
});
logDB = client.db(`gameLog${G.config.serverId}`);
errorLogDB = client.db(`nodeJsErrorLog`);
return logDB;
}
process.on('uncaughtException',function(err:Error){
addErrorLog((err.stack).toString());
})
process.on('unhandledRejection', function (err:Error, promise) {
addErrorLog((err.stack).toString());
})
async function addErrorLog(errData:any){
try{
//g123测试版连接不上db不抓取
if(isG123stg())return;
let log = {
serverId : G.config.serverId,
pid : process.pid,
cTime : Math.floor(Date.now()/1000),
error: errData
}
if(!errorLogDB){
await connGameLogDB();
}
errorLogDB.collection('nodeJsErrorLog').insertOne(log);
}catch(e){
console.error('addErrorLog',e);
}
}
/**
*
* @param uid uid
@ -27,6 +66,9 @@ async function connGameLogDB() {
export async function addGameLog(uid:string, type:string, req:any, data:any){
try{
//g123测试版连接不上db不抓取
if(isG123stg())return;
if(!logDB){
await connGameLogDB();
}
@ -38,7 +80,6 @@ export async function addGameLog(uid:string, type:string, req:any, data:any){
}
//事件时间
log['cTime'] = Math.floor(Date.now()/1000);
logDB.collection('gameLog').insertOne(log);
}catch(e){
console.error('addGameLog',e);

View File

@ -106,7 +106,8 @@ class _G {
/**跨服活动——消费竞赛的开启状态 */
huodong = {
xfjs: false
xfjs: false,
xfjsId: ''
};
private event = new EventEmitter();

View File

@ -39,13 +39,13 @@
],
//段位奖励
danPrize: [
{ star: [49, 49], prize: [{ a: 'item', t: '605', n:3 },{ a: 'item', t: '29', n:10 },{ a: 'item', t: '631', n:3 },{ a: 'item', t: '40', n:1 }] },
{ star: [39, 48], prize: [{ a: 'item', t: '605', n:2 },{ a: 'item', t: '29', n:5 },{ a: 'item', t: '631', n:2 }] },
{ star: [29, 38], prize: [{ a: 'item', t: '606', n:3 },{ a: 'item', t: '29', n:5 },{ a: 'item', t: '631', n:1 }] },
{ star: [21, 28], prize: [{ a: 'item', t: '606', n:2 },{ a: 'item', t: '29', n:5 },{ a: 'item', t: '39', n:1000 }] },
{ star: [13, 20], prize: [{ a: 'item', t: '606', n:1 },{ a: 'item', t: '29', n:5 },{ a: 'item', t: '39', n:800 }] },
{ star: [7, 12], prize: [{ a: 'item', t: '29', n:10 },{ a: 'item', t: '29', n:5 },{ a: 'item', t: '39', n:600 }] },
{ star: [0, 6], prize: [{ a: 'item', t: '29', n:5 },{ a: 'item', t: '29', n:5 },{ a: 'item', t: '39', n:400 }] }
{ star: 49, prize: [{ a: 'item', t: '605', n:3 },{ a: 'item', t: '29', n:10 },{ a: 'item', t: '631', n:3 },{ a: 'item', t: '40', n:1 }] },
{ star: 39, prize: [{ a: 'item', t: '605', n:2 },{ a: 'item', t: '29', n:5 },{ a: 'item', t: '631', n:2 }] },
{ star: 29, prize: [{ a: 'item', t: '606', n:3 },{ a: 'item', t: '29', n:5 },{ a: 'item', t: '631', n:1 }] },
{ star: 21, prize: [{ a: 'item', t: '606', n:2 },{ a: 'item', t: '29', n:5 },{ a: 'item', t: '39', n:1000 }] },
{ star: 13, prize: [{ a: 'item', t: '606', n:1 },{ a: 'item', t: '29', n:5 },{ a: 'item', t: '39', n:800 }] },
{ star: 7, prize: [{ a: 'item', t: '29', n:10 },{ a: 'item', t: '29', n:5 },{ a: 'item', t: '39', n:600 }] },
{ star: 0, prize: [{ a: 'item', t: '29', n:5 },{ a: 'item', t: '29', n:5 },{ a: 'item', t: '39', n:400 }] }
],
//王者排名邮件信息
email_rank: {

View File

@ -18,6 +18,11 @@
"n": 100
}
],
"pro": 0.6,
"fighter": [
0,
6
],
"npc": 60001
},
"1": {
@ -39,6 +44,11 @@
"n": 100
}
],
"pro": 0.6,
"fighter": [
0,
6
],
"npc": 60002
},
"2": {
@ -60,6 +70,11 @@
"n": 100
}
],
"pro": 0.6,
"fighter": [
0,
6
],
"npc": 60003
},
"3": {
@ -81,6 +96,11 @@
"n": 100
}
],
"pro": 0.6,
"fighter": [
0,
6
],
"npc": 60004
},
"4": {
@ -102,6 +122,11 @@
"n": 100
}
],
"pro": 0.6,
"fighter": [
0,
6
],
"npc": 60005
},
"5": {
@ -123,6 +148,11 @@
"n": 100
}
],
"pro": 0.6,
"fighter": [
0,
6
],
"npc": 60006
},
"6": {
@ -144,6 +174,11 @@
"n": 100
}
],
"pro": 0.6,
"fighter": [
0,
6
],
"npc": 60007
},
"7": {
@ -165,6 +200,11 @@
"n": 100
}
],
"pro": 0.6,
"fighter": [
7,
12
],
"npc": 60008
},
"8": {
@ -186,6 +226,11 @@
"n": 100
}
],
"pro": 0.6,
"fighter": [
7,
12
],
"npc": 60009
},
"9": {
@ -207,6 +252,11 @@
"n": 100
}
],
"pro": 0.6,
"fighter": [
7,
12
],
"npc": 60010
},
"10": {
@ -228,6 +278,11 @@
"n": 100
}
],
"pro": 0.6,
"fighter": [
7,
12
],
"npc": 60011
},
"11": {
@ -249,6 +304,11 @@
"n": 100
}
],
"pro": 0.6,
"fighter": [
7,
12
],
"npc": 60012
},
"12": {
@ -270,6 +330,11 @@
"n": 100
}
],
"pro": 0.6,
"fighter": [
7,
12
],
"npc": 60013
},
"13": {
@ -291,6 +356,11 @@
"n": 100
}
],
"pro": 0.3,
"fighter": [
13,
20
],
"npc": 60014
},
"14": {
@ -312,6 +382,11 @@
"n": 100
}
],
"pro": 0.3,
"fighter": [
13,
20
],
"npc": 60015
},
"15": {
@ -333,6 +408,11 @@
"n": 100
}
],
"pro": 0.3,
"fighter": [
13,
20
],
"npc": 60016
},
"16": {
@ -354,6 +434,11 @@
"n": 100
}
],
"pro": 0.3,
"fighter": [
13,
20
],
"npc": 60017
},
"17": {
@ -375,6 +460,11 @@
"n": 100
}
],
"pro": 0.3,
"fighter": [
13,
20
],
"npc": 60018
},
"18": {
@ -396,6 +486,11 @@
"n": 100
}
],
"pro": 0.3,
"fighter": [
13,
20
],
"npc": 60019
},
"19": {
@ -417,6 +512,11 @@
"n": 100
}
],
"pro": 0.3,
"fighter": [
13,
20
],
"npc": 60020
},
"20": {
@ -438,6 +538,11 @@
"n": 100
}
],
"pro": 0.3,
"fighter": [
13,
20
],
"npc": 60021
},
"21": {
@ -459,6 +564,11 @@
"n": 100
}
],
"pro": 0.3,
"fighter": [
21,
28
],
"npc": 60022
},
"22": {
@ -480,6 +590,11 @@
"n": 100
}
],
"pro": 0.3,
"fighter": [
21,
28
],
"npc": 60023
},
"23": {
@ -501,6 +616,11 @@
"n": 100
}
],
"pro": 0.3,
"fighter": [
21,
28
],
"npc": 60024
},
"24": {
@ -522,6 +642,11 @@
"n": 100
}
],
"pro": 0.3,
"fighter": [
21,
28
],
"npc": 60025
},
"25": {
@ -543,6 +668,11 @@
"n": 100
}
],
"pro": 0.3,
"fighter": [
21,
28
],
"npc": 60026
},
"26": {
@ -564,6 +694,11 @@
"n": 100
}
],
"pro": 0.3,
"fighter": [
21,
28
],
"npc": 60027
},
"27": {
@ -585,6 +720,11 @@
"n": 100
}
],
"pro": 0.3,
"fighter": [
21,
28
],
"npc": 60028
},
"28": {
@ -606,6 +746,11 @@
"n": 100
}
],
"pro": 0.3,
"fighter": [
21,
28
],
"npc": 60029
},
"29": {
@ -627,6 +772,11 @@
"n": 100
}
],
"pro": 0.15,
"fighter": [
29,
38
],
"npc": 60030
},
"30": {
@ -648,6 +798,11 @@
"n": 100
}
],
"pro": 0.15,
"fighter": [
29,
38
],
"npc": 60031
},
"31": {
@ -669,6 +824,11 @@
"n": 100
}
],
"pro": 0.15,
"fighter": [
29,
38
],
"npc": 60032
},
"32": {
@ -690,6 +850,11 @@
"n": 100
}
],
"pro": 0.15,
"fighter": [
29,
38
],
"npc": 60033
},
"33": {
@ -711,6 +876,11 @@
"n": 100
}
],
"pro": 0.15,
"fighter": [
29,
38
],
"npc": 60034
},
"34": {
@ -732,6 +902,11 @@
"n": 100
}
],
"pro": 0.15,
"fighter": [
29,
38
],
"npc": 60035
},
"35": {
@ -753,6 +928,11 @@
"n": 100
}
],
"pro": 0.15,
"fighter": [
29,
38
],
"npc": 60036
},
"36": {
@ -774,6 +954,11 @@
"n": 100
}
],
"pro": 0.15,
"fighter": [
29,
38
],
"npc": 60037
},
"37": {
@ -795,6 +980,11 @@
"n": 100
}
],
"pro": 0.15,
"fighter": [
29,
38
],
"npc": 60038
},
"38": {
@ -816,6 +1006,11 @@
"n": 100
}
],
"pro": 0.15,
"fighter": [
29,
38
],
"npc": 60039
},
"39": {
@ -837,6 +1032,11 @@
"n": 100
}
],
"pro": 0.15,
"fighter": [
39,
48
],
"npc": 60040
},
"40": {
@ -858,6 +1058,11 @@
"n": 100
}
],
"pro": 0.15,
"fighter": [
39,
48
],
"npc": 60041
},
"41": {
@ -879,6 +1084,11 @@
"n": 100
}
],
"pro": 0.15,
"fighter": [
39,
48
],
"npc": 60042
},
"42": {
@ -900,6 +1110,11 @@
"n": 100
}
],
"pro": 0.15,
"fighter": [
39,
48
],
"npc": 60043
},
"43": {
@ -921,6 +1136,11 @@
"n": 100
}
],
"pro": 0.15,
"fighter": [
39,
48
],
"npc": 60044
},
"44": {
@ -942,6 +1162,11 @@
"n": 100
}
],
"pro": 0.15,
"fighter": [
39,
48
],
"npc": 60045
},
"45": {
@ -963,6 +1188,11 @@
"n": 100
}
],
"pro": 0.15,
"fighter": [
39,
48
],
"npc": 60046
},
"46": {
@ -984,6 +1214,11 @@
"n": 100
}
],
"pro": 0.15,
"fighter": [
39,
48
],
"npc": 60047
},
"47": {
@ -1005,6 +1240,11 @@
"n": 100
}
],
"pro": 0.15,
"fighter": [
39,
48
],
"npc": 60048
},
"48": {
@ -1026,6 +1266,11 @@
"n": 100
}
],
"pro": 0.15,
"fighter": [
39,
48
],
"npc": 60049
},
"49": {
@ -1047,6 +1292,11 @@
"n": 100
}
],
"pro": 0,
"fighter": [
39,
49
],
"npc": 60050
}
}

View File

@ -2797,13 +2797,13 @@
{ idx: 0,total: 3, type: 'jieji', prize: [{a: 'item', t: '1', n: 500000}], des:'intr_cszl_des_1'},
{ idx: 1,total: 50, type: 'lv', prize: [{a: 'item', t: '12', n: 500}], des:'intr_cszl_des_2' },
{ idx: 2,total: 4, type: 'jieji', prize: [{a: 'item', t: '1', n: 500000}], des:'intr_cszl_des_1' },
{ idx: 3,total: 100, type: 'lv', prize: [{a: 'item', t: '12', n: 1000}], des:'intr_cszl_des_2' },
{ idx: 3,total: 90, type: 'lv', prize: [{a: 'item', t: '12', n: 1000}], des:'intr_cszl_des_2' },
{ idx: 4,total: 5, type: 'jieji', prize: [{a: 'item', t: '1', n: 800000}], des:'intr_cszl_des_1' },
{ idx: 5,total: 150, type: 'lv', prize: [{a: 'item', t: '12', n: 1500}], des:'intr_cszl_des_2' },
{ idx: 5,total: 130, type: 'lv', prize: [{a: 'item', t: '12', n: 1500}], des:'intr_cszl_des_2' },
{ idx: 6,total: 6, type: 'jieji', prize: [{a: 'item', t: '1', n: 1200000}], des:'intr_cszl_des_1' },
{ idx: 7,total: 200, type: 'lv', prize: [{a: 'item', t: '12', n: 2000}], des:'intr_cszl_des_2' },
{ idx: 7,total: 170, type: 'lv', prize: [{a: 'item', t: '12', n: 2000}], des:'intr_cszl_des_2' },
{ idx: 8,total: 7, type: 'jieji', prize: [{a: 'item', t: '1', n: 2000000}], des:'intr_cszl_des_1' },
{ idx: 9,total: 250, type: 'lv', prize: [{a: 'item', t: '5001', n: 20}], des:'intr_cszl_des_2' }
{ idx: 9,total: 210, type: 'lv', prize: [{a: 'item', t: '5001', n: 20}], des:'intr_cszl_des_2' }
],
//宝箱
box: { total: 10, prize: [{a: 'item', t: '610', n: 1}] }
@ -2825,16 +2825,16 @@
hid: '5002',
//任务
task: [
{ idx: 0,total: 3, type: 'jieji', prize: [{a: 'item', t: '1', n: 500000}], des:'intr_cszl_des_1'},
{ idx: 1,total: 50, type: 'lv', prize: [{a: 'item', t: '12', n: 500}], des:'intr_cszl_des_2' },
{ idx: 2,total: 4, type: 'jieji', prize: [{a: 'item', t: '1', n: 500000}], des:'intr_cszl_des_1' },
{ idx: 3,total: 100, type: 'lv', prize: [{a: 'item', t: '12', n: 1000}], des:'intr_cszl_des_2' },
{ idx: 4,total: 5, type: 'jieji', prize: [{a: 'item', t: '1', n: 800000}], des:'intr_cszl_des_1' },
{ idx: 5,total: 150, type: 'lv', prize: [{a: 'item', t: '12', n: 1500}], des:'intr_cszl_des_2' },
{ idx: 6,total: 6, type: 'jieji', prize: [{a: 'item', t: '1', n: 1200000}], des:'intr_cszl_des_1' },
{ idx: 7,total: 200, type: 'lv', prize: [{a: 'item', t: '12', n: 2000}], des:'intr_cszl_des_2' },
{ idx: 8,total: 7, type: 'jieji', prize: [{a: 'item', t: '1', n: 2000000}], des:'intr_cszl_des_1' },
{ idx: 9,total: 250, type: 'lv', prize: [{a: 'item', t: '5002', n: 20}], des:'intr_cszl_des_2' }
{ idx: 0,total: 80, type: 'lv', prize: [{a: 'item', t: '1', n: 500000}], des:'intr_cszl_des_1'},
{ idx: 1,total: 4, type: 'jieji', prize: [{a: 'item', t: '12', n: 500}], des:'intr_cszl_des_2' },
{ idx: 2,total: 120, type: 'lv', prize: [{a: 'item', t: '1', n: 500000}], des:'intr_cszl_des_1' },
{ idx: 3,total: 5, type: 'jieji', prize: [{a: 'item', t: '12', n: 1000}], des:'intr_cszl_des_2' },
{ idx: 4,total: 160, type: 'lv', prize: [{a: 'item', t: '1', n: 800000}], des:'intr_cszl_des_1' },
{ idx: 5,total: 6, type: 'jieji', prize: [{a: 'item', t: '12', n: 1500}], des:'intr_cszl_des_2' },
{ idx: 6,total: 200, type: 'lv', prize: [{a: 'item', t: '1', n: 1200000}], des:'intr_cszl_des_1' },
{ idx: 7,total: 7, type: 'jieji', prize: [{a: 'item', t: '12', n: 2000}], des:'intr_cszl_des_2' },
{ idx: 8,total: 240, type: 'lv', prize: [{a: 'item', t: '1', n: 2000000}], des:'intr_cszl_des_1' },
{ idx: 9,total: 8, type: 'jieji', prize: [{a: 'item', t: '5002', n: 20}], des:'intr_cszl_des_2' }
],
//宝箱
box: { total: 10, prize: [{a: 'item', t: '610', n: 1}] }
@ -2856,16 +2856,16 @@
hid: '5004',
//任务
task: [
{ idx: 0,total: 3, type: 'jieji', prize: [{a: 'item', t: '1', n: 500000}], des:'intr_cszl_des_1'},
{ idx: 1,total: 50, type: 'lv', prize: [{a: 'item', t: '12', n: 500}], des:'intr_cszl_des_2' },
{ idx: 2,total: 4, type: 'jieji', prize: [{a: 'item', t: '1', n: 500000}], des:'intr_cszl_des_1' },
{ idx: 3,total: 100, type: 'lv', prize: [{a: 'item', t: '12', n: 1000}], des:'intr_cszl_des_2' },
{ idx: 4,total: 5, type: 'jieji', prize: [{a: 'item', t: '1', n: 800000}], des:'intr_cszl_des_1' },
{ idx: 5,total: 150, type: 'lv', prize: [{a: 'item', t: '12', n: 1500}], des:'intr_cszl_des_2' },
{ idx: 6,total: 6, type: 'jieji', prize: [{a: 'item', t: '1', n: 1200000}], des:'intr_cszl_des_1' },
{ idx: 7,total: 200, type: 'lv', prize: [{a: 'item', t: '12', n: 2000}], des:'intr_cszl_des_2' },
{ idx: 8,total: 7, type: 'jieji', prize: [{a: 'item', t: '1', n: 2000000}], des:'intr_cszl_des_1' },
{ idx: 9,total: 250, type: 'lv', prize: [{a: 'item', t: '5004', n: 20}], des:'intr_cszl_des_2' }
{ idx: 0,total: 100, type: 'lv', prize: [{a: 'item', t: '1', n: 500000}], des:'intr_cszl_des_1'},
{ idx: 1,total: 5, type: 'jieji', prize: [{a: 'item', t: '12', n: 500}], des:'intr_cszl_des_2' },
{ idx: 2,total: 140, type: 'lv', prize: [{a: 'item', t: '1', n: 500000}], des:'intr_cszl_des_1' },
{ idx: 3,total: 6, type: 'jieji', prize: [{a: 'item', t: '12', n: 1000}], des:'intr_cszl_des_2' },
{ idx: 4,total: 180, type: 'lv', prize: [{a: 'item', t: '1', n: 800000}], des:'intr_cszl_des_1' },
{ idx: 5,total: 7, type: 'jieji', prize: [{a: 'item', t: '12', n: 1500}], des:'intr_cszl_des_2' },
{ idx: 6,total: 220, type: 'lv', prize: [{a: 'item', t: '1', n: 1200000}], des:'intr_cszl_des_1' },
{ idx: 7,total: 8, type: 'jieji', prize: [{a: 'item', t: '12', n: 2000}], des:'intr_cszl_des_2' },
{ idx: 8,total: 260, type: 'lv', prize: [{a: 'item', t: '1', n: 2000000}], des:'intr_cszl_des_1' },
{ idx: 9,total: 9, type: 'jieji', prize: [{a: 'item', t: '5004', n: 20}], des:'intr_cszl_des_2' }
],
//宝箱
box: { total: 10, prize: [{a: 'item', t: '610', n: 1}] }

View File

@ -225,8 +225,8 @@ export class PlayerFun {
}
G.mongodb.collection('rmbuse').insertOne(data);
// 消费竞赛开启时写入跨服数据库
if (G.huodong.xfjs && !data.isAdd) {
G.crossmongodb.collection('rmbuse').updateOne({uid: data.uid}, {
if (G.huodong.xfjs && !data.isAdd && typeof data.change == 'number') {
G.crossmongodb.collection('rmbuse').updateOne({uid: data.uid, type: `xfjs_${G.huodong.xfjsId}`}, {
$set: {time: G.time},
$inc: {change: data.change}
}, {upsert: true});

View File

@ -135,6 +135,10 @@ export abstract class Rank {
//将db里的数据写入到 rank:xxx:sort里
//写入的单条数据为: {uid:score}
// 首先清理redis中sort数据 在从数据库中初始化
await G.ioredis.del(this.getRedisKeySort);
this.db.find({ type: this.type }, {
projection: {
"idKey": 1,
@ -302,7 +306,8 @@ export abstract class Rank {
})
}
return res.map(ele => ele.data).sort(this.compareSort) as any;
// 按照redis uids 排序顺序排序
return res.sort((a,b)=>uids.indexOf(a.idKey)-uids.indexOf(b.idKey)).map(ele => ele.data);
}
return []
}

View File

@ -39,22 +39,20 @@ export class Scheduler_xfjs_Local_Ctor extends Scheduler {
let limit = _hd.data?.rank?.slice(-1)?.[0]?.rank?.slice(-1)?.[0] || 100
let rmbuse = await G.crossmongodb.collection('rmbuse').find({
time: {
$gte: _hd.stime,
$lte: _hd.etime + 10
}
}).sort({change: 1}).limit(limit).toArray()
let rmbuse = await G.crossmongodb.collection('rmbuse').find({type: `xfjs_${_hd.hdid}`}).sort({change: 1}).limit(limit).toArray()
let list: any = rmbuse.map(i => ({...i, total: R.negate(i.change)}))
let ranklist = sortRankList(_hd.data.rank, list)
let rankList = sortRankList(_hd.data.rank, list)
let userList = await G.crossmongodb.collection('huodong_user').find({uid: {$in: rankList.map(i => i._id).filter(i => i != 'system')}}).toArray()
rankList = rankList.map(i => ({...i, player: userList.find(v => v.uid == i.uid) || {}}))
R.forEach(i => {
let users = R.slice(i.rank[0] - 1, i.rank[1])(ranklist)
let users = R.slice(i.rank[0] - 1, i.rank[1])(rankList).filter(i => i._id != 'system')
users.map(v => {
if (v._id == 'system') return
if (G.config.serverId != users.sid) return;
if (G.config.serverId != v.player?.sid) return;
EmailFun.addEmail({
uid: v._id,
type: 'system',

View File

@ -279,9 +279,11 @@ export class UserFun {
if (k == 'wxcLv') val = gud.wxcLv.lv;
else if (gud[k] != undefined) val = gud[k];
if (k == 'jjc_rank' && !gud.headFrames[conf.id] && val <= conf.cond[1]) {
if (k == 'jjc_rank') {
if (!gud.headFrames[conf.id] && val <= conf.cond[1]) {
gud.headFrames[conf.id] = -1;
change = true;
} else return
} else if (!gud.headFrames[conf.id] && val >= conf.cond[1]) {
gud.headFrames[conf.id] = -1;
change = true;

View File

@ -16,4 +16,6 @@ export type ResOpen = {
payNum: number;
/**活动信息 */
hdinfo: ReqAddHuoDong;
/** 当前领取轮次 */
round: number
};

View File

@ -10263,6 +10263,13 @@ export const serviceProto: ServiceProto<ServiceType> = {
"type": "Reference",
"target": "../../monopoly/protocols/PtlAddHuoDong/ReqAddHuoDong"
}
},
{
"id": 4,
"name": "round",
"type": {
"type": "Number"
}
}
]
},