fix: 修正 FetchCountryLeaderboard 函数中的偏移量处理逻辑,确保分页计算从1开始以提高准确性

This commit is contained in:
lixiangwuxian 2025-04-02 00:23:27 +08:00
parent 20c615070f
commit 10eba59c63

View File

@ -140,10 +140,10 @@ type LeaderboardData struct {
func FetchCountryLeaderboard(country string, offset int, ssID string) (LeaderboardData, error) {
// 根据偏移量计算页数
if offset < 0 {
offset = 0
if offset < 1 {
offset = 1
}
page := offset / 50
page := (offset-1)/50 + 1
url := fmt.Sprintf("https://scoresaber.com/api/players?countries=%s&page=%d", country, page)
// 创建请求