用户状态接口增加排名

This commit is contained in:
CounterFire2023 2024-01-05 15:47:23 +08:00
parent c08d7a465a
commit a5f67cf4da
2 changed files with 4 additions and 1 deletions

View File

@ -302,11 +302,12 @@ body:
"address": "钱包地址",
"boost": 1, // 正常值为1
"twitterId": "",
"twitterName: "",
"twitterName": "",
"discordId": "",
"discordName": "",
"scoreToday": 100, // 今日获得积分
"scoreTotal": 200, // 总积分
"rankTotal": "-",
"invite": "邀请人address",
"code": "自己的邀请码"
}

View File

@ -85,6 +85,7 @@ class SignController extends BaseController {
const todayScore = await new RedisClient().zscore(todayKey, user.id)
const totalKey = rankKey(user.activity);
const totalScore = await new RedisClient().zscore(totalKey, user.id)
const totalRank = await new RedisClient().zrevrank(totalKey, user.id)
let invite = ''
if (user.inviteUser) {
const inviteUser = await ActivityUser.findById(user.inviteUser)
@ -101,6 +102,7 @@ class SignController extends BaseController {
discordName: user.discordName,
scoreToday: todayScore ? parseInt(todayScore+'') : 0,
scoreTotal: totalScore ? parseInt(totalScore+'') : 0,
rankTotal: totalRank ? totalRank : '-',
invite,
code: user.inviteCode,
}