refactor: 调整 BeatLeader 模块,注释并移除热门成绩相关功能
This commit is contained in:
@@ -42,6 +42,7 @@ func init() {
|
||||
song_sub_name VARCHAR(255),
|
||||
song_author_name VARCHAR(255),
|
||||
song_hash VARCHAR(64),
|
||||
song_id VARCHAR(64),
|
||||
cover_image TEXT,
|
||||
difficulty_raw VARCHAR(100),
|
||||
pp REAL,
|
||||
@@ -320,8 +321,8 @@ func (bl *blQuery) GetRecentScores(count int, qqId string) ([]RecordDataLite, er
|
||||
// return records, nil
|
||||
|
||||
//从线上获取
|
||||
historyUrl := "https://api.beatleader.xyz/player/%s/scores"
|
||||
fullUrl := fmt.Sprintf(historyUrl, blId)
|
||||
historyUrl := "https://api.beatleader.xyz/player/%s/scores?count=%d"
|
||||
fullUrl := fmt.Sprintf(historyUrl, blId, count)
|
||||
resp, err := http.Get(fullUrl)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -338,7 +339,7 @@ func (bl *blQuery) GetRecentScores(count int, qqId string) ([]RecordDataLite, er
|
||||
}
|
||||
records := make([]RecordDataLite, 0)
|
||||
for _, score := range scores {
|
||||
records = append(records, RecordDataLite{
|
||||
dataLite := RecordDataLite{
|
||||
ScoreID: score.ID,
|
||||
BlID: score.Player.ID,
|
||||
Name: score.Player.Name,
|
||||
@@ -347,24 +348,28 @@ func (bl *blQuery) GetRecentScores(count int, qqId string) ([]RecordDataLite, er
|
||||
SongSubName: score.Leaderboard.Song.SubName,
|
||||
SongAuthorName: score.Leaderboard.Song.Author,
|
||||
SongHash: score.Leaderboard.Song.Hash,
|
||||
SongId: score.Leaderboard.Song.ID,
|
||||
SongId: score.Leaderboard.Song.ID[0:5],
|
||||
CoverImage: score.Leaderboard.Song.CoverImage,
|
||||
DifficultyRaw: score.Leaderboard.Difficulty.DifficultyName,
|
||||
PP: score.Pp,
|
||||
Stars: *score.Leaderboard.Difficulty.Stars,
|
||||
Stars: 0,
|
||||
Weight: score.Weight,
|
||||
Modifiers: score.Modifiers,
|
||||
Multiplier: float64(score.ModifiedScore) / float64(score.BaseScore),
|
||||
BadCuts: score.BadCuts,
|
||||
Score: score.ModifiedScore,
|
||||
Rank: score.Rank,
|
||||
MaxScore: score.ModifiedScore,
|
||||
MaxScore: int(float64(score.ModifiedScore) / score.Accuracy),
|
||||
FullCombo: score.FullCombo,
|
||||
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"),
|
||||
})
|
||||
}
|
||||
if score.Leaderboard.Difficulty.Stars != nil {
|
||||
dataLite.Stars = *score.Leaderboard.Difficulty.Stars
|
||||
}
|
||||
records = append(records, dataLite)
|
||||
}
|
||||
return records, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user