From b608ab57f66d5c252c887e4fd9ccb89dba4936bc Mon Sep 17 00:00:00 2001 From: lixiangwuxian Date: Mon, 31 Mar 2025 02:38:12 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=20ssPlusN=20=E5=87=BD?= =?UTF-8?q?=E6=95=B0=E4=B8=AD=E7=9A=84=E6=8E=92=E5=90=8D=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=EF=BC=8C=E5=B9=B6=E4=BC=98=E5=8C=96=E7=9B=AE?= =?UTF-8?q?=E6=A0=87=E7=8E=A9=E5=AE=B6=E6=9F=A5=E6=89=BE=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E4=BB=A5=E7=A1=AE=E4=BF=9D=E6=8E=92=E5=90=8D=E4=B8=8D=E4=BD=8E?= =?UTF-8?q?=E4=BA=8E1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- handler/scoresaber/score.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/handler/scoresaber/score.go b/handler/scoresaber/score.go index 137efec..dc0f14e 100644 --- a/handler/scoresaber/score.go +++ b/handler/scoresaber/score.go @@ -76,7 +76,7 @@ func ssPlusN(msg model.Message) (reply model.Reply) { FromMsg: msg, } } - resultStr.WriteString(fmt.Sprintf("您当前的区排名为:%d\n", userInfo.CountryRank)) + resultStr.WriteString(fmt.Sprintf("您当前的全区排名为:%d\n", userInfo.CountryRank)) // 获取当前用户所在区对应+N位的玩家列表 leaderboard, err := scoresaber.FetchCountryLeaderboard(userInfo.Country, userInfo.CountryRank-N, userInfo.ID) if err != nil { @@ -91,8 +91,12 @@ func ssPlusN(msg model.Message) (reply model.Reply) { } //寻找leaderboard中排名为userInfo.CountryRank-N的玩家 var targetPlayer scoresaber.PlayerData + targetRank := userInfo.CountryRank - N + if targetRank < 0 { + targetRank = 1 + } for _, player := range leaderboard.Players { - if player.CountryRank == userInfo.CountryRank-N { + if player.CountryRank == targetRank { targetPlayer = player break }