Commit ac15232a authored by 刘基明's avatar 刘基明

点赞评论消息通知 fix

parent dc2f667c
......@@ -189,8 +189,10 @@ public class CommentManager {
//删除评论
public void delete(String commentId, String userId) {
if (StringUtils.isBlank(commentId)){
throw new BizException("commentId不能为空");
}
commentService.delete(commentId, userId);
CommentEntity commentEntity = commentService.queryByIdIncludeDelete(commentId);
ThemeEntity themeEntity = themeService.queryByThemeId(commentEntity.getThemeId());
notificationService.deleteCommentNotify(themeEntity.getAuthorId(), userId, commentId, commentEntity.getCreateTime());
......
......@@ -232,10 +232,14 @@ public class NotificationService {
NotificationEntity commentNotify = notificationMapper.selectOne(new LambdaQueryWrapper<NotificationEntity>()
.eq(NotificationEntity::getTargetId, commentId)
.eq(NotificationEntity::getOperatorId, operatorId)
.eq(NotificationEntity::getMessageType, NotificationTypeEnum.COMMENT.getType()));
.eq(NotificationEntity::getNotifiedUserId, notifyUserId)
.eq(NotificationEntity::getMessageType, NotificationTypeEnum.COMMENT.getCode()));
NotificationEntity last = notificationMapper.selectOne(new LambdaQueryWrapper<NotificationEntity>().eq(NotificationEntity::getNotifiedUserId, notifyUserId)
.orderByDesc(NotificationEntity::getUpdateTime)
.last("limit 1"));
if (commentNotify==null || last==null){
return;
}
notificationMapper.deleteById(commentNotify.getId());
// 如果删除的评论是最後一條通知,则需要从库中再找一条最新的
if (last.getNotificationId().equals(commentNotify.getNotificationId())) {
......
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