Skip to content

Commit

Permalink
Merge pull request #190 from terwer/v4.x
Browse files Browse the repository at this point in the history
feat:Add hits
  • Loading branch information
terwer authored Aug 23, 2022
2 parents 2c6288f + 5eb4e61 commit 7a39908
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
5 changes: 4 additions & 1 deletion jvue-front/components/themes/default/Aside.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ export default {
async mounted() {
const postsResult = await this.$axios.$post("/blog/post/list", {
isHot: 1,
postStatus: "publish"
postStatus: "publish",
postType: "post",
pageNum: 1,
pageSize: 25
});
this.postList = postsResult.status === 1 ? postsResult.data.list || [] : [];
logger.info("fetch aside postList finish");
Expand Down
12 changes: 12 additions & 0 deletions jvue-front/pages/post/_id.vue
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,15 @@ import { inBrowser } from "../../util/dom";
const logger = getLogger("pages/post");
// 更新浏览量
const updateHits = async (axiosObj, postId, hits) => {
const postParams = {
postId,
hits
};
await axiosObj.$post("/blog/post/updateHits", postParams);
};
export default {
components: { HeaderTime, Header, Footer, FriendLink, Artalk },
async asyncData(context) {
Expand Down Expand Up @@ -155,6 +164,9 @@ export default {
tagArray: tagArr
});
// 更新浏览量
await updateHits(context.$axios, postObj.id, ++postObj.hits);
logger.info("fetch siteConfig and post finish");
return { siteConfigObj, postObj, errorMessage };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ public RestResponse getPostList(@RequestParam(required = false) Integer pageNum,
}
if (null != isHot && isHot == 1) {
paramMap.put("isHot", isHot);
pageSize = 5;
}
if (StringUtils.isNotEmpty(postStatus)) {
paramMap.put("postStatus", postStatus);
Expand Down

1 comment on commit 7a39908

@vercel
Copy link

@vercel vercel bot commented on 7a39908 Aug 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.