From cedce860c521276962a594b9243078a4d9ef85f2 Mon Sep 17 00:00:00 2001 From: xcy Date: Thu, 28 Dec 2023 18:46:38 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=8E=92=E8=A1=8C=E6=A6=9Cbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/public/rank/rank.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/public/rank/rank.ts b/src/public/rank/rank.ts index 72e28e2..fc780c5 100644 --- a/src/public/rank/rank.ts +++ b/src/public/rank/rank.ts @@ -264,12 +264,16 @@ export abstract class Rank { return item; }) if(ghid.length > 0){ - (await G.mongodb.collection("gonghui").find( + let ghinfo = await G.mongodb.collection("gonghui").find( { _id: { $in: ghid } }, { projection: { name: 1 } } - )).forEach(item => { + ).toArray(); + ghinfo.forEach(item => { let index = res.findIndex(x => x.idKey == item._id.toHexString()); - res[index].data.player.ghName = item.name; - this.db.updateOne({ idKey: item._id.toHexString(), type: this.getType() }, { $set: { "data.player.ghName": item.name } }); + res[index].data.player = { + ghName: item.name, + ghId: item._id.toHexString(), + }; + this.db.updateOne({ idKey: item._id.toHexString(), type: this.getType() }, { $set: { "data.player": res[index].data.player } }); }) } break;