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:
@@ -14,24 +14,37 @@ import (
|
||||
func partyList(ctx *gin.Context) {
|
||||
ss := session.Get(ctx)
|
||||
defer ss.Finalize()
|
||||
userInfo := ss.GetUserInfo()
|
||||
|
||||
pref := usermodel.UserPref{}
|
||||
_, err := ss.UserEng.Table("user_pref").Where("user_id = ?", ss.UserID).Get(&pref)
|
||||
partyListData, err := BuildPartyListData(ss)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
}
|
||||
|
||||
ss.Respond(liveschema.PartyListResp{
|
||||
ResponseData: partyListData,
|
||||
ReleaseInfo: []any{},
|
||||
StatusCode: 200,
|
||||
})
|
||||
}
|
||||
|
||||
func BuildPartyListData(ss *session.Session) (liveschema.PartyListData, error) {
|
||||
userInfo := ss.GetUserInfo()
|
||||
|
||||
pref := usermodel.UserPref{}
|
||||
_, err := ss.UserEng.Table("user_pref").Where("user_id = ?", ss.UserID).Get(&pref)
|
||||
if err != nil {
|
||||
return liveschema.PartyListData{}, err
|
||||
}
|
||||
|
||||
supportRows, err := listLiveSupportRows(ss)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
if err != nil {
|
||||
return liveschema.PartyListData{}, err
|
||||
}
|
||||
|
||||
partyList := make([]liveschema.PartyList, 0, len(supportRows))
|
||||
for _, row := range supportRows {
|
||||
party, err := buildLiveSupportParty(ss, row)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
if err != nil {
|
||||
return liveschema.PartyListData{}, err
|
||||
}
|
||||
partyList = append(partyList, party)
|
||||
}
|
||||
@@ -44,22 +57,18 @@ func partyList(ctx *gin.Context) {
|
||||
}
|
||||
selfParty.AvailableSocialPoint = 10
|
||||
selfParty.CenterUnitInfo, err = mustFindCenterUnitInfo(ss, ss.UserID, pref.UnitOwningUserID)
|
||||
if ss.CheckErr(err) {
|
||||
return
|
||||
if err != nil {
|
||||
return liveschema.PartyListData{}, err
|
||||
}
|
||||
partyList = append(partyList, selfParty)
|
||||
}
|
||||
|
||||
ss.Respond(liveschema.PartyListResp{
|
||||
ResponseData: liveschema.PartyListData{
|
||||
PartyList: partyList,
|
||||
TrainingEnergy: userInfo.TrainingEnergy,
|
||||
TrainingEnergyMax: userInfo.TrainingEnergyMax,
|
||||
ServerTimestamp: time.Now().Unix(),
|
||||
},
|
||||
ReleaseInfo: []any{},
|
||||
StatusCode: 200,
|
||||
})
|
||||
return liveschema.PartyListData{
|
||||
PartyList: partyList,
|
||||
TrainingEnergy: userInfo.TrainingEnergy,
|
||||
TrainingEnergyMax: userInfo.TrainingEnergyMax,
|
||||
ServerTimestamp: time.Now().Unix(),
|
||||
}, nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
||||
Reference in New Issue
Block a user