Improve live and random live handling
- 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>
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
package rlive
|
||||
|
||||
import (
|
||||
livehandler "honoka-chan/internal/handler/live"
|
||||
"honoka-chan/internal/middleware"
|
||||
"honoka-chan/internal/router"
|
||||
rliveschema "honoka-chan/internal/schema/rlive"
|
||||
"honoka-chan/internal/session"
|
||||
honokautils "honoka-chan/internal/utils"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func gameOver(ctx *gin.Context) {
|
||||
ss := session.Get(ctx)
|
||||
token := ""
|
||||
defer func() {
|
||||
if ss.UserEng != nil {
|
||||
deleteRandomLiveByToken(ss, token)
|
||||
ss.ClearLiveInProgress()
|
||||
}
|
||||
ss.Finalize()
|
||||
}()
|
||||
|
||||
req := rliveschema.TokenReq{}
|
||||
err := honokautils.ParseRequestData(ctx, &req)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
token = req.Token
|
||||
|
||||
_, err = getRandomLiveByToken(ss, req.Token)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
ss.Respond(livehandler.BuildGameOverResp())
|
||||
}
|
||||
|
||||
func init() {
|
||||
router.AddHandler("main.php", "POST", "/rlive/gameover", middleware.Common, gameOver)
|
||||
}
|
||||
Reference in New Issue
Block a user