Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in
Toggle navigation
T
tanpu-community
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
探普后端
tanpu-community
Commits
6d0d9613
Commit
6d0d9613
authored
Aug 19, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
删除评论时删除消息通知
parent
0cf557e3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
6 deletions
+6
-6
NotificationManager.java
...java/com/tanpu/community/manager/NotificationManager.java
+1
-1
NotificationService.java
...java/com/tanpu/community/service/NotificationService.java
+3
-3
TimeUtils.java
...ice/src/main/java/com/tanpu/community/util/TimeUtils.java
+2
-2
No files found.
community-service/src/main/java/com/tanpu/community/manager/NotificationManager.java
View file @
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
,
TimeUtils
.
format
(
LocalDateTime
.
now
(
)),
60
*
60
*
24
*
30
);
String
.
valueOf
(
TimeUtils
.
calMillisTillNow
(
LocalDateTime
.
now
()
)),
60
*
60
*
24
*
30
);
return
themeNotifyQos
;
return
themeNotifyQos
;
}
}
...
...
community-service/src/main/java/com/tanpu/community/service/NotificationService.java
View file @
6d0d9613
...
@@ -230,7 +230,7 @@ public class NotificationService {
...
@@ -230,7 +230,7 @@ public class NotificationService {
}
}
// 处理更新数量
// 处理更新数量
String
lastQueryTime
=
redisCache
.
get
(
RedisKeyConstant
.
MESSAGE_NOTIFY_QUERY_TIME
+
notifyUserId
);
LocalDateTime
lastQueryTime
=
JsonUtil
.
toBean
(
redisCache
.
get
(
RedisKeyConstant
.
MESSAGE_NOTIFY_QUERY_TIME
+
notifyUserId
),
LocalDateTime
.
class
);
// 如果删除的评论时时间在红点提示时间内,则缓存数-1
// 如果删除的评论时时间在红点提示时间内,则缓存数-1
if
(!
TimeUtils
.
lessThan
(
lastQueryTime
,
commentTime
))
{
if
(!
TimeUtils
.
lessThan
(
lastQueryTime
,
commentTime
))
{
redisCache
.
decr
(
RedisKeyConstant
.
MESSAGE_NOTIFY_COUNT
+
notifyUserId
);
redisCache
.
decr
(
RedisKeyConstant
.
MESSAGE_NOTIFY_COUNT
+
notifyUserId
);
...
@@ -245,7 +245,7 @@ public class NotificationService {
...
@@ -245,7 +245,7 @@ public class NotificationService {
String
cacheTime
=
redisCache
.
get
(
RedisKeyConstant
.
MESSAGE_NOTIFY_LAST_TIME
+
notifyUserId
);
String
cacheTime
=
redisCache
.
get
(
RedisKeyConstant
.
MESSAGE_NOTIFY_LAST_TIME
+
notifyUserId
);
if
(
StringUtils
.
isBlank
(
cacheTime
)
||
TimeUtils
.
lessThan
(
cacheTime
,
updateTime
))
{
if
(
StringUtils
.
isBlank
(
cacheTime
)
||
TimeUtils
.
lessThan
(
cacheTime
,
updateTime
))
{
redisCache
.
set
(
RedisKeyConstant
.
MESSAGE_NOTIFY_LAST_MSG
+
notifyUserId
,
userInfo
.
getNickName
()
+
type
.
getType
()
+
"了你的内容"
,
60
*
60
*
24
*
30
);
redisCache
.
set
(
RedisKeyConstant
.
MESSAGE_NOTIFY_LAST_MSG
+
notifyUserId
,
userInfo
.
getNickName
()
+
type
.
getType
()
+
"了你的内容"
,
60
*
60
*
24
*
30
);
redisCache
.
set
(
RedisKeyConstant
.
MESSAGE_NOTIFY_LAST_TIME
+
notifyUserId
,
TimeUtils
.
format
(
LocalDateTime
.
now
()
),
60
*
60
*
24
*
30
);
redisCache
.
set
(
RedisKeyConstant
.
MESSAGE_NOTIFY_LAST_TIME
+
notifyUserId
,
TimeUtils
.
format
(
updateTime
),
60
*
60
*
24
*
30
);
}
}
}
}
...
@@ -256,7 +256,7 @@ public class NotificationService {
...
@@ -256,7 +256,7 @@ public class NotificationService {
String
cacheTime
=
redisCache
.
get
(
RedisKeyConstant
.
MESSAGE_NOTIFY_LAST_TIME
+
notifyUserId
);
String
cacheTime
=
redisCache
.
get
(
RedisKeyConstant
.
MESSAGE_NOTIFY_LAST_TIME
+
notifyUserId
);
if
(
StringUtils
.
isBlank
(
cacheTime
)
||
TimeUtils
.
lessThan
(
cacheTime
,
updateTime
))
{
if
(
StringUtils
.
isBlank
(
cacheTime
)
||
TimeUtils
.
lessThan
(
cacheTime
,
updateTime
))
{
redisCache
.
set
(
RedisKeyConstant
.
MESSAGE_NOTIFY_LAST_MSG
+
notifyUserId
,
userInfo
.
getNickName
()
+
"关注了你"
,
60
*
60
*
24
*
30
);
redisCache
.
set
(
RedisKeyConstant
.
MESSAGE_NOTIFY_LAST_MSG
+
notifyUserId
,
userInfo
.
getNickName
()
+
"关注了你"
,
60
*
60
*
24
*
30
);
redisCache
.
set
(
RedisKeyConstant
.
MESSAGE_NOTIFY_LAST_TIME
+
notifyUserId
,
TimeUtils
.
format
(
LocalDateTime
.
now
()
),
60
*
60
*
24
*
30
);
redisCache
.
set
(
RedisKeyConstant
.
MESSAGE_NOTIFY_LAST_TIME
+
notifyUserId
,
TimeUtils
.
format
(
updateTime
),
60
*
60
*
24
*
30
);
}
}
}
}
...
...
community-service/src/main/java/com/tanpu/community/util/TimeUtils.java
View file @
6d0d9613
...
@@ -99,10 +99,10 @@ public class TimeUtils {
...
@@ -99,10 +99,10 @@ public class TimeUtils {
}
}
public
static
boolean
lessThan
(
String
cacheTime
,
LocalDateTime
updateTime
)
{
public
static
boolean
lessThan
(
String
cacheTime
,
LocalDateTime
updateTime
)
{
return
calMillisTillNow
(
reFormat
(
cacheTime
))
<
calMillisTillNow
(
updateTime
);
return
calMillisTillNow
(
reFormat
(
cacheTime
))
>
calMillisTillNow
(
updateTime
);
}
}
public
static
boolean
lessThan
(
LocalDateTime
before
,
LocalDateTime
after
)
{
public
static
boolean
lessThan
(
LocalDateTime
before
,
LocalDateTime
after
)
{
return
calMillisTillNow
(
before
)
<
calMillisTillNow
(
after
);
return
calMillisTillNow
(
before
)
>
calMillisTillNow
(
after
);
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment