fix: clear cache when thumbup

main
wangqing 9 months ago
parent 254863f7cc
commit 41c2a000db

@ -359,6 +359,14 @@ public class CommentController extends BaseController {
// return Result.failed(StatusCode.COMMENT_REPEAT_THUMBUP); // return Result.failed(StatusCode.COMMENT_REPEAT_THUMBUP);
// } // }
Comment comment = commentService.findById(commentId);
cacheChannel.clear(Constants.J2CACHE_REGION_JOURNAL_COMMENT_PAGE_HOT+"_"+comment.getRootJournalId());
cacheChannel.clear(Constants.J2CACHE_REGION_JOURNAL_COMMENT_PAGE_NEW+"_"+comment.getRootJournalId());
if(StringUtils.isNotEmpty(comment.getParentId())) {
cacheChannel.clear(Constants.J2CACHE_REGION_JOURNAL_COMMENT_PAGE_CHILDREN+"_"+comment.getParentId());
}
// 判断当前用户是否已经点赞 // 判断当前用户是否已经点赞
Integer flag = likeService.likePublication(commentId,userId,2,avatar,nickName); Integer flag = likeService.likePublication(commentId,userId,2,avatar,nickName);
if (flag==0) { if (flag==0) {

@ -76,8 +76,8 @@ public class CommentService {
} }
if(StringUtils.isEmpty(comment.getParentId())) { if(StringUtils.isEmpty(comment.getParentId())) {
cacheChannel.clear(Constants.J2CACHE_REGION_JOURNAL_COMMENT_PAGE_HOT+"_"+comment.getJournalId()); cacheChannel.clear(Constants.J2CACHE_REGION_JOURNAL_COMMENT_PAGE_HOT+"_"+comment.getRootJournalId());
cacheChannel.clear(Constants.J2CACHE_REGION_JOURNAL_COMMENT_PAGE_NEW+"_"+comment.getJournalId()); cacheChannel.clear(Constants.J2CACHE_REGION_JOURNAL_COMMENT_PAGE_NEW+"_"+comment.getRootJournalId());
// System.out.println("journalId____"+comment.getJournalId()); // System.out.println("journalId____"+comment.getJournalId());
} }

Loading…
Cancel
Save