diff --git a/README.md b/README.md index a57f6373c..c31df735a 100755 --- a/README.md +++ b/README.md @@ -78,7 +78,7 @@ Let's start: http://localhost:8090 ## Todo 后续功能 -- [ ] 文章阅读统计 +- [x] 文章阅读统计 - [ ] 文章顶置 - [ ] 集成又拍云,七牛云等云服务 diff --git a/src/main/java/cc/ryanc/halo/web/controller/admin/PostController.java b/src/main/java/cc/ryanc/halo/web/controller/admin/PostController.java index 4757cb313..ed57ae409 100755 --- a/src/main/java/cc/ryanc/halo/web/controller/admin/PostController.java +++ b/src/main/java/cc/ryanc/halo/web/controller/admin/PostController.java @@ -11,7 +11,6 @@ import cc.ryanc.halo.utils.HaloUtils; import cc.ryanc.halo.web.controller.core.BaseController; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; -import org.omg.PortableServer.POA; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; @@ -174,6 +173,7 @@ public class PostController extends BaseController{ if(null!=post.getPostId()){ post.setPostDate(postService.findByPostId(post.getPostId()).get().getPostDate()); post.setPostUpdate(new Date()); + post.setPostViews(postService.findByPostId(post.getPostId()).get().getPostViews()); }else{ post.setPostDate(new Date()); post.setPostUpdate(new Date()); diff --git a/src/main/java/cc/ryanc/halo/web/controller/front/FrontPageController.java b/src/main/java/cc/ryanc/halo/web/controller/front/FrontPageController.java index e4f6bc816..a32d3e153 100644 --- a/src/main/java/cc/ryanc/halo/web/controller/front/FrontPageController.java +++ b/src/main/java/cc/ryanc/halo/web/controller/front/FrontPageController.java @@ -72,7 +72,7 @@ public class FrontPageController extends BaseController { Sort sort = new Sort(Sort.Direction.DESC,"commentDate"); Pageable pageable = PageRequest.of(0,999,sort); - Page comments = commentService.findCommentsByPostAndCommentStatus(post,pageable,2); + Page comments = commentService.findCommentsByPostAndCommentStatus(post,pageable,0); if(null==post){ return this.renderNotFound(); }