修正profileRank的报错

This commit is contained in:
Kokomi 2022-11-14 07:10:29 +08:00
parent 7e519fdfe3
commit fbc52715ee

View File

@ -193,9 +193,9 @@ export default class ProfileRank {
} }
let data = {} let data = {}
try { try {
data = await redis.get(`miao:rank:uid-info:${uid}`) let uData = await redis.get(`miao:rank:uid-info:${uid}`)
if (data) { if (uData) {
data = JSON.parse(data) data = JSON.parse(uData)
} }
} catch (e) { } catch (e) {
data = {} data = {}
@ -203,7 +203,7 @@ export default class ProfileRank {
await redis.set(`miao:rank:uid-info:${uid}`, JSON.stringify({ await redis.set(`miao:rank:uid-info:${uid}`, JSON.stringify({
totalCount, totalCount,
basicCount, basicCount,
isSelfUid: !!(isSelfUid || data.isSelfUid) isSelfUid: !!(isSelfUid || data?.isSelfUid)
}), { EX: 3600 * 24 * 365 }) }), { EX: 3600 * 24 * 365 })
} }