fix delete comment with parentCommentCount-1

main
wangqing 9 months ago
parent 5cd9494eba
commit d5dc047c80

@ -149,6 +149,14 @@ public class CommentService {
cacheChannel.clear(Constants.J2CACHE_REGION_JOURNAL_COMMENT_PAGE_HOT+"_"+comment.getRootJournalId());
cacheChannel.clear(Constants.J2CACHE_REGION_JOURNAL_COMMENT_PAGE_NEW+"_"+comment.getRootJournalId());
rabbitTemplate.convertAndSend(Constants.RABBIT_MESSAGE_CLEAN_JOURANL_QUERY_PAGE,comment.getRootJournalId());
if (StringUtils.isNotEmpty(comment.getParentId())){
Query query = new Query();
query.addCriteria(Criteria.where("_id").is(comment.getRootId()));
Update update = new Update();
update.inc("commentCount",-1);
mongoTemplate.updateFirst(query,update,"comment");
}
// comment.setContent("原评论已删除");
// 同步publicationLike和CommentHis

Loading…
Cancel
Save