From fbc52715ee5260a3d246cc2eba3ca7dfb9cf79c2 Mon Sep 17 00:00:00 2001 From: Kokomi <102026640+yoimiya-kokomi@users.noreply.github.com> Date: Mon, 14 Nov 2022 07:10:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3profileRank=E7=9A=84=E6=8A=A5?= =?UTF-8?q?=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- models/ProfileRank.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/models/ProfileRank.js b/models/ProfileRank.js index 8f5e2074..fd9332a9 100644 --- a/models/ProfileRank.js +++ b/models/ProfileRank.js @@ -193,9 +193,9 @@ export default class ProfileRank { } let data = {} try { - data = await redis.get(`miao:rank:uid-info:${uid}`) - if (data) { - data = JSON.parse(data) + let uData = await redis.get(`miao:rank:uid-info:${uid}`) + if (uData) { + data = JSON.parse(uData) } } catch (e) { data = {} @@ -203,7 +203,7 @@ export default class ProfileRank { await redis.set(`miao:rank:uid-info:${uid}`, JSON.stringify({ totalCount, basicCount, - isSelfUid: !!(isSelfUid || data.isSelfUid) + isSelfUid: !!(isSelfUid || data?.isSelfUid) }), { EX: 3600 * 24 * 365 }) }