@@ -64,9 +64,9 @@ func preciseScore(ctx *gin.Context) {
|
|||||||
}
|
}
|
||||||
// fmt.Println("liveSetting", liveSetting)
|
// fmt.Println("liveSetting", liveSetting)
|
||||||
|
|
||||||
notes := []liveschema.NotesList{}
|
notesList := []liveschema.NotesList{}
|
||||||
notes_list := utils.ReadAllText("./assets/serverdata/beatmaps/" + liveSetting.NotesSettingAsset)
|
noteData := utils.ReadAllText("./assets/serverdata/beatmaps/" + liveSetting.NotesSettingAsset)
|
||||||
err = json.Unmarshal([]byte(notes_list), ¬es)
|
err = json.Unmarshal([]byte(noteData), ¬esList)
|
||||||
if ss.CheckErr(err) {
|
if ss.CheckErr(err) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -116,7 +116,7 @@ func preciseScore(ctx *gin.Context) {
|
|||||||
IsRandom: false,
|
IsRandom: false,
|
||||||
AcFlag: liveSetting.AcFlag,
|
AcFlag: liveSetting.AcFlag,
|
||||||
SwingFlag: liveSetting.SwingFlag,
|
SwingFlag: liveSetting.SwingFlag,
|
||||||
NotesList: notes,
|
NotesList: notesList,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Off: liveschema.Skill{
|
Off: liveschema.Skill{
|
||||||
@@ -126,7 +126,7 @@ func preciseScore(ctx *gin.Context) {
|
|||||||
IsRandom: false,
|
IsRandom: false,
|
||||||
AcFlag: liveSetting.AcFlag,
|
AcFlag: liveSetting.AcFlag,
|
||||||
SwingFlag: liveSetting.SwingFlag,
|
SwingFlag: liveSetting.SwingFlag,
|
||||||
NotesList: notes,
|
NotesList: notesList,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
RankInfo: ranks,
|
RankInfo: ranks,
|
||||||
@@ -146,8 +146,8 @@ func preciseScore(ctx *gin.Context) {
|
|||||||
UpdateDate: nil,
|
UpdateDate: nil,
|
||||||
PreciseList: nil,
|
PreciseList: nil,
|
||||||
DeckInfo: nil,
|
DeckInfo: nil,
|
||||||
TapAdjust: nil, // TODO: 不知道保存在哪里
|
TapAdjust: nil,
|
||||||
CanReplay: false, // TODO: 不知道保存在哪里
|
CanReplay: false,
|
||||||
}
|
}
|
||||||
skillOff = skillOn
|
skillOff = skillOn
|
||||||
|
|
||||||
@@ -159,7 +159,9 @@ func preciseScore(ctx *gin.Context) {
|
|||||||
if ss.CheckErr(err) {
|
if ss.CheckErr(err) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
liveInfo.NotesList = notes
|
liveInfo.NotesList = notesList
|
||||||
|
skillOn.LiveInfo = liveInfo
|
||||||
|
skillOff.LiveInfo = liveInfo
|
||||||
|
|
||||||
// PreciseList
|
// PreciseList
|
||||||
var preciseList []liveschema.PreciseList
|
var preciseList []liveschema.PreciseList
|
||||||
@@ -192,7 +194,6 @@ func preciseScore(ctx *gin.Context) {
|
|||||||
if record.IsSkillOn {
|
if record.IsSkillOn {
|
||||||
// 技能开
|
// 技能开
|
||||||
skillOn.HasRecord = true
|
skillOn.HasRecord = true
|
||||||
skillOn.LiveInfo = liveInfo
|
|
||||||
skillOn.RandomSeed = time.Now().Unix() // TODO: 从 /live/play 的 Timestamp 字段获取
|
skillOn.RandomSeed = time.Now().Unix() // TODO: 从 /live/play 的 Timestamp 字段获取
|
||||||
skillOn.MaxCombo = record.MaxCombo
|
skillOn.MaxCombo = record.MaxCombo
|
||||||
skillOn.UpdateDate = record.UpdateDate
|
skillOn.UpdateDate = record.UpdateDate
|
||||||
@@ -205,7 +206,6 @@ func preciseScore(ctx *gin.Context) {
|
|||||||
} else {
|
} else {
|
||||||
// 技能关
|
// 技能关
|
||||||
skillOff.HasRecord = true
|
skillOff.HasRecord = true
|
||||||
skillOff.LiveInfo = liveInfo
|
|
||||||
skillOff.RandomSeed = time.Now().Unix() // TODO: 从 /live/play 的 Timestamp 字段获取
|
skillOff.RandomSeed = time.Now().Unix() // TODO: 从 /live/play 的 Timestamp 字段获取
|
||||||
skillOff.MaxCombo = record.MaxCombo
|
skillOff.MaxCombo = record.MaxCombo
|
||||||
skillOff.UpdateDate = record.UpdateDate
|
skillOff.UpdateDate = record.UpdateDate
|
||||||
|
|||||||
+10
-12
@@ -1,11 +1,9 @@
|
|||||||
package session
|
package session
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"honoka-chan/internal/constant"
|
"honoka-chan/internal/constant"
|
||||||
usermodel "honoka-chan/internal/model/user"
|
usermodel "honoka-chan/internal/model/user"
|
||||||
liveschema "honoka-chan/internal/schema/live"
|
liveschema "honoka-chan/internal/schema/live"
|
||||||
"honoka-chan/pkg/utils"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Move from LevelDB to SQLite
|
// Move from LevelDB to SQLite
|
||||||
@@ -77,7 +75,7 @@ func (ss *Session) GetLiveInfo(LiveDifficultyID int) (bool, *liveschema.LiveInfo
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !has {
|
if !has {
|
||||||
has, err = ss.MainEng.Table("special_live_m").Alias("a").
|
has, err = ss.MainEng.Table("normal_live_m").Alias("a").
|
||||||
Join("LEFT", "live_setting_m", "a.live_setting_id = live_setting_m.live_setting_id").
|
Join("LEFT", "live_setting_m", "a.live_setting_id = live_setting_m.live_setting_id").
|
||||||
Where("live_difficulty_id = ?", LiveDifficultyID).
|
Where("live_difficulty_id = ?", LiveDifficultyID).
|
||||||
Cols("a.live_difficulty_id,live_setting_m.*").Get(&info)
|
Cols("a.live_difficulty_id,live_setting_m.*").Get(&info)
|
||||||
@@ -86,14 +84,14 @@ func (ss *Session) GetLiveInfo(LiveDifficultyID int) (bool, *liveschema.LiveInfo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var notesList []liveschema.NotesList
|
// var notesList []liveschema.NotesList
|
||||||
if has {
|
// if has {
|
||||||
noteData := utils.ReadAllText("./assets/serverdata/beatmaps/" + info.NotesSettingAsset)
|
// noteData := utils.ReadAllText("./assets/serverdata/beatmaps/" + info.NotesSettingAsset)
|
||||||
err = json.Unmarshal([]byte(noteData), ¬esList)
|
// err = json.Unmarshal([]byte(noteData), ¬esList)
|
||||||
if ss.CheckErr(err) {
|
// if ss.CheckErr(err) {
|
||||||
return false, nil
|
// return false, nil
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
return has, &liveschema.LiveInfo{
|
return has, &liveschema.LiveInfo{
|
||||||
LiveDifficultyID: info.LiveDifficultyID,
|
LiveDifficultyID: info.LiveDifficultyID,
|
||||||
@@ -108,7 +106,7 @@ func (ss *Session) GetLiveInfo(LiveDifficultyID int) (bool, *liveschema.LiveInfo
|
|||||||
SRankCombo: info.SRankCombo,
|
SRankCombo: info.SRankCombo,
|
||||||
AcFlag: info.AcFlag,
|
AcFlag: info.AcFlag,
|
||||||
SwingFlag: info.SwingFlag,
|
SwingFlag: info.SwingFlag,
|
||||||
NotesList: notesList,
|
NotesList: []liveschema.NotesList{},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user