Refine live schedule data
- Add special_live_rotation_m data to main.db for rotated special live scheduling - Split normal and special live queries to avoid selecting special-only columns from normal_live_m - Build live schedule/status around rotated special lives and derived training lives - Reuse user training energy values in login top info and live party list responses - Set training energy and max training energy defaults to 999 Signed-off-by: Sean Du <do4suki@gmail.com>
This commit is contained in:
@@ -11,49 +11,28 @@ import (
|
||||
func liveStatus(ctx *gin.Context) (res any, err error) {
|
||||
ss := session.Get(ctx)
|
||||
|
||||
var liveDifficultyID []int
|
||||
normalLives := []liveapischema.NormalLiveStatusList{}
|
||||
err = ss.MainEng.Table("normal_live_m").Cols("live_difficulty_id").OrderBy("live_difficulty_id ASC").Find(&liveDifficultyID)
|
||||
normalIDs, err := listAvailableNormalLiveDifficultyIDs(ss)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, id := range liveDifficultyID {
|
||||
normalLive := liveapischema.NormalLiveStatusList{
|
||||
LiveDifficultyID: id,
|
||||
Status: 1,
|
||||
HiScore: 0,
|
||||
HiComboCount: 0,
|
||||
ClearCnt: 0,
|
||||
AchievedGoalIDList: []int{},
|
||||
}
|
||||
normalLives = append(normalLives, normalLive)
|
||||
}
|
||||
|
||||
specialLives := []liveapischema.SpecialLiveStatusList{}
|
||||
err = ss.MainEng.Table("special_live_m").Cols("live_difficulty_id").OrderBy("live_difficulty_id ASC").Find(&liveDifficultyID)
|
||||
specialIDs, err := listTodaySpecialRotationDifficultyIDs(ss, time.Now())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, id := range liveDifficultyID {
|
||||
specialLive := liveapischema.SpecialLiveStatusList{
|
||||
LiveDifficultyID: id,
|
||||
Status: 1,
|
||||
HiScore: 0,
|
||||
HiComboCount: 0,
|
||||
ClearCnt: 0,
|
||||
AchievedGoalIDList: []int{},
|
||||
}
|
||||
specialLives = append(specialLives, specialLive)
|
||||
trainingIDs, err := listAvailableTrainingLiveDifficultyIDs(ss)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
res = liveapischema.StatusResp{
|
||||
Result: liveapischema.StatusData{
|
||||
NormalLiveStatusList: normalLives,
|
||||
SpecialLiveStatusList: specialLives,
|
||||
TrainingLiveStatusList: []liveapischema.TrainingLiveStatusList{},
|
||||
NormalLiveStatusList: buildNormalLiveStatusList(normalIDs),
|
||||
SpecialLiveStatusList: buildSpecialLiveStatusList(specialIDs),
|
||||
TrainingLiveStatusList: buildTrainingLiveStatusList(trainingIDs),
|
||||
MarathonLiveStatusList: []any{},
|
||||
FreeLiveStatusList: []any{},
|
||||
CanResumeLive: false,
|
||||
CanResumeLive: true,
|
||||
},
|
||||
Status: 200,
|
||||
CommandNum: false,
|
||||
|
||||
Reference in New Issue
Block a user