From d034105a627a252f4a4152eea715fe098cb258bf Mon Sep 17 00:00:00 2001 From: xcy Date: Sat, 30 Dec 2023 17:02:25 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=8E=92=E5=90=8D?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E4=B8=8D=E5=AF=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/fix_patch/patch_20231230.ts | 18 ++++++++++++------ src/public/rank/rank.ts | 8 ++++++-- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/fix_patch/patch_20231230.ts b/src/fix_patch/patch_20231230.ts index 533ac56..d788e24 100644 --- a/src/fix_patch/patch_20231230.ts +++ b/src/fix_patch/patch_20231230.ts @@ -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,7 +20,7 @@ class Path { let uid = today_login_users[i].uid; let init: boolean = false; - let { _id, ...hdata } = await G.mongodb.cEvent(`yuandan${hdid}`).findOne({ + let hdata: any = await G.mongodb.cEvent(`yuandan${hdid}`).findOne({ uid: uid, type: `yuandan${hdid}` }); if (!hdata) { @@ -75,9 +77,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 } - taskval["5"] = 0 } else { taskval["5"] = 0; } @@ -87,7 +90,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 +101,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 +116,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,6 +126,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, taskval); } diff --git a/src/public/rank/rank.ts b/src/public/rank/rank.ts index 634f4a5..cf0c80a 100644 --- a/src/public/rank/rank.ts +++ b/src/public/rank/rank.ts @@ -135,7 +135,11 @@ export abstract class Rank { //将db里的数据,写入到 rank:xxx:sort里 //写入的单条数据为: {uid:score} - this.db.find({ type: this.type }, { + + // 首先清理redis中sort数据 在从数据库中初始化 + await G.ioredis.del(this.getRedisKeySort); + + this.db.find({ type: this.type }, { projection: { "idKey": 1, "type": 1, @@ -263,7 +267,7 @@ export abstract class Rank { } return item; }) - if(ghid.length > 0){ + if (ghid.length > 0) { let ghinfo = await G.mongodb.collection("gonghui").find( { _id: { $in: ghid } }, { projection: { name: 1 } } ).toArray(); From 18b380f620f3d1ec44b41fbb16214e697c4acbc4 Mon Sep 17 00:00:00 2001 From: xcy Date: Sat, 30 Dec 2023 17:04:56 +0800 Subject: [PATCH 2/3] =?UTF-8?q?fix:=20=E8=84=9A=E6=9C=AC=E5=86=B2=E7=AA=81?= =?UTF-8?q?=E8=A7=A3=E5=86=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/fix_patch/patch_20231230.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/fix_patch/patch_20231230.ts b/src/fix_patch/patch_20231230.ts index d788e24..ac88d05 100644 --- a/src/fix_patch/patch_20231230.ts +++ b/src/fix_patch/patch_20231230.ts @@ -20,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}` }); From a177c18efe62807c1cbc77333f58d0c1d4f12400 Mon Sep 17 00:00:00 2001 From: xcy Date: Sat, 30 Dec 2023 18:04:01 +0800 Subject: [PATCH 3/3] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=8E=92=E5=90=8D?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/public/rank/rank.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/public/rank/rank.ts b/src/public/rank/rank.ts index cf0c80a..781532f 100644 --- a/src/public/rank/rank.ts +++ b/src/public/rank/rank.ts @@ -306,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 [] }