|
@@ -222,23 +222,31 @@ public class IndexController {
|
|
|
@GetMapping("/${system.site.prefix}/{siteId}/{categoryId}")
|
|
|
public String category(@PathVariable("siteId") Integer siteId,
|
|
|
@PathVariable("categoryId") Long categoryId,
|
|
|
- Model model){
|
|
|
+ Model model, HttpServletRequest request){
|
|
|
log.debug("栏目");
|
|
|
TCmsSite site = siteService.findById(siteId);
|
|
|
if(CmsUtil.isNullOrEmpty(site)) {
|
|
|
throw new CmsException(CmsConst.SITE_NOT_FOUND);
|
|
|
}
|
|
|
TCmsCategory category = categoryService.findById(categoryId);
|
|
|
+ if (request.getSession().getAttribute(LOGIN_USER) == null) {
|
|
|
+ model.addAttribute("showState", false);
|
|
|
+ } else {
|
|
|
+ model.addAttribute("showState", true);
|
|
|
+ }
|
|
|
if(CmsUtil.isNullOrEmpty(category)) {
|
|
|
throw new CmsException(CmsConst.CATEGORY_NOT_FOUND);
|
|
|
}
|
|
|
PageInfo page = contentService.page(1,siteId,category.getCategoryId());
|
|
|
model.addAttribute("title",category.getCategoryName());
|
|
|
+
|
|
|
model.addAttribute("keyword",site.getKeyword());
|
|
|
model.addAttribute("description",site.getDescription());
|
|
|
model.addAttribute("site",site);
|
|
|
model.addAttribute("category",category);
|
|
|
model.addAttribute("page",page);
|
|
|
+
|
|
|
+
|
|
|
if(StrUtil.isBlank(site.getTemplate())) {
|
|
|
return view(category.getIndexTpl());
|
|
|
}
|