Fixbug 私密日志取消被推荐、私密日志取消被搜索
This commit is contained in:
@@ -24,5 +24,6 @@ public interface BlogService extends IService<Blog> {
|
||||
|
||||
List<BlogWithUser> getMyBlogs(String userId,MyPageParam myPageParam);
|
||||
|
||||
void addRecord(Blog blog, String sessionId);
|
||||
BlogWithUser getReadBlog(String bid,String sessionId,String userId);
|
||||
|
||||
}
|
||||
|
||||
@@ -56,14 +56,23 @@ public class BlogServiceImpl extends ServiceImpl<BlogMapper, Blog> implements Bl
|
||||
return blogMapper.getMyBlogs(userId,myPageParam);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRecord(Blog blog, String sessionId) {
|
||||
String value = redisUtils.get(sessionId + blog.getBid());
|
||||
private void addRecord(BlogWithUser blogRead, String sessionId) {
|
||||
String value = redisUtils.get(sessionId + blogRead.getBid());
|
||||
Blog blog = new Blog();
|
||||
blog.setBid(blogRead.getBid());
|
||||
if (!QuinnConstant.SESSION_VIEW_KEY.equals(value)){
|
||||
blog.setViews(blog.getViews()+1);
|
||||
blog.setViews(blogRead.getViews()+1);
|
||||
redisUtils.set(sessionId + blog.getBid(),QuinnConstant.SESSION_VIEW_KEY,QuinnConstant.SESSION_TIME_OUT);
|
||||
updateById(blog);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlogWithUser getReadBlog(String bid, String sessionId, String userId) {
|
||||
BlogWithUser blog = blogMapper.getReadBlog(bid,userId);
|
||||
if (blog!=null){
|
||||
addRecord(blog,sessionId);
|
||||
}
|
||||
return blog;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user