fix: 修正 BeatLeader 最近成绩获取中的时间和玩家信息处理

This commit is contained in:
lixiangwuxian 2025-03-08 19:40:37 +08:00
parent 24aa3dd71a
commit beb8562690

View File

@ -319,7 +319,10 @@ func (bl *blQuery) GetRecentScores(count int, qqId string) ([]RecordDataLite, er
// }
// return records, nil
playerData, err := FetchPlayerData(blId)
if err != nil {
return nil, err
}
//从线上获取
historyUrl := "https://api.beatleader.xyz/player/%s/scores?count=%d"
fullUrl := fmt.Sprintf(historyUrl, blId, count)
@ -344,9 +347,9 @@ func (bl *blQuery) GetRecentScores(count int, qqId string) ([]RecordDataLite, er
for _, score := range scores {
dataLite := RecordDataLite{
ScoreID: score.ID,
BlID: score.Player.ID,
Name: score.Player.Name,
Country: score.Player.Country,
BlID: blId,
Name: playerData.Name,
Country: playerData.Country,
SongName: score.Leaderboard.Song.Name,
SongSubName: score.Leaderboard.Song.SubName,
SongAuthorName: score.Leaderboard.Song.Author,
@ -367,7 +370,7 @@ func (bl *blQuery) GetRecentScores(count int, qqId string) ([]RecordDataLite, er
DeviceHmd: GetHMDStr(score.HMD),
DeviceControllerLeft: GetControllerStr(score.Controller),
DeviceControllerRight: GetControllerStr(score.Controller),
GeneratedTime: time.Now().Format("2006-01-02 15:04:05.999999999-07:00"),
GeneratedTime: time.Unix(score.Timepost, 0).Format("2006-01-02 15:04:05.999999999-07:00"),
}
if score.Leaderboard.Difficulty.Stars != nil {
dataLite.Stars = *score.Leaderboard.Difficulty.Stars