From 527c11f0756c8961e3b34123298f089b3c136d99 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Sun, 4 Feb 2024 15:07:40 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E4=B8=80=E4=B8=AA=E5=9C=88=E5=9C=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ircles_public_platoon_give_activty_coin.go | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/rule/one_circles/one_circles_public_platoon_give_activty_coin.go b/rule/one_circles/one_circles_public_platoon_give_activty_coin.go index 51c925f..dc6cd54 100644 --- a/rule/one_circles/one_circles_public_platoon_give_activty_coin.go +++ b/rule/one_circles/one_circles_public_platoon_give_activty_coin.go @@ -126,10 +126,12 @@ func SettlementPublicGiveActivityCoin(engine *xorm.Engine, masterId string, uid } else { residueWatchAdNum := oneCirclesUserWatchRecords.ResidueWatchAdNum - 1 nextWatchAdDate := oneCirclesUserWatchRecords.NextWatchAdDate - if residueWatchAdNum == 0 { - nextWatchAdDate = now.Add(time.Hour * time.Duration(zhios_order_relate_utils.StrToInt(videoRewardSystem.EachRoundHour))) + if residueWatchAdNum == 0 { //最后一条广告 residueWatchAdNum = zhios_order_relate_utils.StrToInt(videoRewardSystem.RewardTotalNum) } + if residueWatchAdNum == zhios_order_relate_utils.StrToInt(videoRewardSystem.RewardTotalNum)-1 { //第一条广告 + nextWatchAdDate = now.Add(time.Hour * time.Duration(zhios_order_relate_utils.StrToInt(videoRewardSystem.EachRoundHour))) + } oneCirclesUserWatchRecords.ResidueWatchAdNum = residueWatchAdNum oneCirclesUserWatchRecords.NextWatchAdDate = nextWatchAdDate _, err2 := db.OneCirclesUserWatchRecordsUpdate(engine, oneCirclesUserWatchRecords.Id, oneCirclesUserWatchRecords, "residue_watch_ad_num", "next_watch_ad_date") @@ -189,13 +191,18 @@ func SettlementPublicGiveActivityCoin(engine *xorm.Engine, masterId string, uid } redisKey := fmt.Sprintf(md2.UserNextWatchAdDate, masterId, uid) - var nextWatchAdDate string - if oneCirclesUserWatchRecords.NextWatchAdDate.After(time.Now()) { - nextWatchAdDate = oneCirclesUserWatchRecords.NextWatchAdDate.Format("2006-01-02 15:04:05") + var watchAdDate string + if oneCirclesUserWatchRecords.ResidueWatchAdNum == zhios_order_relate_utils.StrToInt(videoRewardSystem.RewardTotalNum) { + if oneCirclesUserWatchRecords.NextWatchAdDate.Before(time.Now()) { + watchAdDate = "" + } else { + watchAdDate = oneCirclesUserWatchRecords.NextWatchAdDate.Format("2006-01-02 15:04:05") + } } else { - nextWatchAdDate = time.Now().Add(time.Duration(zhios_order_relate_utils.StrToInt64(videoRewardSystem.IntervalMinutes)) * time.Minute).Format("2006-01-02 15:04:05") + watchAdDate = time.Now().Add(time.Duration(zhios_order_relate_utils.StrToInt64(videoRewardSystem.IntervalMinutes)) * time.Minute).Format("2006-01-02 15:04:05") + //watchAdDate = oneCirclesUserWatchRecords.NextWatchAdDate.Format("2006-01-02 15:04:05") } - cache.SetEx(redisKey, nextWatchAdDate, 60*2) //TODO::默认缓存1小时 + cache.SetEx(redisKey, watchAdDate, 60*60*12) //TODO::默认缓存1小时 } return }