diff --git a/rule/egg_energy/give_activty_coin.go b/rule/egg_energy/give_activty_coin.go index b2664e4..c367834 100644 --- a/rule/egg_energy/give_activty_coin.go +++ b/rule/egg_energy/give_activty_coin.go @@ -31,6 +31,16 @@ func SettlementGiveActivityCoin(engine *xorm.Engine, user model.User, ecpm strin uid := user.Id now := time.Now() + //TODO::拒绝重复异常回调 + redisKey := fmt.Sprintf(md2.UserNextWatchAdDate, uid) + nextWatchAdDate, _ := cache.GetString(redisKey) + if nextWatchAdDate != "" { + nextWatchAdDateValue := egg_system_rules.String2Time(nextWatchAdDate) + if nextWatchAdDateValue.After(time.Now()) { + return 0, errors.New("未到可观看时间~~") + } + } + //1、查找 `egg_energy_basic_setting` 基础设置 eggEnergyBasicSettingDb := implement.NewEggEnergyBasicSettingDb(engine) eggEnergyBasicSetting, err := eggEnergyBasicSettingDb.EggEnergyBasicSettingGetOneByParams(map[string]interface{}{ @@ -315,7 +325,7 @@ func SettlementGiveActivityCoin(engine *xorm.Engine, user model.User, ecpm strin return rewardValue, err2 } } - redisKey := fmt.Sprintf(md2.UserNextWatchAdDate, uid) + var watchAdDate string if eggEnergyUserWatchRecords.ResidueWatchAdNum == egg_system_rules.StrToInt(videoRewardSystem.RewardTotalNum) { if eggEnergyUserWatchRecords.NextWatchAdDate.Before(time.Now()) {