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

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

@ -1,32 +1,38 @@
import { ApiCall } from "tsrpc"; import {ApiCall} from "tsrpc";
import { HuoDongFun } from "../../../public/huodongfun"; import {HuoDongFun} from "../../../public/huodongfun";
import { PayFun } from '../../../public/pay'; import {PayFun} from '../../../public/pay';
import { ReqOpen, ResOpen } from "../../../shared/protocols/event/leijichongzhi/PtlOpen"; import {ReqOpen, ResOpen} from "../../../shared/protocols/event/leijichongzhi/PtlOpen";
import { PublicShared } from '../../../shared/public/public'; import {PublicShared} from '../../../shared/public/public';
import {checkNextRound} from "./ApiRec";
export default async function (call: ApiCall<ReqOpen, ResOpen>) { export default async function (call: ApiCall<ReqOpen, ResOpen>) {
let _hdinfo = await HuoDongFun.getHdidInfo(call, call.req.hdid) let _hdinfo = await HuoDongFun.getHdidInfo(call, call.req.hdid)
if (!_hdinfo || Object.keys(_hdinfo).length <= 0) { if (!_hdinfo || Object.keys(_hdinfo).length <= 0) {
// 无此活动 // 无此活动
return call.error('', { code: -1, message: globalThis.lng.huodong_open_1 }) return call.error('', {code: -1, message: globalThis.lng.huodong_open_1})
} }
let _dbType: `leijichongzhi${number}` = `leijichongzhi${call.req.hdid}` let _dbType: `leijichongzhi${number}` = `leijichongzhi${call.req.hdid}`
let db = await G.mongodb.cEvent(_dbType).findOne({ uid: call.uid, type: _dbType }); let db = await G.mongodb.cEvent(_dbType).findOne({uid: call.uid, type: _dbType});
let sTime = db?.sTime || PublicShared.getToDayZeroTime(G.time); let sTime = db?.sTime || PublicShared.getToDayZeroTime(G.time);
if (!db) { if (!db) {
G.mongodb.cEvent(_dbType).updateOne( await G.mongodb.cEvent(_dbType).updateOne(
{ uid: call.uid, type: _dbType }, {uid: call.uid, type: _dbType},
{ $set: { sTime: sTime, recIndex: [] } }, {$set: {sTime: sTime, recIndex: []}},
{ upsert: true } {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({ call.succ({
sTime: sTime, sTime: sTime,
recIndex: db?.recIndex || [], recIndex: db?.recIndex || [],
payNum: (await PayFun.getPayDaysAllPayNum(call.uid, _hdinfo.stime, _hdinfo.rtime)) * 10, payNum: payNum,
hdinfo: _hdinfo hdinfo: _hdinfo,
round: db.round || 0
}); });
} }

View File

@ -1,37 +1,49 @@
import { ApiCall } from "tsrpc"; import {ApiCall} from "tsrpc";
import { HuoDongFun } from "../../../public/huodongfun"; import {HuoDongFun} from "../../../public/huodongfun";
import { PayFun } from '../../../public/pay'; import {PayFun} from '../../../public/pay';
import { PlayerFun } from '../../../public/player'; import {PlayerFun} from '../../../public/player';
import { ReqRec, ResRec } from "../../../shared/protocols/event/leijichongzhi/PtlRec"; import {ReqRec, ResRec} from "../../../shared/protocols/event/leijichongzhi/PtlRec";
import { HongDianChange } from "../../hongdian/fun"; import {HongDianChange} from "../../hongdian/fun";
export default async function (call: ApiCall<ReqRec, ResRec>) { export default async function (call: ApiCall<ReqRec, ResRec>) {
let _hdinfo = await HuoDongFun.getHdidInfo(call, call.req.hdid) let _hdinfo = await HuoDongFun.getHdidInfo(call, call.req.hdid)
if (!_hdinfo || Object.keys(_hdinfo).length <= 0) { if (!_hdinfo || Object.keys(_hdinfo).length <= 0) {
// 无此活动 // 无此活动
return call.error('', { code: -1, message: globalThis.lng.huodong_open_1 }) return call.error('', {code: -1, message: globalThis.lng.huodong_open_1})
} }
let _dbType: `leijichongzhi${number}` = `leijichongzhi${call.req.hdid}` let _dbType: `leijichongzhi${number}` = `leijichongzhi${call.req.hdid}`
let conf = _hdinfo.data.tasks[call.req.index]; let conf = _hdinfo.data.tasks[call.req.index];
if (!conf) return call.error('', { code: -1 }); if (!conf) return call.error('', {code: -1});
let db = await G.mongodb.cEvent(_dbType).findOne({ uid: call.uid, type: _dbType }); let db = await G.mongodb.cEvent(_dbType).findOne({uid: call.uid, type: _dbType});
if (db.recIndex.includes(call.req.index)) return call.error('', { code: -2 }); if (db.recIndex.includes(call.req.index)) return call.error('', {code: -2});
let payNum = (await PayFun.getPayDaysAllPayNum(call.uid, _hdinfo.stime, _hdinfo.rtime)) * 10; let payNum = (await PayFun.getPayDaysAllPayNum(call.uid, _hdinfo.stime, _hdinfo.rtime)) * 10;
if (payNum < conf.total) return call.error('', { code: -3 }); 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); await PlayerFun.sendPrize(call, conf.prize);
G.mongodb.cEvent(_dbType).updateOne( await G.mongodb.cEvent(_dbType).updateOne(
{ uid: call.uid, type: _dbType }, {uid: call.uid, type: _dbType},
{ $push: { recIndex: call.req.index } } {$push: {recIndex: call.req.index}}
); );
await checkNextRound(call, db, _hdinfo.data.tasks)
HongDianChange.sendChangeKey(call.uid, ['huodonghd']) HongDianChange.sendChangeKey(call.uid, ['huodonghd'])
call.succ({ call.succ({
prize: conf.prize 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({}) 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 limit = _hd.data?.rank?.slice(-1)?.[0]?.rank?.slice(-1)?.[0] || call.req.limit || 100
let rmbuse = await G.crossmongodb.collection('rmbuse').find({ let rmbuse = await G.crossmongodb.collection('rmbuse').find({type: `xfjs_${G.huodong.xfjsId}`}).sort({change: 1}).limit(limit).toArray()
time: {
$gte: _hd.stime,
$lte: _hd.etime + 10
}
}).sort({change: 1}).limit(limit).toArray()
let list: any = rmbuse.map(i => ({...i, total: R.negate(i.change)})) 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 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) || {}})) rankList = rankList.map(i => ({...i, player: users.find(v => v.uid == i.uid) || {}}))
// 活动结束前半小时,缓存过期时间改为10 // 活动结束前半小时,缓存过期时间改为5
let exTime = (G.time + 1800) > _hd.etime ? 10 : 60 let exTime = (G.time + 1800) > _hd.etime ? 5 : 10
G.crossioredis.setex(`rank:xiaofeijingsai`, exTime, JSON.stringify(rankList)); 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) { export function sortRankList(rank, list) {
let rankList = [] let rankList = []
let ccc = 0
rank.map(i => { rank.map(i => {
for (let k = i.rank[0] - 1; k < i.rank[1]; k++) { for (let k = i.rank[0] - 1; k < i.rank[1]; k++) {
if (list[k]?.total >= i.need[0].n) { if (list[0]?.total >= i.need[0].n) {
rankList.push({...list[k - ccc], rank: k, _id: list[k - ccc].uid}) rankList.push({...list[0], rank: k, _id: list[0].uid})
list = R.tail(list)
} else { } else {
rankList.push({_id: 'system', total: i.need[0].n, rank: k, player: {}}) 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) let myData = rankList.find(i => i._id == call.uid)
if (myData) return myData 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}) let myUser = await G.mongodb.collection('user').findOne({uid: call.uid})
G.crossmongodb.collection('huodong_user').updateOne({uid: call.uid}, {$set: myUser}, {upsert: true}) 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} 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); G.huodong.xfjs = !!_hdList.find(i => i.htype == 11);
if (G.huodong.xfjs) { 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}) let myUser = await G.mongodb.collection('user').findOne({uid: call.uid})
G.crossmongodb.collection('huodong_user').updateOne({uid: call.uid}, {$set: myUser}, {upsert: true}) G.crossmongodb.collection('huodong_user').updateOne({uid: call.uid}, {$set: myUser}, {upsert: true})
} }

View File

@ -1,18 +1,16 @@
import { ApiCall } from "tsrpc"; import {ApiCall} from "tsrpc";
import { Rank } from '../../../public/rank/rank'; import {Rank} from '../../../public/rank/rank';
import { ReqOpen, ResOpen } from "../../../shared/protocols/hbzb/jfs/PtlOpen"; import {ReqOpen, ResOpen} from "../../../shared/protocols/hbzb/jfs/PtlOpen";
import { PublicShared } from '../../../shared/public/public'; import {PublicShared} from '../../../shared/public/public';
import { getHbzbData, getMyRank, getToper200RankUid, updateHbzbCrossUser } from "./fun"; import {getHbzbData, getMyRank, getToper200RankUid, updateHbzbCrossUser} from "./fun";
export default async function (call: ApiCall<ReqOpen, ResOpen>) { export default async function (call: ApiCall<ReqOpen, ResOpen>) {
//查看本地数据库里,刷出来的玩家数据 //查看本地数据库里,刷出来的玩家数据
let dbData = await getHbzbData(call.uid ); let dbData = await getHbzbData(call.uid);
let data: typeof dbData.data = dbData?.data || {} as any; let data: typeof dbData.data = dbData?.data || {} as any;
if (dbData == null) { //如果没有,则同步到跨服
//如果没有,则同步到跨服 await updateHbzbCrossUser(await call.conn.getDefaultFightData(), dbData == null);
await updateHbzbCrossUser(await call.conn.getDefaultFightData(), true);
}
if (!data.refreshTime || data.refreshTime < PublicShared.getToDayZeroTime()) { if (!data.refreshTime || data.refreshTime < PublicShared.getToDayZeroTime()) {
data.winNum = 0; data.winNum = 0;
@ -26,24 +24,27 @@ export default async function (call: ApiCall<ReqOpen, ResOpen>) {
//积分赛时的排行榜,是本服积分排序 //积分赛时的排行榜,是本服积分排序
data.jifen = 0; data.jifen = 0;
//但是刷出来的对手,是跨服的玩家 //但是刷出来的对手,是跨服的玩家
let callRes = await G.clientCross.callApi('hbzb/jfs/GetEnemy', { uid: call.uid, auto: true }); let callRes = await G.clientCross.callApi('hbzb/jfs/GetEnemy', {uid: call.uid, auto: true});
if (!callRes.isSucc){ if (!callRes.isSucc) {
//todo 健壮性处理 //todo 健壮性处理
return call.errorCode(-4) return call.errorCode(-4)
} }
if (callRes.res.enemy.length) if (callRes.res?.enemy?.length)
data.enemy = callRes.res.enemy.map(e => { return { ...e, result: null }; }); data.enemy = callRes.res.enemy.map(e => {
return {...e, result: null};
});
} }
G.mongodb.cPlayerInfo('hbzb').updateOne( G.mongodb.cPlayerInfo('hbzb').updateOne(
{ uid: call.uid, type: 'hbzb' }, {uid: call.uid, type: 'hbzb'},
{ $set: { data: data } }, {$set: {data: data}},
{ upsert: true } {upsert: true}
); );
} }
call.succ({ call.succ({
...data, ...data,
enemy: data.enemy || [],
rank: await getMyRank(call.uid) 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; color[heroCon[v.heroId].colour] += 1;
}); });
// 修复配件数据 await checkDataAndFix(call, list)
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 G.mongodb.collection('playerInfo', 'usertasklog').updateOne({uid: call.conn.uid, type: 'usertasklog'}, await G.mongodb.collection('playerInfo', 'usertasklog').updateOne({uid: call.conn.uid, type: 'usertasklog'},
@ -68,4 +41,64 @@ export default async function (call: ApiCall<ReqGetList, ResGetList>) {
lshd: heros || {}, lshd: heros || {},
gbzj: (await G.mongodb.cPlayerInfo('gbzj').findOne({uid: call.uid, type: 'gbzj'}))?.rec || {} 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> { static async pobinglibao(call: ApiCall, _hd: ReqAddHuoDong): Promise<hongdianVal> {
let gift = _hd?.data?.gift?.find(i => i.free == true && !i.payId) 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) let payIds = _hd?.data?.gift?.filter(i=>i.payId).map(i=>i.payId)
payLog = payLog?.filter(i => i.time >= _hd.stime && i.time <= _hd.etime) || [] let payLogs = await PayFun.getPayLogs(call.uid, payIds)
if (!payLog || !payLog.length) return {show: false}
// 取奖励列表,判断是否有可领取奖励 // 取奖励列表,判断是否有可领取奖励
let data = await G.mongodb.cEvent('pobinglibao').findOne({uid: call.uid, type: 'pobinglibao'}) 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} for (let item of _hd?.data?.gift){
return {show: true} 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 {JJCFun} from '../../public/jjc';
import {ReqOpen, ResOpen} from "../../shared/protocols/jjc/PtlOpen"; import {ReqOpen, ResOpen} from "../../shared/protocols/jjc/PtlOpen";
import {PublicShared} from '../../shared/public/public'; import {PublicShared} from '../../shared/public/public';
import {UserFun} from "../../public/user";
export default async function (call: ApiCall<ReqOpen, ResOpen>) { export default async function (call: ApiCall<ReqOpen, ResOpen>) {
const dbData = await JJCFun.getMyData(call.uid); const dbData = await JJCFun.getMyData(call.uid);
@ -28,6 +29,7 @@ export default async function (call: ApiCall<ReqOpen, ResOpen>) {
...enemy ...enemy
}); });
UserFun.activeHeadFrame(call.uid, 'jjc_rank', data["rank"] + 1);
JJCFun.checkUpdatePlayer() 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"; import { Db, MongoClient } from "mongodb";
let logDB:Db; let logDB:Db;
let errorLogDB:Db;
/**
* G123的测试服
*/
function isG123stg(){
return G.config.mongodbUrl.indexOf('.stg.')!=-1;
}
async function connGameLogDB() { async function connGameLogDB() {
console.log('connect gamelog mongodb ......'); console.log('connect gamelog mongodb ......');
let logDBUrl:string; let logDBUrl:string;
@ -14,9 +23,39 @@ async function connGameLogDB() {
maxIdleTimeMS: 5*60*1000 maxIdleTimeMS: 5*60*1000
}); });
logDB = client.db(`gameLog${G.config.serverId}`); logDB = client.db(`gameLog${G.config.serverId}`);
errorLogDB = client.db(`nodeJsErrorLog`);
return logDB; 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 * @param uid uid
@ -27,6 +66,9 @@ async function connGameLogDB() {
export async function addGameLog(uid:string, type:string, req:any, data:any){ export async function addGameLog(uid:string, type:string, req:any, data:any){
try{ try{
//g123测试版连接不上db不抓取
if(isG123stg())return;
if(!logDB){ if(!logDB){
await connGameLogDB(); 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); log['cTime'] = Math.floor(Date.now()/1000);
logDB.collection('gameLog').insertOne(log); logDB.collection('gameLog').insertOne(log);
}catch(e){ }catch(e){
console.error('addGameLog',e); console.error('addGameLog',e);

View File

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

View File

@ -39,13 +39,13 @@
], ],
//段位奖励 //段位奖励
danPrize: [ 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: 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: 39, 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: 29, 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: 21, 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: 13, 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: 7, 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: 0, prize: [{ a: 'item', t: '29', n:5 },{ a: 'item', t: '29', n:5 },{ a: 'item', t: '39', n:400 }] }
], ],
//王者排名邮件信息 //王者排名邮件信息
email_rank: { email_rank: {

View File

@ -18,6 +18,11 @@
"n": 100 "n": 100
} }
], ],
"pro": 0.6,
"fighter": [
0,
6
],
"npc": 60001 "npc": 60001
}, },
"1": { "1": {
@ -39,6 +44,11 @@
"n": 100 "n": 100
} }
], ],
"pro": 0.6,
"fighter": [
0,
6
],
"npc": 60002 "npc": 60002
}, },
"2": { "2": {
@ -60,6 +70,11 @@
"n": 100 "n": 100
} }
], ],
"pro": 0.6,
"fighter": [
0,
6
],
"npc": 60003 "npc": 60003
}, },
"3": { "3": {
@ -81,6 +96,11 @@
"n": 100 "n": 100
} }
], ],
"pro": 0.6,
"fighter": [
0,
6
],
"npc": 60004 "npc": 60004
}, },
"4": { "4": {
@ -102,6 +122,11 @@
"n": 100 "n": 100
} }
], ],
"pro": 0.6,
"fighter": [
0,
6
],
"npc": 60005 "npc": 60005
}, },
"5": { "5": {
@ -123,6 +148,11 @@
"n": 100 "n": 100
} }
], ],
"pro": 0.6,
"fighter": [
0,
6
],
"npc": 60006 "npc": 60006
}, },
"6": { "6": {
@ -144,6 +174,11 @@
"n": 100 "n": 100
} }
], ],
"pro": 0.6,
"fighter": [
0,
6
],
"npc": 60007 "npc": 60007
}, },
"7": { "7": {
@ -165,6 +200,11 @@
"n": 100 "n": 100
} }
], ],
"pro": 0.6,
"fighter": [
7,
12
],
"npc": 60008 "npc": 60008
}, },
"8": { "8": {
@ -186,6 +226,11 @@
"n": 100 "n": 100
} }
], ],
"pro": 0.6,
"fighter": [
7,
12
],
"npc": 60009 "npc": 60009
}, },
"9": { "9": {
@ -207,6 +252,11 @@
"n": 100 "n": 100
} }
], ],
"pro": 0.6,
"fighter": [
7,
12
],
"npc": 60010 "npc": 60010
}, },
"10": { "10": {
@ -228,6 +278,11 @@
"n": 100 "n": 100
} }
], ],
"pro": 0.6,
"fighter": [
7,
12
],
"npc": 60011 "npc": 60011
}, },
"11": { "11": {
@ -249,6 +304,11 @@
"n": 100 "n": 100
} }
], ],
"pro": 0.6,
"fighter": [
7,
12
],
"npc": 60012 "npc": 60012
}, },
"12": { "12": {
@ -270,6 +330,11 @@
"n": 100 "n": 100
} }
], ],
"pro": 0.6,
"fighter": [
7,
12
],
"npc": 60013 "npc": 60013
}, },
"13": { "13": {
@ -291,6 +356,11 @@
"n": 100 "n": 100
} }
], ],
"pro": 0.3,
"fighter": [
13,
20
],
"npc": 60014 "npc": 60014
}, },
"14": { "14": {
@ -312,6 +382,11 @@
"n": 100 "n": 100
} }
], ],
"pro": 0.3,
"fighter": [
13,
20
],
"npc": 60015 "npc": 60015
}, },
"15": { "15": {
@ -333,6 +408,11 @@
"n": 100 "n": 100
} }
], ],
"pro": 0.3,
"fighter": [
13,
20
],
"npc": 60016 "npc": 60016
}, },
"16": { "16": {
@ -354,6 +434,11 @@
"n": 100 "n": 100
} }
], ],
"pro": 0.3,
"fighter": [
13,
20
],
"npc": 60017 "npc": 60017
}, },
"17": { "17": {
@ -375,6 +460,11 @@
"n": 100 "n": 100
} }
], ],
"pro": 0.3,
"fighter": [
13,
20
],
"npc": 60018 "npc": 60018
}, },
"18": { "18": {
@ -396,6 +486,11 @@
"n": 100 "n": 100
} }
], ],
"pro": 0.3,
"fighter": [
13,
20
],
"npc": 60019 "npc": 60019
}, },
"19": { "19": {
@ -417,6 +512,11 @@
"n": 100 "n": 100
} }
], ],
"pro": 0.3,
"fighter": [
13,
20
],
"npc": 60020 "npc": 60020
}, },
"20": { "20": {
@ -438,6 +538,11 @@
"n": 100 "n": 100
} }
], ],
"pro": 0.3,
"fighter": [
13,
20
],
"npc": 60021 "npc": 60021
}, },
"21": { "21": {
@ -459,6 +564,11 @@
"n": 100 "n": 100
} }
], ],
"pro": 0.3,
"fighter": [
21,
28
],
"npc": 60022 "npc": 60022
}, },
"22": { "22": {
@ -480,6 +590,11 @@
"n": 100 "n": 100
} }
], ],
"pro": 0.3,
"fighter": [
21,
28
],
"npc": 60023 "npc": 60023
}, },
"23": { "23": {
@ -501,6 +616,11 @@
"n": 100 "n": 100
} }
], ],
"pro": 0.3,
"fighter": [
21,
28
],
"npc": 60024 "npc": 60024
}, },
"24": { "24": {
@ -522,6 +642,11 @@
"n": 100 "n": 100
} }
], ],
"pro": 0.3,
"fighter": [
21,
28
],
"npc": 60025 "npc": 60025
}, },
"25": { "25": {
@ -543,6 +668,11 @@
"n": 100 "n": 100
} }
], ],
"pro": 0.3,
"fighter": [
21,
28
],
"npc": 60026 "npc": 60026
}, },
"26": { "26": {
@ -564,6 +694,11 @@
"n": 100 "n": 100
} }
], ],
"pro": 0.3,
"fighter": [
21,
28
],
"npc": 60027 "npc": 60027
}, },
"27": { "27": {
@ -585,6 +720,11 @@
"n": 100 "n": 100
} }
], ],
"pro": 0.3,
"fighter": [
21,
28
],
"npc": 60028 "npc": 60028
}, },
"28": { "28": {
@ -606,6 +746,11 @@
"n": 100 "n": 100
} }
], ],
"pro": 0.3,
"fighter": [
21,
28
],
"npc": 60029 "npc": 60029
}, },
"29": { "29": {
@ -627,6 +772,11 @@
"n": 100 "n": 100
} }
], ],
"pro": 0.15,
"fighter": [
29,
38
],
"npc": 60030 "npc": 60030
}, },
"30": { "30": {
@ -648,6 +798,11 @@
"n": 100 "n": 100
} }
], ],
"pro": 0.15,
"fighter": [
29,
38
],
"npc": 60031 "npc": 60031
}, },
"31": { "31": {
@ -669,6 +824,11 @@
"n": 100 "n": 100
} }
], ],
"pro": 0.15,
"fighter": [
29,
38
],
"npc": 60032 "npc": 60032
}, },
"32": { "32": {
@ -690,6 +850,11 @@
"n": 100 "n": 100
} }
], ],
"pro": 0.15,
"fighter": [
29,
38
],
"npc": 60033 "npc": 60033
}, },
"33": { "33": {
@ -711,6 +876,11 @@
"n": 100 "n": 100
} }
], ],
"pro": 0.15,
"fighter": [
29,
38
],
"npc": 60034 "npc": 60034
}, },
"34": { "34": {
@ -732,6 +902,11 @@
"n": 100 "n": 100
} }
], ],
"pro": 0.15,
"fighter": [
29,
38
],
"npc": 60035 "npc": 60035
}, },
"35": { "35": {
@ -753,6 +928,11 @@
"n": 100 "n": 100
} }
], ],
"pro": 0.15,
"fighter": [
29,
38
],
"npc": 60036 "npc": 60036
}, },
"36": { "36": {
@ -774,6 +954,11 @@
"n": 100 "n": 100
} }
], ],
"pro": 0.15,
"fighter": [
29,
38
],
"npc": 60037 "npc": 60037
}, },
"37": { "37": {
@ -795,6 +980,11 @@
"n": 100 "n": 100
} }
], ],
"pro": 0.15,
"fighter": [
29,
38
],
"npc": 60038 "npc": 60038
}, },
"38": { "38": {
@ -816,6 +1006,11 @@
"n": 100 "n": 100
} }
], ],
"pro": 0.15,
"fighter": [
29,
38
],
"npc": 60039 "npc": 60039
}, },
"39": { "39": {
@ -837,6 +1032,11 @@
"n": 100 "n": 100
} }
], ],
"pro": 0.15,
"fighter": [
39,
48
],
"npc": 60040 "npc": 60040
}, },
"40": { "40": {
@ -858,6 +1058,11 @@
"n": 100 "n": 100
} }
], ],
"pro": 0.15,
"fighter": [
39,
48
],
"npc": 60041 "npc": 60041
}, },
"41": { "41": {
@ -879,6 +1084,11 @@
"n": 100 "n": 100
} }
], ],
"pro": 0.15,
"fighter": [
39,
48
],
"npc": 60042 "npc": 60042
}, },
"42": { "42": {
@ -900,6 +1110,11 @@
"n": 100 "n": 100
} }
], ],
"pro": 0.15,
"fighter": [
39,
48
],
"npc": 60043 "npc": 60043
}, },
"43": { "43": {
@ -921,6 +1136,11 @@
"n": 100 "n": 100
} }
], ],
"pro": 0.15,
"fighter": [
39,
48
],
"npc": 60044 "npc": 60044
}, },
"44": { "44": {
@ -942,6 +1162,11 @@
"n": 100 "n": 100
} }
], ],
"pro": 0.15,
"fighter": [
39,
48
],
"npc": 60045 "npc": 60045
}, },
"45": { "45": {
@ -963,6 +1188,11 @@
"n": 100 "n": 100
} }
], ],
"pro": 0.15,
"fighter": [
39,
48
],
"npc": 60046 "npc": 60046
}, },
"46": { "46": {
@ -984,6 +1214,11 @@
"n": 100 "n": 100
} }
], ],
"pro": 0.15,
"fighter": [
39,
48
],
"npc": 60047 "npc": 60047
}, },
"47": { "47": {
@ -1005,6 +1240,11 @@
"n": 100 "n": 100
} }
], ],
"pro": 0.15,
"fighter": [
39,
48
],
"npc": 60048 "npc": 60048
}, },
"48": { "48": {
@ -1026,6 +1266,11 @@
"n": 100 "n": 100
} }
], ],
"pro": 0.15,
"fighter": [
39,
48
],
"npc": 60049 "npc": 60049
}, },
"49": { "49": {
@ -1047,6 +1292,11 @@
"n": 100 "n": 100
} }
], ],
"pro": 0,
"fighter": [
39,
49
],
"npc": 60050 "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: 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: 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: 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: 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: 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: 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}] } box: { total: 10, prize: [{a: 'item', t: '610', n: 1}] }
@ -2825,16 +2825,16 @@
hid: '5002', hid: '5002',
//任务 //任务
task: [ task: [
{ idx: 0,total: 3, type: 'jieji', prize: [{a: 'item', t: '1', n: 500000}], des:'intr_cszl_des_1'}, { idx: 0,total: 80, type: 'lv', 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: 1,total: 4, type: 'jieji', 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: 2,total: 120, type: 'lv', 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: 5, type: 'jieji', 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: 4,total: 160, type: 'lv', 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: 6, type: 'jieji', 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: 6,total: 200, type: 'lv', 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: 7, type: 'jieji', 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: 8,total: 240, type: 'lv', 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: 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}] } box: { total: 10, prize: [{a: 'item', t: '610', n: 1}] }
@ -2856,16 +2856,16 @@
hid: '5004', hid: '5004',
//任务 //任务
task: [ task: [
{ idx: 0,total: 3, type: 'jieji', prize: [{a: 'item', t: '1', n: 500000}], des:'intr_cszl_des_1'}, { idx: 0,total: 100, type: 'lv', 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: 1,total: 5, type: 'jieji', 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: 2,total: 140, type: 'lv', 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: 6, type: 'jieji', 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: 4,total: 180, type: 'lv', 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: 7, type: 'jieji', 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: 6,total: 220, type: 'lv', 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: 8, type: 'jieji', 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: 8,total: 260, type: 'lv', 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: 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}] } 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); G.mongodb.collection('rmbuse').insertOne(data);
// 消费竞赛开启时写入跨服数据库 // 消费竞赛开启时写入跨服数据库
if (G.huodong.xfjs && !data.isAdd) { if (G.huodong.xfjs && !data.isAdd && typeof data.change == 'number') {
G.crossmongodb.collection('rmbuse').updateOne({uid: data.uid}, { G.crossmongodb.collection('rmbuse').updateOne({uid: data.uid, type: `xfjs_${G.huodong.xfjsId}`}, {
$set: {time: G.time}, $set: {time: G.time},
$inc: {change: data.change} $inc: {change: data.change}
}, {upsert: true}); }, {upsert: true});

View File

@ -135,7 +135,11 @@ export abstract class Rank {
//将db里的数据写入到 rank:xxx:sort里 //将db里的数据写入到 rank:xxx:sort里
//写入的单条数据为: {uid:score} //写入的单条数据为: {uid:score}
this.db.find({ type: this.type }, {
// 首先清理redis中sort数据 在从数据库中初始化
await G.ioredis.del(this.getRedisKeySort);
this.db.find({ type: this.type }, {
projection: { projection: {
"idKey": 1, "idKey": 1,
"type": 1, "type": 1,
@ -263,7 +267,7 @@ export abstract class Rank {
} }
return item; return item;
}) })
if(ghid.length > 0){ if (ghid.length > 0) {
let ghinfo = await G.mongodb.collection("gonghui").find( let ghinfo = await G.mongodb.collection("gonghui").find(
{ _id: { $in: ghid } }, { projection: { name: 1 } } { _id: { $in: ghid } }, { projection: { name: 1 } }
).toArray(); ).toArray();
@ -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 [] 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 limit = _hd.data?.rank?.slice(-1)?.[0]?.rank?.slice(-1)?.[0] || 100
let rmbuse = await G.crossmongodb.collection('rmbuse').find({ let rmbuse = await G.crossmongodb.collection('rmbuse').find({type: `xfjs_${_hd.hdid}`}).sort({change: 1}).limit(limit).toArray()
time: {
$gte: _hd.stime,
$lte: _hd.etime + 10
}
}).sort({change: 1}).limit(limit).toArray()
let list: any = rmbuse.map(i => ({...i, total: R.negate(i.change)})) 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 => { 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 => { users.map(v => {
if (v._id == 'system') return if (G.config.serverId != v.player?.sid) return;
if (G.config.serverId != users.sid) return;
EmailFun.addEmail({ EmailFun.addEmail({
uid: v._id, uid: v._id,
type: 'system', type: 'system',

View File

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

View File

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

View File

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