From d1750bb097fc81430dbf7b9f2a82e6940280f61d Mon Sep 17 00:00:00 2001 From: xcy <871622040@qq.com> Date: Wed, 20 Dec 2023 15:42:14 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=8E=A9=E5=AE=B6=E9=80=80=E5=87=BA?= =?UTF-8?q?=E5=85=AC=E4=BC=9A=E6=97=B6gud=E6=AE=8B=E7=95=99ghid=EF=BC=8C?= =?UTF-8?q?=E5=9C=A8=E7=99=BB=E5=BD=95=E6=97=B6=E6=A3=80=E6=B5=8B=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E4=B8=80=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api_s2c/user/ApiLogin.ts | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/api_s2c/user/ApiLogin.ts b/src/api_s2c/user/ApiLogin.ts index 33ef532..6b54a15 100644 --- a/src/api_s2c/user/ApiLogin.ts +++ b/src/api_s2c/user/ApiLogin.ts @@ -132,6 +132,9 @@ async function doLogin(call: ApiCall) { //await G.redis.set('user', gud.uid, gud); await initGud(gud.uid, gud); + // 修复公会id + await fixUnionData(gud); + //记录玩家所在的进程,change: 更换到处理完踢线操作在写入。 // setUidProcessId(gud.uid); @@ -278,4 +281,19 @@ async function LoginFun(call: ApiCall) { // // G.mongodb.collection("hero").findOneAndUpdate({_id: i._id}, {$set: {shiwu: shiwuChange}}) // }) -// } \ No newline at end of file +// } + +// 修复玩家退出公会 但是gud中残留公会id +async function fixUnionData(gud: ResLogin["gud"]) { + if (gud.ghId) { + let ghdata = await G.mongodb.collection("gonghui").findOne( + {_id: G.mongodb.conversionId(gud.ghId), 'players.uid': gud.uid} + ) + if (!ghdata) { + gud.ghId = ""; + gud.ghName = ""; + gud.ghLevel = 0; + PlayerFun.changeAttr(gud.uid, {ghId: '', ghLevel: 0}) + } + } +} \ No newline at end of file