集成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

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