as: Fix daily live

Signed-off-by: Yuan Si <do4suki@gmail.com>
This commit is contained in:
2023-06-23 16:12:00 +08:00
parent e69f54c071
commit 39bd746d36
3 changed files with 28 additions and 2 deletions
BIN
View File
Binary file not shown.
+19 -2
View File
@@ -184,8 +184,25 @@ func AsGetClearedPlatformAchievement(ctx *gin.Context) {
} }
func AsFetchLiveMusicSelect(ctx *gin.Context) { func AsFetchLiveMusicSelect(ctx *gin.Context) {
signBody, _ := sjson.Set(utils.ReadAllText("assets/as/fetchLiveMusicSelect.json"), now := time.Now()
"user_model_diff.user_status", GetUserStatus()) year, month, day := now.Year(), now.Month(), now.Day()
tomorrow := time.Date(year, month, day+1, 0, 0, 0, 0, now.Location()).Unix()
weekday := int(now.Weekday())
liveDailyList := []model.LiveDaily{}
err := MainEng.Table("m_live_daily").Where("weekday = ?", weekday).Cols("id,live_id").Find(&liveDailyList)
CheckErr(err)
for k := range liveDailyList {
liveDailyList[k].EndAt = int(tomorrow)
liveDailyList[k].RemainingPlayCount = 5
liveDailyList[k].RemainingRecoveryCount = 9
}
signBody := utils.ReadAllText("assets/as/fetchLiveMusicSelect.json")
signBody, _ = sjson.Set(signBody, "weekday_state.weekday", weekday)
signBody, _ = sjson.Set(signBody, "weekday_state.next_weekday_at", tomorrow)
signBody, _ = sjson.Set(signBody, "live_daily_list", liveDailyList)
signBody, _ = sjson.Set(signBody, "user_model_diff.user_status", GetUserStatus())
resp := SignResp(ctx.GetString("ep"), signBody, sessionKey) resp := SignResp(ctx.GetString("ep"), signBody, sessionKey)
ctx.Header("Content-Type", "application/json") ctx.Header("Content-Type", "application/json")
+9
View File
@@ -542,3 +542,12 @@ type UserCommunicationMemberDetailBadgeByID struct {
IsCardBadge bool `json:"is_card_badge"` IsCardBadge bool `json:"is_card_badge"`
IsMusicBadge bool `json:"is_music_badge"` IsMusicBadge bool `json:"is_music_badge"`
} }
// LiveDaily ...
type LiveDaily struct {
LiveDailyMasterID int `json:"live_daily_master_id" xorm:"id"`
LiveMasterID int `json:"live_master_id" xorm:"live_id"`
EndAt int `json:"end_at"`
RemainingPlayCount int `json:"remaining_play_count"`
RemainingRecoveryCount int `json:"remaining_recovery_count"`
}