Compare commits

...

18 Commits

Author SHA1 Message Date
dy
087b8ff146 Merge branch 'feature/json' into release 2023-12-31 16:01:52 +08:00
dy
3ba27f5180 cehua public json 2023-12-31 16:01:41 +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 24200 additions and 14764 deletions

View File

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

View File

@ -3,6 +3,7 @@ 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)
@ -16,17 +17,22 @@ export default async function (call: ApiCall<ReqOpen, ResOpen>) {
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

@ -21,17 +21,29 @@ export default async function (call: ApiCall<ReqRec, ResRec>) {
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;
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}); 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

@ -9,10 +9,8 @@ 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(), true); await updateHbzbCrossUser(await call.conn.getDefaultFightData(), dbData == null);
}
if (!data.refreshTime || data.refreshTime < PublicShared.getToDayZeroTime()) { if (!data.refreshTime || data.refreshTime < PublicShared.getToDayZeroTime()) {
data.winNum = 0; data.winNum = 0;
@ -32,7 +30,9 @@ export default async function (call: ApiCall<ReqOpen, ResOpen>) {
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(

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'},
@ -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 || {} 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

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

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -537,8 +537,8 @@
"mapId": 420, "mapId": 420,
"prize": [ "prize": [
{ {
"a": "item", "a": "attr",
"t": "4", "t": "rmbmoney",
"n": 100 "n": 100
} }
], ],
@ -550,8 +550,8 @@
"mapId": 430, "mapId": 430,
"prize": [ "prize": [
{ {
"a": "attr", "a": "item",
"t": "rmbmoney", "t": "4",
"n": 5 "n": 5
} }
], ],
@ -589,8 +589,8 @@
"mapId": 460, "mapId": 460,
"prize": [ "prize": [
{ {
"a": "item", "a": "attr",
"t": "4", "t": "rmbmoney",
"n": 100 "n": 100
} }
], ],
@ -615,8 +615,8 @@
"mapId": 480, "mapId": 480,
"prize": [ "prize": [
{ {
"a": "attr", "a": "item",
"t": "rmbmoney", "t": "4",
"n": 5 "n": 5
} }
], ],
@ -641,8 +641,8 @@
"mapId": 500, "mapId": 500,
"prize": [ "prize": [
{ {
"a": "item", "a": "attr",
"t": "4", "t": "rmbmoney",
"n": 100 "n": 100
} }
], ],
@ -680,8 +680,8 @@
"mapId": 530, "mapId": 530,
"prize": [ "prize": [
{ {
"a": "attr", "a": "item",
"t": "rmbmoney", "t": "4",
"n": 5 "n": 5
} }
], ],
@ -693,8 +693,8 @@
"mapId": 540, "mapId": 540,
"prize": [ "prize": [
{ {
"a": "item", "a": "attr",
"t": "4", "t": "rmbmoney",
"n": 100 "n": 100
} }
], ],
@ -797,8 +797,8 @@
"mapId": 620, "mapId": 620,
"prize": [ "prize": [
{ {
"a": "item", "a": "attr",
"t": "4", "t": "rmbmoney",
"n": 100 "n": 100
} }
], ],
@ -810,8 +810,8 @@
"mapId": 630, "mapId": 630,
"prize": [ "prize": [
{ {
"a": "attr", "a": "item",
"t": "rmbmoney", "t": "4",
"n": 5 "n": 5
} }
], ],
@ -849,8 +849,8 @@
"mapId": 660, "mapId": 660,
"prize": [ "prize": [
{ {
"a": "item", "a": "attr",
"t": "4", "t": "rmbmoney",
"n": 100 "n": 100
} }
], ],
@ -875,8 +875,8 @@
"mapId": 680, "mapId": 680,
"prize": [ "prize": [
{ {
"a": "attr", "a": "item",
"t": "rmbmoney", "t": "4",
"n": 5 "n": 5
} }
], ],
@ -901,8 +901,8 @@
"mapId": 700, "mapId": 700,
"prize": [ "prize": [
{ {
"a": "item", "a": "attr",
"t": "4", "t": "rmbmoney",
"n": 100 "n": 100
} }
], ],
@ -940,8 +940,8 @@
"mapId": 730, "mapId": 730,
"prize": [ "prize": [
{ {
"a": "attr", "a": "item",
"t": "rmbmoney", "t": "4",
"n": 5 "n": 5
} }
], ],
@ -953,8 +953,8 @@
"mapId": 740, "mapId": 740,
"prize": [ "prize": [
{ {
"a": "item", "a": "attr",
"t": "4", "t": "rmbmoney",
"n": 100 "n": 100
} }
], ],
@ -1057,8 +1057,8 @@
"mapId": 820, "mapId": 820,
"prize": [ "prize": [
{ {
"a": "item", "a": "attr",
"t": "4", "t": "rmbmoney",
"n": 100 "n": 100
} }
], ],
@ -1070,8 +1070,8 @@
"mapId": 830, "mapId": 830,
"prize": [ "prize": [
{ {
"a": "attr", "a": "item",
"t": "rmbmoney", "t": "4",
"n": 5 "n": 5
} }
], ],
@ -1109,8 +1109,8 @@
"mapId": 860, "mapId": 860,
"prize": [ "prize": [
{ {
"a": "item", "a": "attr",
"t": "4", "t": "rmbmoney",
"n": 100 "n": 100
} }
], ],
@ -1135,8 +1135,8 @@
"mapId": 880, "mapId": 880,
"prize": [ "prize": [
{ {
"a": "attr", "a": "item",
"t": "rmbmoney", "t": "4",
"n": 5 "n": 5
} }
], ],
@ -1161,8 +1161,8 @@
"mapId": 900, "mapId": 900,
"prize": [ "prize": [
{ {
"a": "item", "a": "attr",
"t": "4", "t": "rmbmoney",
"n": 100 "n": 100
} }
], ],
@ -1200,8 +1200,8 @@
"mapId": 930, "mapId": 930,
"prize": [ "prize": [
{ {
"a": "attr", "a": "item",
"t": "rmbmoney", "t": "4",
"n": 5 "n": 5
} }
], ],
@ -1213,8 +1213,8 @@
"mapId": 940, "mapId": 940,
"prize": [ "prize": [
{ {
"a": "item", "a": "attr",
"t": "4", "t": "rmbmoney",
"n": 100 "n": 100
} }
], ],
@ -1298,5 +1298,109 @@
], ],
"chapter": 14, "chapter": 14,
"des": "intr_guanqia_des_1" "des": "intr_guanqia_des_1"
},
"101": {
"id": 101,
"mapId": 1010,
"prize": [
{
"a": "attr",
"t": "rmbmoney",
"n": 100
}
],
"chapter": 14,
"des": "intr_guanqia_des_1"
},
"102": {
"id": 102,
"mapId": 1020,
"prize": [
{
"a": "attr",
"t": "rmbmoney",
"n": 100
}
],
"chapter": 14,
"des": "intr_guanqia_des_1"
},
"103": {
"id": 103,
"mapId": 1030,
"prize": [
{
"a": "item",
"t": "4",
"n": 5
}
],
"chapter": 14,
"des": "intr_guanqia_des_1"
},
"104": {
"id": 104,
"mapId": 1040,
"prize": [
{
"a": "attr",
"t": "rmbmoney",
"n": 100
}
],
"chapter": 14,
"des": "intr_guanqia_des_1"
},
"105": {
"id": 105,
"mapId": 1050,
"prize": [
{
"a": "attr",
"t": "rmbmoney",
"n": 100
}
],
"chapter": 14,
"des": "intr_guanqia_des_1"
},
"106": {
"id": 106,
"mapId": 1060,
"prize": [
{
"a": "attr",
"t": "rmbmoney",
"n": 100
}
],
"chapter": 14,
"des": "intr_guanqia_des_1"
},
"107": {
"id": 107,
"mapId": 1070,
"prize": [
{
"a": "attr",
"t": "rmbmoney",
"n": 100
}
],
"chapter": 14,
"des": "intr_guanqia_des_1"
},
"108": {
"id": 108,
"mapId": 1080,
"prize": [
{
"a": "item",
"t": "4",
"n": 5
}
],
"chapter": 14,
"des": "intr_guanqia_des_1"
} }
} }

File diff suppressed because it is too large Load Diff

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,6 +135,10 @@ export abstract class Rank {
//将db里的数据写入到 rank:xxx:sort里 //将db里的数据写入到 rank:xxx:sort里
//写入的单条数据为: {uid:score} //写入的单条数据为: {uid:score}
// 首先清理redis中sort数据 在从数据库中初始化
await G.ioredis.del(this.getRedisKeySort);
this.db.find({ type: this.type }, { this.db.find({ type: this.type }, {
projection: { projection: {
"idKey": 1, "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 [] 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

@ -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"
}
} }
] ]
}, },