Commit 1a0dbd23 authored by 刘基明's avatar 刘基明

删除评论时删除消息通知

parent 6d0d9613
...@@ -140,7 +140,7 @@ public class NotificationManager { ...@@ -140,7 +140,7 @@ public class NotificationManager {
redisCache.evict(RedisKeyConstant.MESSAGE_NOTIFY_COUNT + userId); redisCache.evict(RedisKeyConstant.MESSAGE_NOTIFY_COUNT + userId);
// 更新查询时间,用于删除评论 // 更新查询时间,用于删除评论
redisCache.set(RedisKeyConstant.MESSAGE_NOTIFY_QUERY_TIME + userId, redisCache.set(RedisKeyConstant.MESSAGE_NOTIFY_QUERY_TIME + userId,
String.valueOf(TimeUtils.calMillisTillNow(LocalDateTime.now())),60 * 60 * 24 * 30); JsonUtil.toJson(LocalDateTime.now()),60 * 60 * 24 * 30);
return themeNotifyQos; return themeNotifyQos;
} }
......
...@@ -230,9 +230,10 @@ public class NotificationService { ...@@ -230,9 +230,10 @@ public class NotificationService {
} }
// 处理更新数量 // 处理更新数量
LocalDateTime lastQueryTime =JsonUtil.toBean(redisCache.get(RedisKeyConstant.MESSAGE_NOTIFY_QUERY_TIME + notifyUserId),LocalDateTime.class); String lastTime = redisCache.get(RedisKeyConstant.MESSAGE_NOTIFY_QUERY_TIME + notifyUserId);
LocalDateTime lastQueryTime =StringUtils.isNotBlank(lastTime)?JsonUtil.toBean(lastTime,LocalDateTime.class):LocalDateTime.now();
// 如果删除的评论时时间在红点提示时间内,则缓存数-1 // 如果删除的评论时时间在红点提示时间内,则缓存数-1
if (!TimeUtils.lessThan(lastQueryTime, commentTime)) { if (StringUtils.isBlank(lastTime) || TimeUtils.lessThan(lastQueryTime, commentTime)) {
redisCache.decr(RedisKeyConstant.MESSAGE_NOTIFY_COUNT + notifyUserId); redisCache.decr(RedisKeyConstant.MESSAGE_NOTIFY_COUNT + notifyUserId);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment