Implement more endpoints & overhaul [2/n]
Drop LevelDB and move all the things to SQLite. Implemented endpoints: /api <unit, accessoryMaterialAll> /api <unit, accessoryTab> /live/continue /live/partyList /unit/favoriteAccessory (WIP) /unit/sale Signed-off-by: Sean Du <do4suki@gmail.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package live
|
||||
|
||||
import (
|
||||
"honoka-chan/internal/schema/api/live"
|
||||
liveapischema "honoka-chan/internal/schema/api/live"
|
||||
"honoka-chan/internal/session"
|
||||
"time"
|
||||
|
||||
@@ -12,13 +12,13 @@ func liveStatus(ctx *gin.Context) (res any, err error) {
|
||||
ss := session.Get(ctx)
|
||||
|
||||
var liveDifficultyID []int
|
||||
normalLives := []live.NormalLiveStatusList{}
|
||||
normalLives := []liveapischema.NormalLiveStatusList{}
|
||||
err = ss.MainEng.Table("normal_live_m").Cols("live_difficulty_id").OrderBy("live_difficulty_id ASC").Find(&liveDifficultyID)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
for _, id := range liveDifficultyID {
|
||||
normalLive := live.NormalLiveStatusList{
|
||||
normalLive := liveapischema.NormalLiveStatusList{
|
||||
LiveDifficultyID: id,
|
||||
Status: 1,
|
||||
HiScore: 0,
|
||||
@@ -29,13 +29,13 @@ func liveStatus(ctx *gin.Context) (res any, err error) {
|
||||
normalLives = append(normalLives, normalLive)
|
||||
}
|
||||
|
||||
specialLives := []live.SpecialLiveStatusList{}
|
||||
specialLives := []liveapischema.SpecialLiveStatusList{}
|
||||
err = ss.MainEng.Table("special_live_m").Cols("live_difficulty_id").OrderBy("live_difficulty_id ASC").Find(&liveDifficultyID)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
for _, id := range liveDifficultyID {
|
||||
specialLive := live.SpecialLiveStatusList{
|
||||
specialLive := liveapischema.SpecialLiveStatusList{
|
||||
LiveDifficultyID: id,
|
||||
Status: 1,
|
||||
HiScore: 0,
|
||||
@@ -46,11 +46,11 @@ func liveStatus(ctx *gin.Context) (res any, err error) {
|
||||
specialLives = append(specialLives, specialLive)
|
||||
}
|
||||
|
||||
res = live.StatusResp{
|
||||
Result: live.StatusData{
|
||||
res = liveapischema.StatusResp{
|
||||
Result: liveapischema.StatusData{
|
||||
NormalLiveStatusList: normalLives,
|
||||
SpecialLiveStatusList: specialLives,
|
||||
TrainingLiveStatusList: []live.TrainingLiveStatusList{},
|
||||
TrainingLiveStatusList: []liveapischema.TrainingLiveStatusList{},
|
||||
MarathonLiveStatusList: []any{},
|
||||
FreeLiveStatusList: []any{},
|
||||
CanResumeLive: false,
|
||||
|
||||
Reference in New Issue
Block a user