|
@@ -2,7 +2,6 @@ package com.sooka.module.web.cms;
|
|
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import com.google.common.collect.Maps;
|
|
|
-import com.sooka.ServletInitializer;
|
|
|
import com.sooka.common.constant.CmsConst;
|
|
|
import com.sooka.common.exception.CmsException;
|
|
|
import com.sooka.common.utils.*;
|
|
@@ -20,7 +19,6 @@ import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.ui.Model;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
-import tk.mybatis.mapper.util.StringUtil;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import java.io.*;
|
|
@@ -174,7 +172,7 @@ public class IndexController {
|
|
|
*/
|
|
|
@GetMapping("/${system.site.prefix}/{siteId}")
|
|
|
public String index(@PathVariable("siteId") Integer siteId,
|
|
|
- Model model,HttpServletRequest request){
|
|
|
+ Model model){
|
|
|
log.debug("通过站点Id访问网站首页[{}]",siteId);
|
|
|
SimpleDateFormat formatYear = new SimpleDateFormat("yyyy");
|
|
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-M-d");
|
|
@@ -207,13 +205,6 @@ public class IndexController {
|
|
|
model.addAttribute("description",site.getDescription());
|
|
|
model.addAttribute("site",site);
|
|
|
model.addAttribute("xwdtList",xwdtList);
|
|
|
- TCmsUser user = (TCmsUser) request.getSession().getAttribute(LOGIN_USER);
|
|
|
- if (user == null) {
|
|
|
- model.addAttribute("btnId", "login");
|
|
|
- } else {
|
|
|
- model.addAttribute("btnId", "exit");
|
|
|
- model.addAttribute("nickname", user.getNickname());
|
|
|
- }
|
|
|
if(StrUtil.isBlank(site.getTemplate())) {
|
|
|
return view(CmsConst.INDEX_TPL);
|
|
|
}
|
|
@@ -224,18 +215,13 @@ public class IndexController {
|
|
|
@GetMapping("/${system.site.prefix}/{siteId}/{categoryId}")
|
|
|
public String category(@PathVariable("siteId") Integer siteId,
|
|
|
@PathVariable("categoryId") Long categoryId,
|
|
|
- Model model, HttpServletRequest request){
|
|
|
+ Model model){
|
|
|
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);
|
|
|
}
|
|
@@ -247,13 +233,6 @@ public class IndexController {
|
|
|
model.addAttribute("site",site);
|
|
|
model.addAttribute("category",category);
|
|
|
model.addAttribute("page",page);
|
|
|
- TCmsUser user = (TCmsUser) request.getSession().getAttribute(LOGIN_USER);
|
|
|
- if (user == null) {
|
|
|
- model.addAttribute("btnId", "login");
|
|
|
- } else {
|
|
|
- model.addAttribute("btnId", "exit");
|
|
|
- model.addAttribute("nickname", user.getNickname());
|
|
|
- }
|
|
|
if(StrUtil.isBlank(site.getTemplate())) {
|
|
|
return view(category.getIndexTpl());
|
|
|
}
|