- Add random live handlers, schemas and persistence for lot/play/continue/gameover/reward flow - Update live status and schedule generation, including special rotation handling and CN timezone alignment - Add config support for unlocking all daily special rotation songs and document the option - Refresh live play, reward, precise score and session logic plus bundled main.db updates Signed-off-by: Sean Du <do4suki@gmail.com>
46 lines
1.2 KiB
Go
46 lines
1.2 KiB
Go
package live
|
|
|
|
import (
|
|
liveapischema "honoka-chan/internal/schema/api/live"
|
|
"honoka-chan/internal/session"
|
|
"time"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
func liveSchedule(ctx *gin.Context) (res any, err error) {
|
|
ss := session.Get(ctx)
|
|
|
|
schedules, err := listCurrentAndNextSpecialRotationSchedules(ss, time.Now())
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
liveList := make([]liveapischema.LiveList, 0, len(schedules))
|
|
for _, schedule := range schedules {
|
|
liveList = append(liveList, liveapischema.LiveList{
|
|
LiveDifficultyID: schedule.LiveDifficultyID,
|
|
StartDate: schedule.StartTime.Format("2006-01-02 15:04:05"),
|
|
EndDate: schedule.EndTime.Format("2006-01-02 15:04:05"),
|
|
IsRandom: false,
|
|
})
|
|
}
|
|
|
|
res = liveapischema.ScheduleResp{
|
|
Result: liveapischema.ScheduleData{
|
|
EventList: []any{},
|
|
LiveList: liveList,
|
|
LimitedBonusList: []any{},
|
|
LimitedBonusCommonList: []liveapischema.LimitedBonusCommonList{},
|
|
RandomLiveList: buildRandomLiveList(),
|
|
FreeLiveList: []any{},
|
|
TrainingLiveList: []liveapischema.TrainingLiveList{},
|
|
},
|
|
Status: 200,
|
|
CommandNum: false,
|
|
TimeStamp: time.Now().Unix(),
|
|
}
|
|
|
|
return res, err
|
|
}
|