fix: 修正 FetchCountryLeaderboard 函数中 offset 参数的计算逻辑,确保正确分页请求玩家数据

This commit is contained in:
lixiangwuxian 2025-05-04 00:33:36 +08:00
parent 64e0db9f96
commit 0bb502faba

View File

@ -72,7 +72,7 @@ func FetchCountryLeaderboard(country string, offset int, userId string) ([]Playe
if offset < 1 {
offset = 1
}
url := fmt.Sprintf("https://api.beatleader.com/players?leaderboardContext=general&page=%d&count=50&sortBy=pp&mapsType=ranked&ppType=general&order=desc&countries=%s", offset/50+1, country)
url := fmt.Sprintf("https://api.beatleader.com/players?leaderboardContext=general&page=%d&count=50&sortBy=pp&mapsType=ranked&ppType=general&order=desc&countries=%s", (offset-1)/50+1, country)
// 创建请求
req, err := http.NewRequest("GET", url, nil)