...
|
...
|
@@ -102,10 +102,16 @@ public class UnionServiceImpl implements IUnionService { |
|
|
// }
|
|
|
|
|
|
//保存到缓存中,有效期三个小时
|
|
|
yhValueOperations.setIfAbsent(key, JSON.toJSONString(request));
|
|
|
DynamicIntProperty activeTime = DynamicPropertyFactory.getInstance().getIntProperty("activeTime", 3 * 60 * 60);
|
|
|
yHRedisTemplate.longExpire(key, activeTime.get(), TimeUnit.SECONDS);
|
|
|
log.info("clickUnion set redis success with request={}", request);
|
|
|
try {
|
|
|
yhValueOperations.setIfAbsent(key, JSON.toJSONString(request));
|
|
|
DynamicIntProperty activeTime = DynamicPropertyFactory.getInstance().getIntProperty("activeTime", 3 * 60 * 60);
|
|
|
yHRedisTemplate.longExpire(key, activeTime.get(), TimeUnit.SECONDS);
|
|
|
log.info("clickUnion set redis success with request={}", request);
|
|
|
} catch (Exception e) {
|
|
|
log.error("clickUnion error set redis error with request={}", request);
|
|
|
return new UnionResponse(204, "set redis error");
|
|
|
}
|
|
|
|
|
|
|
|
|
// if (union != null) {
|
|
|
// //如果90天以内,已经存在点击记录,则不需要插入或更新数据库
|
...
|
...
|
@@ -156,8 +162,14 @@ public class UnionServiceImpl implements IUnionService { |
|
|
|
|
|
//组装redis保存的key
|
|
|
String key = UNION_KEY + "_" + request.getClientIp() + "_" + request.getTd();
|
|
|
String value = "";
|
|
|
try {
|
|
|
value = yhValueOperations.get(key);
|
|
|
} catch (Exception e) {
|
|
|
log.error("activateUnion error get redis error with request={}", request);
|
|
|
return new UnionResponse(204, "get redis error");
|
|
|
}
|
|
|
|
|
|
String value = yhValueOperations.get(key);
|
|
|
log.info("activateUnion get key={}, value={}", key, value);
|
|
|
//如果redis中不存在存在该用户点击信息,则退出
|
|
|
if (StringUtils.isEmpty(value)) {
|
...
|
...
|
|