diff --git a/app/hdl/hdl_home_page.go b/app/hdl/hdl_home_page.go index 436d08d..5b29452 100644 --- a/app/hdl/hdl_home_page.go +++ b/app/hdl/hdl_home_page.go @@ -235,6 +235,21 @@ func HomePageWatchAdRule(c *gin.Context) { if nextWatchAdTimes < 0 { nextWatchAdTimes = 0 } + var roundRemainingSecs int64 + now := time.Now() + nowStr := now.Format("2006-01-02 15:04:05") + signInDb := implement.NewEggSignInDb(db.Db) + has, signIn, err := signInDb.EggSignInGetOne(nowStr, nowStr, user.Id) + if err != nil { + e.OutErr(c, e.ERR_DB_ORM, err.Error()) + return + } + if has { + roundRemainingSecs = utils.TimeParseStd(signIn.EndTime).Unix() - time.Now().Unix() + if roundRemainingSecs < 0 { + roundRemainingSecs = 0 + } + } utils.FilePutContents("nextWatchAdDate", utils.SerializeStr(map[string]interface{}{ "nextWatchAdDate": nextWatchAdDate, @@ -250,6 +265,7 @@ func HomePageWatchAdRule(c *gin.Context) { NextWatchAdDate: nextWatchAdDate, NextWatchAdSecs: nextWatchAdTimes, EachRoundHour: videoRewardSystem.EachRoundHour, + RoundRemainingSecs: roundRemainingSecs, } e.OutSuc(c, resp, nil) } diff --git a/app/md/md_home_page.go b/app/md/md_home_page.go index f708ad5..89e08d2 100644 --- a/app/md/md_home_page.go +++ b/app/md/md_home_page.go @@ -18,6 +18,7 @@ type HomePageWatchAdRuleResp struct { NextWatchAdDate string `json:"next_watch_ad_date"` // 下次可观看广告时间,若为空允许观看视频 NextWatchAdSecs int64 `json:"next_watch_ad_secs"` // 下次可观看广告时间,若为空允许观看视频 EachRoundHour string `json:"each_round_hour"` // 每一轮X个小时 + RoundRemainingSecs int64 `json:"round_remaining_secs"` // 本轮剩余时间 } type RealTimePriceResp struct { diff --git a/docs/docs.go b/docs/docs.go index e92b442..0e23939 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -4079,6 +4079,10 @@ const docTemplate = `{ "description": "总可观看广告数量", "type": "string" }, + "round_remaining_secs": { + "description": "本轮剩余时间", + "type": "integer" + }, "watch_ad_reward_active_points": { "description": "观看广告视频奖励X个活跃积分", "type": "string" diff --git a/docs/swagger.json b/docs/swagger.json index f98346e..76c9c97 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -4073,6 +4073,10 @@ "description": "总可观看广告数量", "type": "string" }, + "round_remaining_secs": { + "description": "本轮剩余时间", + "type": "integer" + }, "watch_ad_reward_active_points": { "description": "观看广告视频奖励X个活跃积分", "type": "string" diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 5fae649..e1ba469 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -675,6 +675,9 @@ definitions: reward_total_num: description: 总可观看广告数量 type: string + round_remaining_secs: + description: 本轮剩余时间 + type: integer watch_ad_reward_active_points: description: 观看广告视频奖励X个活跃积分 type: string