fix: 在 FetchCountryLeaderboard 函数中添加对 offset 参数的校验,确保其最小值为 1

This commit is contained in:
lixiangwuxian 2025-05-03 23:59:28 +08:00
parent 968440f69f
commit f94b9d13b8

View File

@ -69,6 +69,9 @@ func FetchPlayerData(blID string) (*PlayerData, error) {
}
func FetchCountryLeaderboard(country string, offset int, userId string) ([]PlayerDataLite, error) {
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)
// 创建请求