fix: 在 FetchCountryLeaderboard 函数中添加对 offset 参数的校验,确保其最小值为 1
This commit is contained in:
parent
968440f69f
commit
f94b9d13b8
@ -69,6 +69,9 @@ func FetchPlayerData(blID string) (*PlayerData, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func FetchCountryLeaderboard(country string, offset int, userId string) ([]PlayerDataLite, 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)
|
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)
|
||||||
|
|
||||||
// 创建请求
|
// 创建请求
|
||||||
|
Loading…
x
Reference in New Issue
Block a user