parent
631574fe81
commit
fd764fdb4e
|
@ -1,16 +1,16 @@
|
|||
/**
|
||||
The MIT License (MIT) * Copyright (c) 2016 铭飞科技(mingsoft.net)
|
||||
|
||||
* The MIT License (MIT) * Copyright (c) 2016 铭飞科技(mingsoft.net)
|
||||
* <p>
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
|
||||
* <p>
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
|
||||
* <p>
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
|
@ -140,7 +140,6 @@ public class GeneraterAction extends BaseAction {
|
|||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 生成列表的静态页面
|
||||
*
|
||||
|
@ -155,46 +154,40 @@ public class GeneraterAction extends BaseAction {
|
|||
public ResultData genernateColumn(HttpServletRequest request, HttpServletResponse response, @PathVariable String categoryId) throws IOException {
|
||||
// 获取站点id
|
||||
AppEntity app = BasicUtil.getApp();
|
||||
|
||||
//栏目列表
|
||||
List<CategoryEntity> columns = new ArrayList<CategoryEntity>();
|
||||
// 如果栏目id小于0则更新所有的栏目,否则只更新选中的栏目
|
||||
if (!"0".equals(categoryId)) {
|
||||
|
||||
if ("0".equals(categoryId)) {// 0更新所有栏目
|
||||
CategoryEntity categoryEntity = new CategoryEntity();
|
||||
columns = categoryBiz.query(categoryEntity);
|
||||
} else { //选择栏目更新
|
||||
CategoryEntity categoryEntity = new CategoryEntity();
|
||||
categoryEntity.setId(categoryId);
|
||||
columns = categoryBiz.queryChilds(categoryEntity);
|
||||
} else {
|
||||
// 获取所有的内容管理栏目
|
||||
CategoryEntity categoryEntity=new CategoryEntity();
|
||||
columns = categoryBiz.query(categoryEntity);
|
||||
}
|
||||
|
||||
//文章列表
|
||||
List<CategoryBean> articleIdList = null;
|
||||
// 1、设置模板文件夹路径
|
||||
|
||||
// 获取栏目列表模版
|
||||
for (CategoryEntity column : columns) {
|
||||
|
||||
ContentBean contentBean = new ContentBean();
|
||||
contentBean.setCategoryId(column.getId());
|
||||
|
||||
// 分类是列表
|
||||
if(column.getCategoryType().equals("1")) {
|
||||
// 判断模板文件是否存在
|
||||
if (!FileUtil.exist(ParserUtil.buildTempletPath(column.getCategoryListUrl()))) {
|
||||
LOG.error("模板不存在:{}", column.getCategoryUrl());
|
||||
continue;
|
||||
}
|
||||
//获取模板中列表标签中的条件
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
if(BasicUtil.getWebsiteApp() != null){
|
||||
map.put(ParserUtil.APP_ID, BasicUtil.getWebsiteApp().getAppId());
|
||||
}
|
||||
PageBean page = new PageBean();
|
||||
map.put(ParserUtil.HTML, ParserUtil.HTML);
|
||||
map.put(ParserUtil.URL, BasicUtil.getUrl());
|
||||
map.put(ParserUtil.PAGE, page);
|
||||
}
|
||||
articleIdList = contentBiz.queryIdsByCategoryIdForParser(contentBean);
|
||||
// 判断列表类型
|
||||
switch (column.getCategoryType()) {
|
||||
//TODO 暂时先用字符串代替
|
||||
case "1": // 列表
|
||||
|
||||
// 判断模板文件是否存在
|
||||
if (!FileUtil.exist(ParserUtil.buildTempletPath(column.getCategoryListUrl()))) {
|
||||
LOG.error("模板不存在:{}", column.getCategoryUrl());
|
||||
continue;
|
||||
}
|
||||
|
||||
CmsParserUtil.generateList(column, articleIdList.size());
|
||||
break;
|
||||
case "2":// 单页
|
||||
|
@ -283,7 +276,6 @@ public class GeneraterAction extends BaseAction {
|
|||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 用户预览主页
|
||||
*
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
/**
|
||||
The MIT License (MIT) * Copyright (c) 2016 铭飞科技(mingsoft.net)
|
||||
|
||||
* The MIT License (MIT) * Copyright (c) 2016 铭飞科技(mingsoft.net)
|
||||
* <p>
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
|
||||
* <p>
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
|
||||
* <p>
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
|
@ -25,6 +25,7 @@ import cn.hutool.core.util.ObjectUtil;
|
|||
import cn.hutool.core.util.PageUtil;
|
||||
import freemarker.core.ParseException;
|
||||
import freemarker.template.MalformedTemplateNameException;
|
||||
import freemarker.template.TemplateException;
|
||||
import freemarker.template.TemplateNotFoundException;
|
||||
import net.bytebuddy.implementation.bytecode.Throw;
|
||||
import net.mingsoft.base.constant.Const;
|
||||
|
@ -89,7 +90,6 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction {
|
|||
private ICategoryBiz categoryBiz;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 搜索标签;
|
||||
*/
|
||||
|
@ -136,6 +136,7 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction {
|
|||
|
||||
/**
|
||||
* 动态列表页
|
||||
*
|
||||
* @param req
|
||||
* @param resp
|
||||
*/
|
||||
|
@ -148,7 +149,7 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction {
|
|||
});
|
||||
//获取栏目编号
|
||||
int typeId = BasicUtil.getInt(ParserUtil.TYPE_ID, 0);
|
||||
int size = BasicUtil.getInt(ParserUtil.SIZE,10);
|
||||
int size = BasicUtil.getInt("size", 10);
|
||||
ContentBean contentBean = new ContentBean();
|
||||
contentBean.setCategoryId(String.valueOf(typeId));
|
||||
//获取文章总数
|
||||
|
@ -159,14 +160,14 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction {
|
|||
}
|
||||
//设置分页类
|
||||
PageBean page = new PageBean();
|
||||
page.setPageNo(BasicUtil.getPageNo());
|
||||
int total = PageUtil.totalPage(columnArticles.size(), size);
|
||||
map.put(ParserUtil.COLUMN, columnArticles.get(0));
|
||||
//获取总数
|
||||
page.setTotal(total);
|
||||
|
||||
//设置栏目编号
|
||||
map.put(ParserUtil.TYPE_ID, typeId);
|
||||
//设置列表当前页
|
||||
map.put(ParserUtil.PAGE_NO, BasicUtil.getInt(ParserUtil.PAGE_NO,1));
|
||||
|
||||
map.put(ParserUtil.URL, BasicUtil.getUrl());
|
||||
map.put(ParserUtil.PAGE, page);
|
||||
|
@ -193,7 +194,6 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction {
|
|||
|
||||
/**
|
||||
* 动态详情页
|
||||
* @param id 文章编号
|
||||
*/
|
||||
@GetMapping("/view.do")
|
||||
@ResponseBody
|
||||
|
@ -295,68 +295,95 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction {
|
|||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 实现前端页面的文章搜索
|
||||
*
|
||||
* @param request
|
||||
* 搜索id
|
||||
* @param request 搜索id
|
||||
* @param response
|
||||
*/
|
||||
@RequestMapping(value = "search")
|
||||
@ResponseBody
|
||||
public String search(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
public String search(HttpServletRequest request, HttpServletResponse response) {
|
||||
//设置分页类
|
||||
PageBean page = new PageBean();
|
||||
page.setSize(ParserUtil.getPageSize(SEARCH + ParserUtil.HTM_SUFFIX,20));
|
||||
|
||||
//参数集合,提供给解析使用
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
// 读取请求字段
|
||||
Map<String, Object> field = BasicUtil.assemblyRequestMap();
|
||||
|
||||
// 自定义字段集合
|
||||
Map<String, String> diyFieldName = new HashMap<String, String>();
|
||||
CategoryEntity column = null; // 当前栏目
|
||||
ModelEntity contentModel = null; // 栏目对应模型
|
||||
List<DiyModelMap> fieldValueList = new ArrayList<DiyModelMap>(); // 栏目对应字段的值
|
||||
|
||||
//记录自定义模型字段名
|
||||
List filedStr = new ArrayList<>();
|
||||
// 栏目对应字段的值
|
||||
List<DiyModelMap> fieldValueList = new ArrayList<DiyModelMap>();
|
||||
|
||||
// 当前栏目
|
||||
CategoryEntity column = null;
|
||||
// 栏目对应模型
|
||||
ModelEntity contentModel = null;
|
||||
|
||||
|
||||
//获取栏目信息
|
||||
int typeId = 0;
|
||||
String categoryIds = BasicUtil.getString("categoryId");
|
||||
//当传递了栏目编号,但不是栏目集合
|
||||
if (!StringUtil.isBlank(categoryIds) && !categoryIds.contains(",")) {
|
||||
typeId = Integer.parseInt(categoryIds);
|
||||
}
|
||||
|
||||
//当前访问的项目地址
|
||||
String url = BasicUtil.getUrl();
|
||||
//记录自定义模型字段名
|
||||
List filedStr = new ArrayList<>();
|
||||
|
||||
|
||||
//根据栏目确定自定义模型
|
||||
if (typeId > 0) {
|
||||
column = (CategoryEntity) categoryBiz.getEntity(Integer.parseInt(typeId+""));
|
||||
column = (CategoryEntity) categoryBiz.getEntity(typeId);
|
||||
// 获取表单类型的id
|
||||
if (column != null && ObjectUtil.isNotNull(column.getMdiyModelId())) {
|
||||
contentModel = (ModelEntity) modelBiz.getEntity(column.getMdiyModelId());
|
||||
if (contentModel != null) {
|
||||
// 保存自定义模型的数据
|
||||
Map<String, String> fieldMap = contentModel.getFieldMap();
|
||||
for (String s : fieldMap.keySet()) {
|
||||
filedStr.add(fieldMap.get(s));
|
||||
}
|
||||
map.put(ParserUtil.TABLE_NAME, contentModel.getModelTableName());
|
||||
// 设置自定义模型表名,方便解析的时候关联表查询
|
||||
params.put(ParserUtil.TABLE_NAME, contentModel.getModelTableName());
|
||||
}
|
||||
}
|
||||
map.put(ParserUtil.COLUMN, column);
|
||||
}
|
||||
|
||||
// 遍历取字段集合
|
||||
// 设置栏目,方便解析的时候关联表查询
|
||||
params.put(ParserUtil.COLUMN, column);
|
||||
}
|
||||
|
||||
// 处理读取请求字段
|
||||
if (field != null) {
|
||||
for (Map.Entry<String, Object> entry : field.entrySet()) {
|
||||
if (entry != null) {
|
||||
//空值不处理
|
||||
if (ObjectUtil.isNull(entry.getValue())) {
|
||||
continue;
|
||||
}
|
||||
String value = entry.getValue().toString().replaceAll("('|\"|\\\\)","\\\\$1"); // 处理由get方法请求中文乱码问题
|
||||
|
||||
// 对值进行安全处理
|
||||
// 处理由get方法请求中文乱码问题
|
||||
String value = entry.getValue().toString().replaceAll("('|\"|\\\\)", "\\\\$1");
|
||||
//Xss过滤
|
||||
value = clearXss(value);
|
||||
if (request.getMethod().equals(RequestMethod.GET)) { // 如果是get方法需要将请求地址参数转码
|
||||
// 如果是get方法需要将请求地址参数转码
|
||||
if (request.getMethod().equals(RequestMethod.GET)) {
|
||||
try {
|
||||
value = new String(value.getBytes("ISO-8859-1"), Const.UTF8);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
// 保存至自定义字段集合
|
||||
if (!StringUtil.isBlank(value)) {
|
||||
diyFieldName.put(entry.getKey(), value);
|
||||
|
@ -376,19 +403,19 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction {
|
|||
|
||||
//添加自定义模型的字段和值
|
||||
if (fieldValueList.size() > 0) {
|
||||
map.put("diyModel", fieldValueList);
|
||||
params.put("diyModel", fieldValueList);
|
||||
}
|
||||
|
||||
//设置分页类
|
||||
PageBean page = new PageBean();
|
||||
|
||||
Map<String, Object> searchMap = field;
|
||||
StringBuilder urlParams = new StringBuilder();
|
||||
|
||||
searchMap.forEach((k, v) -> {
|
||||
//sql注入过滤
|
||||
if (v != null) {
|
||||
searchMap.put(k, v.toString().replaceAll("('|\"|\\\\)", "\\\\$1"));
|
||||
searchMap.put(k, clearXss(searchMap.get(k).toString()));
|
||||
if(!ParserUtil.SIZE.equals(k)&&!ParserUtil.PAGE_NO.equals(k)){
|
||||
if (!"size".equals(k) && !"pageNo".equals(k)) {
|
||||
urlParams.append(k).append("=").append(searchMap.get(k)).append("&");
|
||||
}
|
||||
}
|
||||
|
@ -396,21 +423,25 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction {
|
|||
|
||||
//查询数量
|
||||
int count = contentBiz.getSearchCount(contentModel, fieldValueList, searchMap, BasicUtil.getApp().getAppId(), categoryIds);
|
||||
map.put(ParserUtil.URL, url);
|
||||
map.put(SEARCH, searchMap);
|
||||
page.setRcount(count);
|
||||
params.put(ParserUtil.URL, url);
|
||||
params.put(SEARCH, searchMap);
|
||||
if (BasicUtil.getWebsiteApp() != null) {
|
||||
map.put(ParserUtil.APP_ID, BasicUtil.getWebsiteApp().getAppId());
|
||||
params.put(ParserUtil.APP_ID, BasicUtil.getWebsiteApp().getAppId());
|
||||
}
|
||||
map.put(ParserUtil.PAGE, page);
|
||||
map.put(ParserUtil.HTML, ParserUtil.HTML);
|
||||
params.put(ParserUtil.PAGE, page);
|
||||
params.put(ParserUtil.HTML, ParserUtil.HTML);
|
||||
//动态解析
|
||||
map.put(ParserUtil.IS_DO,false);
|
||||
params.put(ParserUtil.IS_DO, false);
|
||||
//设置动态请求的模块路径
|
||||
map.put(ParserUtil.MODEL_NAME, "mcms");
|
||||
searchMap.put(ParserUtil.PAGE_NO, 0);
|
||||
ParserUtil.read(SEARCH+ParserUtil.HTM_SUFFIX,map, page);
|
||||
params.put(ParserUtil.MODEL_NAME, "mcms");
|
||||
|
||||
searchMap.put("pageNo", 0);
|
||||
// ParserUtil.read(SEARCH + ParserUtil.HTM_SUFFIX, map, page);
|
||||
int total = PageUtil.totalPage(count, page.getSize());
|
||||
int pageNo = BasicUtil.getInt(ParserUtil.PAGE_NO, 1);
|
||||
|
||||
|
||||
int pageNo = BasicUtil.getInt("pageNo", 1);
|
||||
if (pageNo >= total && total != 0) {
|
||||
pageNo = total;
|
||||
}
|
||||
|
@ -421,7 +452,7 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction {
|
|||
|
||||
//设置分页的统一链接
|
||||
url = url + request.getServletPath() + "?" + urlParams;
|
||||
String pageNoStr = ParserUtil.SIZE+"="+page.getSize()+"&"+ParserUtil.PAGE_NO+"=";
|
||||
String pageNoStr = "size=" + page.getSize() + "&pageNo=";
|
||||
//下一页
|
||||
String nextUrl = url + pageNoStr + ((pageNo + 1 > total) ? total : pageNo + 1);
|
||||
//首页
|
||||
|
@ -436,11 +467,23 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction {
|
|||
page.setPreUrl(preUrl);
|
||||
page.setLastUrl(lastUrl);
|
||||
|
||||
params.put(ParserUtil.URL, url);
|
||||
params.put(SEARCH, searchMap);
|
||||
if (BasicUtil.getWebsiteApp() != null) {
|
||||
params.put(ParserUtil.APP_ID, BasicUtil.getWebsiteApp().getAppId());
|
||||
}
|
||||
params.put(ParserUtil.PAGE, page);
|
||||
params.put(ParserUtil.HTML, ParserUtil.HTML);
|
||||
//动态解析
|
||||
params.put(ParserUtil.IS_DO, false);
|
||||
//设置动态请求的模块路径
|
||||
params.put(ParserUtil.MODEL_NAME, "mcms");
|
||||
|
||||
//解析后的内容
|
||||
String content = "";
|
||||
try {
|
||||
//根据模板路径,参数生成
|
||||
content = CmsParserUtil.generate(SEARCH+ParserUtil.HTM_SUFFIX,map);
|
||||
content = CmsParserUtil.generate(SEARCH + ParserUtil.HTM_SUFFIX, params);
|
||||
} catch (TemplateNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (MalformedTemplateNameException e) {
|
||||
|
@ -473,27 +516,39 @@ public class MCmsAction extends net.mingsoft.cms.action.BaseAction {
|
|||
|
||||
/**
|
||||
* 存储自定义模型字段和接口参数
|
||||
*
|
||||
* @author 铭飞开源团队
|
||||
* @date 2019年3月5日
|
||||
*/
|
||||
public class DiyModelMap {
|
||||
class DiyModelMap {
|
||||
String key;
|
||||
Object value;
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public Object getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(Object value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
int [] a= PageUtil.rainbow(20,30,5);
|
||||
for(int _a:a) {
|
||||
System.out.println(_a);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,13 +37,7 @@ public class ContentBean extends ContentEntity {
|
|||
*/
|
||||
private String noflag;
|
||||
|
||||
// public String getStaticUrl() {
|
||||
// return staticUrl;
|
||||
// }
|
||||
//
|
||||
// public void setStaticUrl(String staticUrl) {
|
||||
// this.staticUrl = staticUrl;
|
||||
// }
|
||||
|
||||
|
||||
public String getBeginTime() {
|
||||
return beginTime;
|
||||
|
|
|
@ -229,7 +229,7 @@ public class ContentBizImpl extends BaseBizImpl<IContentDao, ContentEntity> imp
|
|||
if(BasicUtil.getWebsiteApp() !=null){
|
||||
map.put(ParserUtil.APP_ID, BasicUtil.getWebsiteApp().getAppId());
|
||||
}
|
||||
String read = ParserUtil.read(templatePath, map);
|
||||
String read = ParserUtil.rendering(templatePath, map);
|
||||
FileUtil.writeString(read, ParserUtil.buildHtmlPath(targetPath), net.mingsoft.base.constant.Const.UTF8);
|
||||
}
|
||||
|
||||
|
|
|
@ -71,25 +71,36 @@ public class CmsParserUtil extends ParserUtil {
|
|||
throws TemplateNotFoundException, MalformedTemplateNameException, ParseException, IOException {
|
||||
try{
|
||||
// 文章的栏目模型编号
|
||||
Integer columnContentModelId = column.getMdiyModelId();
|
||||
PageBean page = new PageBean();
|
||||
page.setSize(10);
|
||||
//获取分页数量
|
||||
|
||||
//获取列表页显示的文章数量
|
||||
//获取总数
|
||||
//获取列表中的size
|
||||
page.setSize(ParserUtil.getPageSize(column.getCategoryListUrl(),20));
|
||||
page.setRcount(articleIdTotal);
|
||||
|
||||
int totalPageSize = PageUtil.totalPage(articleIdTotal, page.getSize());
|
||||
page.setTotal(totalPageSize);
|
||||
|
||||
//获取模板中列表标签中的条件
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
if (BasicUtil.getWebsiteApp() != null) {
|
||||
map.put(ParserUtil.APP_ID, BasicUtil.getWebsiteApp().getAppId());
|
||||
}
|
||||
|
||||
map.put(ParserUtil.HTML, ParserUtil.HTML);
|
||||
map.put(ParserUtil.URL, BasicUtil.getUrl());
|
||||
map.put(ParserUtil.PAGE, page);
|
||||
|
||||
String columnListPath;
|
||||
ModelEntity contentModel = null;
|
||||
// 判断当前栏目是否有自定义模型
|
||||
if (columnContentModelId != null) {
|
||||
if (column.getMdiyModelId() != null) {
|
||||
// 通过栏目模型编号获取自定义模型实体
|
||||
contentModel = (ModelEntity) SpringUtil.getBean(ModelBizImpl.class).getEntity(columnContentModelId);
|
||||
contentModel = (ModelEntity) SpringUtil.getBean(ModelBizImpl.class).getEntity(column.getMdiyModelId());
|
||||
}
|
||||
int pageNo = 1;
|
||||
|
||||
//全局参数设置
|
||||
Map<String, Object> parserParams = new HashMap<String, Object>();
|
||||
parserParams.put(ParserUtil.PAGE, page);
|
||||
parserParams.put(COLUMN, column);
|
||||
//标签中使用field获取当前栏目
|
||||
parserParams.put(FIELD, column);
|
||||
|
@ -106,17 +117,15 @@ public class CmsParserUtil extends ParserUtil {
|
|||
if(ParserUtil.IS_SINGLE) {
|
||||
parserParams.put(ParserUtil.URL, BasicUtil.getUrl());
|
||||
}
|
||||
parserParams.put(ParserUtil.PAGE, page);
|
||||
ParserUtil.read(File.separator + column.getCategoryListUrl(),parserParams, page);
|
||||
int totalPageSize = PageUtil.totalPage(articleIdTotal, page.getSize());
|
||||
page.setTotal(totalPageSize);
|
||||
|
||||
int pageNo = 1;
|
||||
//文章列表页没有写文章列表标签,总数为0
|
||||
if (totalPageSize <= 0) {
|
||||
// 数据库中第一页是从开始0*size
|
||||
columnListPath = ParserUtil.buildHtmlPath(column.getCategoryPath() + File.separator + ParserUtil.INDEX);
|
||||
// 设置分页的起始位置
|
||||
page.setPageNo(pageNo);
|
||||
String read = ParserUtil.read(File.separator + column.getCategoryListUrl(), parserParams);
|
||||
String read = ParserUtil.rendering(File.separator + column.getCategoryListUrl(), parserParams);
|
||||
FileUtil.writeString(read, columnListPath, Const.UTF8);
|
||||
|
||||
} else {
|
||||
|
@ -134,7 +143,7 @@ public class CmsParserUtil extends ParserUtil {
|
|||
}
|
||||
// 设置分页的起始位置
|
||||
page.setPageNo(pageNo);
|
||||
String read = ParserUtil.read(File.separator + column.getCategoryListUrl(), parserParams);
|
||||
String read = ParserUtil.rendering(File.separator + column.getCategoryListUrl(), parserParams);
|
||||
FileUtil.writeString(read, columnListPath, Const.UTF8);
|
||||
pageNo++;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue