sav7ng / WeHalo

WeHalo 简约风 的微信小程序版博客:sparkles:
https://github.com/savingrun/wehalo
GNU General Public License v3.0
2.01k stars 370 forks source link

微信小程序 查看文章详情增加浏览数功能 #72

Closed hgmsq closed 4 years ago

hgmsq commented 4 years ago

1、替换PostController.java 方法,然后重新编译halo 生成 PostController.class 文件,然后替换jar包里面的 PostController.class文件,最后重启jar就可以了。

@GetMapping("{postId:\d+}") @ApiOperation("Gets a post") public BasePostDetailDTO getBy(@PathVariable("postId") Integer postId, @RequestParam(value = "formatDisabled", required = false, defaultValue = "true") Boolean formatDisabled, @RequestParam(value = "sourceDisabled", required = false, defaultValue = "false") Boolean sourceDisabled) { BasePostDetailDTO detailDTO = postService.convertToDetail(postService.getById(postId));

    if (formatDisabled) {
        // Clear the format content
        detailDTO.setFormatContent(null);
    }

    if (sourceDisabled) {
        // Clear the original content
        detailDTO.setOriginalContent(null);
    }
    postService.increaseVisit(postId);
    return detailDTO;
}

小程序名称:IT技术分享社区 IT技术分享社区 gh_32334eb097cd_430

sav7ng commented 4 years ago

感谢贡献