From e32f4c13feede4066819ed4f5ba4300fa694936c Mon Sep 17 00:00:00 2001 From: lixiangwuxian Date: Sat, 12 Jul 2025 22:52:49 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20getAllScoreSaberSco?= =?UTF-8?q?res=20=E5=87=BD=E6=95=B0=E4=B8=AD=E7=9A=84=20allSongs=20?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E6=96=B9=E5=BC=8F=EF=BC=8C=E7=A1=AE?= =?UTF-8?q?=E4=BF=9D=E6=AD=A3=E7=A1=AE=E5=88=9B=E5=BB=BA=20SongData=20?= =?UTF-8?q?=E5=88=87=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- handler/scoresaber/bs30.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/handler/scoresaber/bs30.go b/handler/scoresaber/bs30.go index b0e688a..7cec0fa 100644 --- a/handler/scoresaber/bs30.go +++ b/handler/scoresaber/bs30.go @@ -630,7 +630,8 @@ func getRecent10Scores(playerID string) ([]ScoreSaberPlayerScore, error) { // 获取玩家的所有分数并转换为 SongData func getAllScoreSaberScores(playerID string) ([]SongData, error) { - var allSongs []SongData + // var allSongs []SongData + allSongs := make([]SongData, 40) cwd, _ := os.Getwd() // 获取Best30 @@ -669,7 +670,7 @@ func getAllScoreSaberScores(playerID string) ([]SongData, error) { defer util.ReportPanicToDev() defer wgAll.Done() wg := sync.WaitGroup{} - for _, score := range recentScores { + for i, score := range recentScores { wg.Add(1) go func() { defer util.ReportPanicToDev() @@ -680,7 +681,7 @@ func getAllScoreSaberScores(playerID string) ([]SongData, error) { return } songData.IsBest30 = false - allSongs = append(allSongs, songData) + allSongs[i+30] = songData }() wg.Wait() }