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,39 @@
|
||||
package rlive
|
||||
|
||||
import (
|
||||
"errors"
|
||||
usermodel "honoka-chan/internal/model/user"
|
||||
"honoka-chan/internal/session"
|
||||
)
|
||||
|
||||
func getRandomLiveByToken(ss *session.Session, token string) (usermodel.UserLiveRandom, error) {
|
||||
if token == "" {
|
||||
return usermodel.UserLiveRandom{}, errors.New("random live token is required")
|
||||
}
|
||||
|
||||
row := usermodel.UserLiveRandom{}
|
||||
has, err := ss.UserEng.Table(new(usermodel.UserLiveRandom)).
|
||||
Where("user_id = ? AND token = ?", ss.UserID, token).
|
||||
Get(&row)
|
||||
if err != nil {
|
||||
return usermodel.UserLiveRandom{}, err
|
||||
}
|
||||
if !has {
|
||||
return usermodel.UserLiveRandom{}, errors.New("random live session not found")
|
||||
}
|
||||
|
||||
return row, nil
|
||||
}
|
||||
|
||||
func deleteRandomLiveByToken(ss *session.Session, token string) {
|
||||
if token == "" || ss.UserEng == nil {
|
||||
return
|
||||
}
|
||||
|
||||
_, err := ss.UserEng.Table(new(usermodel.UserLiveRandom)).
|
||||
Where("user_id = ? AND token = ?", ss.UserID, token).
|
||||
Delete()
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user