feat: 1.uni-ad广告回调接入 2.广告奖励免费观看时长

This commit is contained in:
张松
2024-12-23 17:12:38 +08:00
parent b7e8047b4c
commit 81da6fa6a3

View File

@@ -1,5 +1,6 @@
package com.sqx.modules.redisService.impl;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
@@ -68,6 +69,7 @@ public class RedisServiceImpl implements RedisService {
}
}
@Override
public Boolean getFreeWatchTimeIsExpire(Long userId) {
String freeWatchKey = RedisKeys.getFreeWatchKey(userId, true);
@@ -98,8 +100,12 @@ public class RedisServiceImpl implements RedisService {
Integer second = jsonObject.getInteger("second");
if (expireTime == -1) {
jsonObject.put("expireTime", DateUtil.offsetSecond(DateUtil.date(), second).getTime());
redisUtils.set(watchKey, jsonObject.toJSONString(), -1);
DateTime now = DateUtil.date();
jsonObject.put("expireTime", DateUtil.offsetSecond(now, second).getTime());
Date tomorrow = DateUtil.beginOfDay(DateUtil.offsetDay(now, 1));
long expire = DateUtil.between(now, tomorrow, DateUnit.SECOND);
redisUtils.set(watchKey, jsonObject.toJSONString(), expire);
return false;
}else {
return DateUtil.current() > expireTime;