👽 修复更新文章之后浏览量被重置的问题

pull/18/head
ruibaby 2018-05-24 00:00:27 +08:00
parent 490375eaf6
commit 9314847c2a
3 changed files with 3 additions and 3 deletions

View File

@ -78,7 +78,7 @@ Let's start: http://localhost:8090
## Todo 后续功能
- [ ] 文章阅读统计
- [x] 文章阅读统计
- [ ] 文章顶置
- [ ] 集成又拍云,七牛云等云服务

View File

@ -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());

View File

@ -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<Comment> comments = commentService.findCommentsByPostAndCommentStatus(post,pageable,2);
Page<Comment> comments = commentService.findCommentsByPostAndCommentStatus(post,pageable,0);
if(null==post){
return this.renderNotFound();
}