Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
eafa42880a
@ -1,3 +1,4 @@
|
||||
import { log } from "console";
|
||||
import { patchFun, patchInit } from "../patch";
|
||||
import { TanXianFun } from "../public/tanxian";
|
||||
import { PublicShared } from "../shared/public/public";
|
||||
@ -5,7 +6,8 @@ import { PublicShared } from "../shared/public/public";
|
||||
class Path {
|
||||
|
||||
async fun1(a: any) {
|
||||
let hdid = 1703860546;
|
||||
let hdid = 1703860546; // 正式服活动id
|
||||
// let hdid = 1703917224; // 测试服活动id
|
||||
let today_zero_time = PublicShared.getToDayZeroTime();
|
||||
|
||||
// 查询今天登录的用户
|
||||
@ -18,6 +20,7 @@ class Path {
|
||||
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}`
|
||||
});
|
||||
@ -75,9 +78,10 @@ class Path {
|
||||
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
|
||||
}
|
||||
taskval["5"] = jxdata.jx.record["2"] || 0
|
||||
}else{
|
||||
taskval["5"] = 0
|
||||
}
|
||||
} else {
|
||||
taskval["5"] = 0;
|
||||
}
|
||||
@ -87,7 +91,7 @@ class Path {
|
||||
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; });
|
||||
).toArray()).forEach(e => { taskval["6"] += -e.change; });
|
||||
|
||||
// taskid=7, stype=122 进行 n 次快速探险
|
||||
taskval["7"] = 0;
|
||||
@ -98,7 +102,7 @@ class Path {
|
||||
|
||||
// taskid=8, stype=157 获得vip经验
|
||||
let orde_logs = await G.mongodb.collection('payOrderLog' as any).find(
|
||||
{ uid: uid, cTime: { $gte: today_zero_time * 1000 } },
|
||||
{ uid: uid, ctime: { $gte: today_zero_time * 1000 } },
|
||||
).toArray();
|
||||
|
||||
taskval["8"] = 0;
|
||||
@ -113,6 +117,7 @@ class Path {
|
||||
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}` },
|
||||
@ -122,7 +127,8 @@ class Path {
|
||||
hdata.taskval = taskval;
|
||||
await G.mongodb.cEvent(`yuandan${hdid}`).updateOne({ uid: uid, type: `yuandan${hdid}` }, { $set: hdata }, { upsert: true })
|
||||
}
|
||||
console.log('玩家执行完成',uid)
|
||||
|
||||
console.log("玩家执行完成:", uid, taskval);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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 []
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user