diff --git a/pom.xml b/pom.xml index 0d48e189..093bfbcb 100644 --- a/pom.xml +++ b/pom.xml @@ -51,17 +51,26 @@ UTF-8 - - maven-ali - http://maven.aliyun.com/nexus/content/groups/public/ + sonatype-nexus-snapshots + Sonatype Nexus Snapshots + http://maven.aliyun.com/nexus/content/repositories/central/ true + + false + + + + sonatype + Sonatype Snapshots + https://oss.sonatype.org/content/groups/public/ + + false + true - always - fail diff --git a/src/main/java/net/mingsoft/cms/util/CmsParserUtil.java b/src/main/java/net/mingsoft/cms/util/CmsParserUtil.java index 5501a145..48ade34a 100644 --- a/src/main/java/net/mingsoft/cms/util/CmsParserUtil.java +++ b/src/main/java/net/mingsoft/cms/util/CmsParserUtil.java @@ -92,103 +92,91 @@ public class CmsParserUtil extends ParserUtil { Template mobileTemplate = cfg.getTemplate( BasicUtil.getApp().getAppMobileStyle() + File.separator + column.getCategoryListUrl(), Const.UTF8); // pc端模板 - Template template = cfg.getTemplate(File.separator + column.getCategoryListUrl(), Const.UTF8); + // 文章的栏目模型编号 String columnContentModelId = column.getMdiyModelId(); - StringWriter writer = new StringWriter(); - try { - // 为了分页添加column,判断栏目是否为父栏目 - template.process(null, writer); - String content = writer.toString(); - //获取列表页显示的文章数量 - int pageSize = TagParser.getPageSize(content); - //获取总数 - int totalPageSize = PageUtil.totalPage(articleIdTotal, pageSize); - String columnListPath; - String mobilePath; - ModelEntity contentModel = null; - // 判断当前栏目是否有自定义模型 - if (StringUtils.isNotBlank(columnContentModelId)) { - // 通过栏目模型编号获取自定义模型实体 - contentModel = (ModelEntity) SpringUtil.getBean(ModelBizImpl.class).getEntity(Integer.parseInt(columnContentModelId)); - } - int pageNo = 1; - PageBean page = new PageBean(); - page.setSize(pageSize); - //全局参数设置 - Map parserParams = new HashMap(); - parserParams.put(COLUMN, column); - page.setTotal(totalPageSize); - parserParams.put(IS_DO, false); - parserParams.put(HTML, HTML); - parserParams.put(APP_ID, BasicUtil.getAppId()); - if (contentModel!=null) { - // 将自定义模型编号设置为key值 - parserParams.put(TABLE_NAME, contentModel.getModelTableName()); - } - //如果单站点,就废弃站点地址 - if(ParserUtil.IS_SINGLE) { - parserParams.put(ParserUtil.URL, BasicUtil.getUrl()); + //获取列表页显示的文章数量 + int pageSize = 10; + //获取总数 + int totalPageSize = PageUtil.totalPage(articleIdTotal, pageSize); + + String columnListPath; + String mobilePath; + ModelEntity contentModel = null; + // 判断当前栏目是否有自定义模型 + if (StringUtils.isNotBlank(columnContentModelId)) { + // 通过栏目模型编号获取自定义模型实体 + contentModel = (ModelEntity) SpringUtil.getBean(ModelBizImpl.class).getEntity(Integer.parseInt(columnContentModelId)); + } + int pageNo = 1; + PageBean page = new PageBean(); + page.setSize(pageSize); + //全局参数设置 + Map parserParams = new HashMap(); + parserParams.put(COLUMN, column); + page.setTotal(totalPageSize); + parserParams.put(IS_DO, false); + parserParams.put(HTML, HTML); + parserParams.put(APP_ID, BasicUtil.getAppId()); + if (contentModel!=null) { + // 将自定义模型编号设置为key值 + parserParams.put(TABLE_NAME, contentModel.getModelTableName()); + } + //如果单站点,就废弃站点地址 + if(ParserUtil.IS_SINGLE) { + parserParams.put(ParserUtil.URL, BasicUtil.getUrl()); + } + + //文章列表页没有写文章列表标签,总数为0 + if (totalPageSize <= 0) { + // 数据库中第一页是从开始0*size + // 首页路径index.html + mobilePath = ParserUtil.buildMobileHtmlPath(column.getCategoryPath() + File.separator + ParserUtil.INDEX); + columnListPath = ParserUtil.buildHtmlPath(column.getCategoryPath() + File.separator + ParserUtil.INDEX); + // 设置分页的起始位置 + page.setPageNo(pageNo); + parserParams.put(ParserUtil.PAGE, page); + String read = ParserUtil.read(File.separator + column.getCategoryListUrl(), false, parserParams); + FileUtil.writeString(read, columnListPath, Const.UTF8); + // 判断是手机端生成还是pc端,防止重复生成 + if (ParserUtil.hasMobileFile(column.getCategoryListUrl())) { + parserParams.put(ParserUtil.MOBILE, BasicUtil.getApp().getAppMobileStyle()); + String read1 = ParserUtil.read(File.separator + column.getCategoryListUrl(), true, parserParams); + FileUtil.writeString(read1, mobilePath, Const.UTF8); } - //文章列表页没有写文章列表标签,总数为0 - if (totalPageSize <= 0) { - // 数据库中第一页是从开始0*size - // 首页路径index.html - mobilePath = ParserUtil.buildMobileHtmlPath(column.getCategoryPath() + File.separator + ParserUtil.INDEX); - columnListPath = ParserUtil.buildHtmlPath(column.getCategoryPath() + File.separator + ParserUtil.INDEX); + } else { + // 遍历分页 + for (int i = 0; i < totalPageSize; i++) { + if (i == 0) { + // 数据库中第一页是从开始0*size + // 首页路径index.html + mobilePath = ParserUtil + .buildMobileHtmlPath(column.getCategoryPath() + File.separator + ParserUtil.INDEX); + columnListPath = ParserUtil + .buildHtmlPath(column.getCategoryPath() + File.separator + ParserUtil.INDEX); + } else { + // 其他路径list-2.html + mobilePath = ParserUtil.buildMobileHtmlPath( + column.getCategoryPath() + File.separator + ParserUtil.PAGE_LIST + pageNo); + columnListPath = ParserUtil + .buildHtmlPath(column.getCategoryPath() + File.separator + ParserUtil.PAGE_LIST + pageNo); + } // 设置分页的起始位置 page.setPageNo(pageNo); parserParams.put(ParserUtil.PAGE, page); - TagParser tag = new TagParser(content,parserParams); - FileUtil.writeString(tag.rendering(), columnListPath, Const.UTF8); + String read = ParserUtil.read(File.separator + column.getCategoryListUrl(), false, parserParams); + FileUtil.writeString(read, columnListPath, Const.UTF8); // 判断是手机端生成还是pc端,防止重复生成 if (ParserUtil.hasMobileFile(column.getCategoryListUrl())) { - writer = new StringWriter(); - mobileTemplate.process(null, writer); parserParams.put(ParserUtil.MOBILE, BasicUtil.getApp().getAppMobileStyle()); - tag = new TagParser(writer.toString(), parserParams); + String read1 = ParserUtil.read(File.separator + column.getCategoryListUrl(), true, parserParams); // 将tag.getContent()写入路径 - FileUtil.writeString(tag.rendering(), mobilePath, Const.UTF8); - } - - } else { - // 遍历分页 - for (int i = 0; i < totalPageSize; i++) { - if (i == 0) { - // 数据库中第一页是从开始0*size - // 首页路径index.html - mobilePath = ParserUtil - .buildMobileHtmlPath(column.getCategoryPath() + File.separator + ParserUtil.INDEX); - columnListPath = ParserUtil - .buildHtmlPath(column.getCategoryPath() + File.separator + ParserUtil.INDEX); - } else { - // 其他路径list-2.html - mobilePath = ParserUtil.buildMobileHtmlPath( - column.getCategoryPath() + File.separator + ParserUtil.PAGE_LIST + pageNo); - columnListPath = ParserUtil - .buildHtmlPath(column.getCategoryPath() + File.separator + ParserUtil.PAGE_LIST + pageNo); - } - // 设置分页的起始位置 - page.setPageNo(pageNo); - parserParams.put(ParserUtil.PAGE, page); - TagParser tag = new TagParser(content,parserParams); - FileUtil.writeString(tag.rendering(), columnListPath, Const.UTF8); - // 判断是手机端生成还是pc端,防止重复生成 - if (ParserUtil.hasMobileFile(column.getCategoryListUrl())) { - writer = new StringWriter(); - mobileTemplate.process(null, writer); - parserParams.put(ParserUtil.MOBILE, BasicUtil.getApp().getAppMobileStyle()); - tag = new TagParser(writer.toString(),parserParams); - // 将tag.getContent()写入路径 - FileUtil.writeString(tag.rendering(), mobilePath, Const.UTF8); - } - pageNo++; + FileUtil.writeString(read1, mobilePath, Const.UTF8); } + pageNo++; } - } catch (TemplateException e) { - e.printStackTrace(); } }catch (TemplateNotFoundException e){ e.printStackTrace(); diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index d98e68e3..54042ab5 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -1,7 +1,7 @@ spring: datasource: - url: jdbc:mysql://localhost:3306/db-mcms-open?autoReconnect=true&useUnicode=true&characterEncoding=utf8&useSSL=false&allowMultiQueries=true&serverTimezone=Asia/Shanghai + url: jdbc:mysql://localhost:3306/msopen?autoReconnect=true&useUnicode=true&characterEncoding=utf8&useSSL=false&allowMultiQueries=true&serverTimezone=Asia/Shanghai username: root - password: + password: 123456 filters: wall,mergeStat type: com.alibaba.druid.pool.DruidDataSource diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 3845212d..3d741348 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -9,17 +9,18 @@ logging: file: name: mcms.log #会在项目的根目录下生成对应的mcms.log文件,也可以根据实际情况写绝对路径,例如:d:/mcms.log path: log #会在项目的根目录下生成log目录,里面会生成对应的日期目录,日期目录下面生成日志压缩包备份文件,默认按每10M分割一个日志文件,例如:log/2020-01/app-2020-01-03-18.1.log.gz(表示2020年1月3号下午六点的第一个备份),也可以根据实际情况写绝对路径,例如:d:/log - + ms: swagger: enable: true #启用swagger文档,生产的时候务必关掉 manager: path: /ms #后台访问的路径,如:http://项目/ms/login.do,生成的时候建议修改 view-path: /WEB-INF/manager #后台视图层路径配置 - chcek-code: true #默认开启验证码验证,false验证码不验证 + chcek-code: false #默认开启验证码验证,false验证码不验证 upload: path: upload #文件上传路径,可以根据实际写绝对路径 + template: template #文件上传路径,可以根据实际写绝对路径 mapping: /upload/** #修改需要谨慎,系统第一次部署可以随意修改,如果已经有了上传数据,再次修改会导致之前上传的文件404 denied: .exe,.jsp multipart: diff --git a/src/main/webapp/WEB-INF/manager/cms/generate/index.ftl b/src/main/webapp/WEB-INF/manager/cms/generate/index.ftl new file mode 100644 index 00000000..011e7680 --- /dev/null +++ b/src/main/webapp/WEB-INF/manager/cms/generate/index.ftl @@ -0,0 +1,755 @@ + + + 静态化 + <#include "../../include/head-file.ftl"> + + + +
+
+ + 更新主页,如果系统存在引导页面可以手动修改主页位置文件名,default.html引导页面index.html主页。
+ 更新栏目列表,推荐使用指定栏目更新。系统提示“更新中”请不要刷新页面或点击其他菜单。
+ 根据时间与栏目类型生成文章 +
+
+ +
+
+
+ + + + + +
+
+ + + + + +
+
+ + {{homeLoading?'更新中':'生成主页'}} + 预览主页 + +
+
+
+
+ + + + +
+
+ + + + + +
+
+ + {{articleLoading?'更新中':'生成文章'}} + +
+
+
+
+ + + + +
+ +
+ + {{columnLoading?'更新中':'生成栏目'}} + +
+
+
+
+
+ + + + diff --git a/src/main/webapp/templets/1/default/case-list.htm b/src/main/webapp/templets/1/default/case-list.htm index 7fb73957..09f79eae 100644 --- a/src/main/webapp/templets/1/default/case-list.htm +++ b/src/main/webapp/templets/1/default/case-list.htm @@ -12,27 +12,27 @@
- {ms:arclist size=6 ispaging=true} + <@arclist size=6 ispaging=true>
- +
-
[field.title/]
+
${item.title}

- [field.content/] + ${item.content}

- {/ms:arclist} +
<#include "footer.htm"/> diff --git a/src/main/webapp/templets/1/default/footer.htm b/src/main/webapp/templets/1/default/footer.htm index 127fe43a..66518de0 100644 --- a/src/main/webapp/templets/1/default/footer.htm +++ b/src/main/webapp/templets/1/default/footer.htm @@ -3,7 +3,7 @@ diff --git a/src/main/webapp/templets/1/default/head-file.htm b/src/main/webapp/templets/1/default/head-file.htm index 17de7c90..e0c15834 100644 --- a/src/main/webapp/templets/1/default/head-file.htm +++ b/src/main/webapp/templets/1/default/head-file.htm @@ -1,36 +1,36 @@ -{ms:global.name/} +${global.name} - - - - - - - - - + + + + + + + + + - - - + + + - - + + - - + + - - - - - - - - - + + + + + + + + + \ No newline at end of file diff --git a/src/main/webapp/templets/1/default/head.htm b/src/main/webapp/templets/1/default/head.htm index 273b702d..9437a473 100644 --- a/src/main/webapp/templets/1/default/head.htm +++ b/src/main/webapp/templets/1/default/head.htm @@ -8,10 +8,10 @@
  • 走进铭飞
  • - 案例 + 案例
  • 插件&模板 @@ -35,7 +35,7 @@ -->
  • - 在线留言 + 在线留言
  • 技术支持
      diff --git a/src/main/webapp/templets/1/default/index.htm b/src/main/webapp/templets/1/default/index.htm index 21d38acd..bf9cfd86 100644 --- a/src/main/webapp/templets/1/default/index.htm +++ b/src/main/webapp/templets/1/default/index.htm @@ -2,8 +2,8 @@ <#include "head-file.htm"> - - + + + + <#include "head.htm"> -
      +
      @@ -18,23 +18,23 @@ <#include "menu-left.htm">
      -
      {ms:field.title/}
      +
      ${field.title}
      -
      来源:{ms:field.source/} +
      来源:${field.source} |
      -
      时间:{ms:field.date?string("yyyy-MM-dd")/}
      +
      时间:${field.date?string("yyyy-MM-dd")}
      -
      {ms:field.hit/} +
      ${field.hit} |
      @@ -48,7 +48,7 @@
      -

      {ms:field.content/}


      +

      ${field.content!''}


      上一篇:{ms:pre.title/}

      @@ -68,13 +68,13 @@