@@ -235,6 +235,21 @@ func HomePageWatchAdRule(c *gin.Context) { | |||||
if nextWatchAdTimes < 0 { | if nextWatchAdTimes < 0 { | ||||
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{}{ | utils.FilePutContents("nextWatchAdDate", utils.SerializeStr(map[string]interface{}{ | ||||
"nextWatchAdDate": nextWatchAdDate, | "nextWatchAdDate": nextWatchAdDate, | ||||
@@ -250,6 +265,7 @@ func HomePageWatchAdRule(c *gin.Context) { | |||||
NextWatchAdDate: nextWatchAdDate, | NextWatchAdDate: nextWatchAdDate, | ||||
NextWatchAdSecs: nextWatchAdTimes, | NextWatchAdSecs: nextWatchAdTimes, | ||||
EachRoundHour: videoRewardSystem.EachRoundHour, | EachRoundHour: videoRewardSystem.EachRoundHour, | ||||
RoundRemainingSecs: roundRemainingSecs, | |||||
} | } | ||||
e.OutSuc(c, resp, nil) | e.OutSuc(c, resp, nil) | ||||
} | } | ||||
@@ -18,6 +18,7 @@ type HomePageWatchAdRuleResp struct { | |||||
NextWatchAdDate string `json:"next_watch_ad_date"` // 下次可观看广告时间,若为空允许观看视频 | NextWatchAdDate string `json:"next_watch_ad_date"` // 下次可观看广告时间,若为空允许观看视频 | ||||
NextWatchAdSecs int64 `json:"next_watch_ad_secs"` // 下次可观看广告时间,若为空允许观看视频 | NextWatchAdSecs int64 `json:"next_watch_ad_secs"` // 下次可观看广告时间,若为空允许观看视频 | ||||
EachRoundHour string `json:"each_round_hour"` // 每一轮X个小时 | EachRoundHour string `json:"each_round_hour"` // 每一轮X个小时 | ||||
RoundRemainingSecs int64 `json:"round_remaining_secs"` // 本轮剩余时间 | |||||
} | } | ||||
type RealTimePriceResp struct { | type RealTimePriceResp struct { | ||||
@@ -4079,6 +4079,10 @@ const docTemplate = `{ | |||||
"description": "总可观看广告数量", | "description": "总可观看广告数量", | ||||
"type": "string" | "type": "string" | ||||
}, | }, | ||||
"round_remaining_secs": { | |||||
"description": "本轮剩余时间", | |||||
"type": "integer" | |||||
}, | |||||
"watch_ad_reward_active_points": { | "watch_ad_reward_active_points": { | ||||
"description": "观看广告视频奖励X个活跃积分", | "description": "观看广告视频奖励X个活跃积分", | ||||
"type": "string" | "type": "string" | ||||
@@ -4073,6 +4073,10 @@ | |||||
"description": "总可观看广告数量", | "description": "总可观看广告数量", | ||||
"type": "string" | "type": "string" | ||||
}, | }, | ||||
"round_remaining_secs": { | |||||
"description": "本轮剩余时间", | |||||
"type": "integer" | |||||
}, | |||||
"watch_ad_reward_active_points": { | "watch_ad_reward_active_points": { | ||||
"description": "观看广告视频奖励X个活跃积分", | "description": "观看广告视频奖励X个活跃积分", | ||||
"type": "string" | "type": "string" | ||||
@@ -675,6 +675,9 @@ definitions: | |||||
reward_total_num: | reward_total_num: | ||||
description: 总可观看广告数量 | description: 总可观看广告数量 | ||||
type: string | type: string | ||||
round_remaining_secs: | |||||
description: 本轮剩余时间 | |||||
type: integer | |||||
watch_ad_reward_active_points: | watch_ad_reward_active_points: | ||||
description: 观看广告视频奖励X个活跃积分 | description: 观看广告视频奖励X个活跃积分 | ||||
type: string | type: string | ||||