集成redis & task

This commit is contained in:
limqhz
2022-05-04 02:45:31 +08:00
parent cf985bd44f
commit f701baaf04
10 changed files with 802 additions and 6 deletions

View File

@@ -117,11 +117,9 @@ public class BlogController {
@GetMapping("/blog/read/{bid}")
public String read(@PathVariable("bid") String bid,Model model){
Blog blog = blogService.getOne(new QueryWrapper<Blog>().eq("bid", bid));
// todo: redis缓存. 防止阅读重复
blog.setViews(blog.getViews()+1);
blogService.updateById(blog);
model.addAttribute("blog",blog);
// todo 查询评论
List<Comment> commentList = commentService.list(new QueryWrapper<Comment>().eq("topic_id", bid).orderByDesc("gmt_create"));
model.addAttribute("commentList",commentList);
return "blog/read";