fix: 修正 FetchCountryLeaderboard 函数中的偏移量处理逻辑,确保分页计算从1开始以提高准确性
This commit is contained in:
parent
20c615070f
commit
10eba59c63
@ -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)
|
||||
|
||||
// 创建请求
|
||||
|
Loading…
x
Reference in New Issue
Block a user