use of com.zyd.blog.business.annotation.BussinessLog in project OneBlog by zhangyd-c.
the class RenderController method article.
/**
* 文章详情
*
* @param model
* @param articleId
* @return
*/
@GetMapping("/article/{articleId}")
@BussinessLog(value = "进入文章[{2}]详情页", platform = PlatformEnum.WEB)
public ModelAndView article(Model model, @PathVariable("articleId") Long articleId) {
Article article = bizArticleService.getByPrimaryKey(articleId);
if (article == null || ArticleStatusEnum.UNPUBLISHED.getCode() == article.getStatusEnum().getCode()) {
return ResultUtil.forward("/error/404");
}
if (article.getPrivate()) {
article.setPassword(null);
article.setContent(null);
article.setContentMd(null);
}
if (article.getRequiredAuth()) {
User sessionUser = SessionUtil.getUser();
if (null != sessionUser) {
article.setRequiredAuth(false);
}
}
model.addAttribute("article", article);
// 上一篇下一篇
model.addAttribute("other", bizArticleService.getPrevAndNextArticles(article.getCreateTime()));
// 相关文章
model.addAttribute("relatedList", bizArticleService.listRelatedArticle(SIDEBAR_ARTICLE_SIZE, article));
model.addAttribute("articleDetail", true);
return ResultUtil.view("article");
}
use of com.zyd.blog.business.annotation.BussinessLog in project OneBlog by zhangyd-c.
the class RestWebSiteController method robots.
@GetMapping(value = "/robots.txt", produces = { "text/plain" })
@BussinessLog(value = "查看robots", platform = PlatformEnum.WEB)
public String robots() {
Template template = templateService.getTemplate(TemplateKeyEnum.TM_ROBOTS);
Map<String, Object> map = new HashMap<>();
map.put("config", configService.getConfigs());
return FreeMarkerUtil.template2String(template.getRefValue(), map, true);
}
use of com.zyd.blog.business.annotation.BussinessLog in project OneBlog by zhangyd-c.
the class RenderController method type.
/**
* 分类列表(分页)
*
* @param typeId
* @param pageNumber
* @param model
* @return
*/
@GetMapping("/type/{typeId}/{pageNumber}")
@BussinessLog(value = "进入文章分类[{1}]列表第{2}页", platform = PlatformEnum.WEB)
public ModelAndView type(@PathVariable("typeId") Long typeId, @PathVariable("pageNumber") Integer pageNumber, Model model) {
ArticleConditionVO vo = new ArticleConditionVO();
vo.setTypeId(typeId);
vo.setPageNumber(pageNumber);
model.addAttribute("url", "type/" + typeId);
loadIndexPage(vo, model);
return ResultUtil.view(INDEX_URL);
}
Aggregations