diff --git a/README.md b/README.md index 25a5dbf8..7ff78c32 100644 --- a/README.md +++ b/README.md @@ -24,9 +24,12 @@

- 铭飞平台:https://ms.mingsoft.net/
- 演示:http://demo.cms.mingsoft.net/ms/login.do
- 一键运行版本 + 铭飞平台 + 在线演示 + 在线使用手册 + 腾讯课堂在线视频
+ 代码生成器视频教程
+ Windows一键运行版本\Linux一键运行版本

------------------------------------------------------------------------------- diff --git a/doc/db-mcms-5.0.sql b/doc/db-mcms-5.0.sql index dd95cdc1..c93e40a0 100644 --- a/doc/db-mcms-5.0.sql +++ b/doc/db-mcms-5.0.sql @@ -5,13 +5,13 @@ Source Server Type : MySQL Source Server Version : 50725 Source Host : imingsoft.cn:3307 - Source Schema : db-mcms-5.0 + Source Schema : db-mcms-5.0-test Target Server Type : MySQL Target Server Version : 50725 File Encoding : 65001 - Date: 10/01/2020 11:33:43 + Date: 24/03/2020 20:46:19 */ SET NAMES utf8mb4; @@ -66,7 +66,7 @@ CREATE TABLE `cms_category` ( `category_manager_id` int(11) NULL DEFAULT NULL COMMENT '发布用户id', `category_datetime` datetime(0) NULL DEFAULT NULL COMMENT '类别发布时间', `mdiy_model_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '栏目管理的内容模型id', - `category_diy_url` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '自定义链接', + `category_diy_url` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '自定义链接', `category_url` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '内容模板', `category_list_url` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '列表模板', `category_sort` int(11) NULL DEFAULT NULL COMMENT '自定义顺序', @@ -281,6 +281,28 @@ INSERT INTO `cms_history_log` VALUES (3, '0', NULL, '127.0.0.1', '2', 0, NULL, N INSERT INTO `cms_history_log` VALUES (4, '0', NULL, '127.0.0.1', '8', 0, NULL, NULL, NULL, NULL); INSERT INTO `cms_history_log` VALUES (5, '0', NULL, '127.0.0.1', '7', 0, NULL, NULL, NULL, NULL); +-- ---------------------------- +-- Table structure for file +-- ---------------------------- +DROP TABLE IF EXISTS `file`; +CREATE TABLE `file` ( + `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '文件编号', + `category_id` int(11) NULL DEFAULT NULL COMMENT '文件分类编号', + `app_id` int(11) NULL DEFAULT NULL COMMENT 'APP编号', + `file_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '文件名称', + `file_url` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '文件链接', + `file_size` int(11) NULL DEFAULT NULL COMMENT '文件大小', + `file_json` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '文件详情Json数据', + `file_type` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '文件类型:图片、音频、视频等', + `is_child` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '子业务', + `update_date` datetime(0) NULL DEFAULT NULL COMMENT '更新时间', + `update_by` int(11) NULL DEFAULT NULL COMMENT '更新者', + `create_by` int(11) NULL DEFAULT NULL COMMENT '创建者', + `create_date` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `del` int(1) NULL DEFAULT NULL COMMENT '删除标记', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 67 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '基础文件表' ROW_FORMAT = Dynamic; + -- ---------------------------- -- Table structure for manager -- ---------------------------- @@ -477,7 +499,7 @@ CREATE TABLE `mdiy_tag_sql` ( INSERT INTO `mdiy_tag_sql` VALUES (5, 3, '<#assign _typeid=\"\"/>\r\n<#assign _size=\"20\"/>\r\n<#if column?? && column.id?? && column.id?number gt 0>\r\n <#assign _typeid=\"${column.id}\">\r\n\r\n<#if typeid??>\r\n <#assign _typeid=\"${typeid}\">\r\n\r\n<#if size??>\r\n <#assign _size=\"${size}\">\r\n\r\n<#if orderby?? >\r\n <#if orderby==\"date\"> \r\n <#assign _orderby=\"content_datetime\">\r\n <#elseif orderby==\"updatedate\">\r\n <#assign _orderby=\"content_updatetime\">\r\n <#elseif orderby==\"hit\"> \r\n <#assign _orderby=\"content_hit\">\r\n <#elseif orderby==\"sort\">\r\n <#assign _orderby=\"content_sort\">\r\n <#else><#assign _orderby=\"cms_content.id\">\r\n <#else>\r\n <#assign _orderby=\"cms_content.id\">\r\n \r\nSELECT\r\n cms_content.id AS id,\r\n @rownum := @rownum + 1 AS `index`,\r\n LEFT (content_title, ${titlelen ?default(40)}) AS title,\r\n content_title AS fulltitle,\r\n content_author AS author,\r\n content_source AS source,\r\n content_details AS content,\r\n category.category_title AS typename,\r\n category.category_id AS typeid,\r\n ( CASE category.category_img WHEN \'\' THEN category.category_img ELSE CONVERT ( JSON_UNQUOTE( JSON_EXTRACT( category.category_img -> \'$[0]\', \'$.path\' ) ) USING utf8 ) END ) AS typelitpic,\r\n <#--列表页动态链接-->\r\n <#if isDo?? && isDo>\r\n CONCAT(\"/${modelName}/list.do?typeid=\", category.category_id) as typelink,\r\n <#else>\r\n (SELECT \"index.html\") AS typelink,\r\n \r\n ( CASE content_img WHEN \'\' THEN content_img ELSE CONVERT ( JSON_UNQUOTE( JSON_EXTRACT( content_img -> \'$[0]\', \'$.path\' ) ) USING utf8 ) END ) AS litpic,\r\n <#--内容页动态链接-->\r\n <#if isDo?? && isDo>\r\n CONCAT(\"/${modelName}/view.do?id=\", cms_content.id,\"&orderby=${_orderby}\",\"&order=${order!\'ASC\'}\") as link,\r\n <#else>\r\n\r\n CONCAT(category.category_path,\"/\",cms_content.id,\".html\") AS link,\r\n \r\n content_datetime AS date,<#if tableName??>${tableName}.*,\r\n content_description AS descrip,\r\n content_hit AS hit,\r\n content_type AS flag,\r\n category_title AS typetitle,\r\n cms_content.content_keyword AS keyword \r\nFROM\r\n (SELECT @rownum := 0) r,\r\n cms_content\r\n LEFT JOIN cms_category as category ON content_category_id = category.id\r\n <#--判断是否有自定义模型表-->\r\n <#if tableName??>LEFT JOIN ${tableName} ON ${tableName}.link_id=cms_content.id \r\nWHERE \r\n content_display=0 \r\n <#--根据站点编号查询-->\r\n <#if appId?? >\r\n and cms_content.app_id=${appId}\r\n and cms_content.id>0\r\n \r\n <#--判断是否有搜索分类集合-->\r\n <#if search??>\r\n <#if search.categoryIds??>and FIND_IN_SET(category.id,\'${search.categoryIds}\')\r\n <#--标题-->\r\n <#if search.content_title??> and content_title like CONCAT(\"%\",\'${search.content_title}\',\"%\")\r\n <#--作者-->\r\n <#if search.content_author??> and content_author like CONCAT(\"%\",\'${search.content_author}\',\"%\")\r\n <#--来源-->\r\n <#if search.content_source??> and content_source like CONCAT(\"%\",\'${search.content_source}\',\"%\")\r\n <#--属性-->\r\n <#if search.content_type??> and content_type like CONCAT(\"%\",\'${search.content_type}\',\"%\")\r\n <#--描述-->\r\n <#if search.content_description??> and content_description like CONCAT(\"%\",\'${search.content_description}\',\"%\")\r\n <#--关键字-->\r\n <#if search.content_keyword??> and content_keyword like CONCAT(\"%\",\'${search.content_keyword}\',\"%\")\r\n <#--内容-->\r\n <#if search.content_details??> and content_details like CONCAT(\"%\",\'${search.content_details}\',\"%\")\r\n <#--自定义顺序-->\r\n <#if search.content_sort??> and content_sort=${search.content_sort}\r\n <#else><#--查询栏目-->\r\n <#if _typeid?has_content> and (content_category_id=${_typeid} or content_category_id in \r\n (select id FROM cms_category where cms_category.del=0 and find_in_set(${_typeid},CATEGORY_PARENT_ID))) \r\n \r\n <#--标题-->\r\n <#if content_title??> and content_title like CONCAT(\"%\",\'${content_title}\',\"%\")\r\n <#--作者-->\r\n <#if content_author??> and content_author like CONCAT(\"%\",\'${content_author}\',\"%\")\r\n <#--来源-->\r\n <#if content_source??> and content_source like CONCAT(\"%\",\'${content_source}\',\"%\")\r\n <#--属性-->\r\n <#if content_type??> and content_type like CONCAT(\"%\",\'${content_type}\',\"%\")\r\n <#--描述-->\r\n <#if content_description??> and content_description like CONCAT(\"%\",\'${content_description}\',\"%\")\r\n <#--关键字-->\r\n <#if content_keyword??> and content_keyword like CONCAT(\"%\",\'${content_keyword}\',\"%\")\r\n <#--内容-->\r\n <#if content_details??> and content_details like CONCAT(\"%\",\'${content_details}\',\"%\")\r\n <#--自定义顺序-->\r\n <#if content_sort??> and content_sort=${content_sort}\r\n <#--自定义模型-->\r\n <#if diyModel??> \r\n <#list diyModel as dm>\r\n and ${tableName}.${dm.key} like CONCAT(\"%\",\'${dm.value}\',\"%\") \r\n \r\n \r\n <#--文章属性-->\r\n <#if flag?? >\r\n and cms_content.content_type like CONCAT(\'%\',\'${flag}\',\'%\') \r\n \r\n <#if noflag?? >\r\n and cms_content.content_type not like CONCAT(\'%\',\'${noflag}\',\'%\') \r\n \r\n <#--字段排序-->\r\n <#if orderby?? >\r\n ORDER BY \r\n <#if orderby==\"date\"> content_datetime\r\n <#elseif orderby==\"updatedate\"> content_updatetime\r\n <#elseif orderby==\"hit\"> content_hit\r\n <#elseif orderby==\"sort\"> content_sort\r\n <#else>cms_content.id\r\n <#else>\r\n ORDER BY cms_content.id\r\n \r\n <#if order?? >\r\n <#if order==\"desc\"> desc\r\n <#if order==\"asc\"> asc\r\n \r\n LIMIT \r\n <#--判断是否分页-->\r\n <#if ispaging?? && (pageTag.pageNo)??>${((pageTag.pageNo-1)*_size?eval)?c},${_size?default(20)}\r\n <#else>${_size?default(20)}', 1); INSERT INTO `mdiy_tag_sql` VALUES (6, 4, '<#assign _typeid=\"\"/>\r\n<#if column?? && column.id?? && column.id?number gt 0>\r\n <#assign _typeid=\"${column.id}\">\r\n <#assign selfid=\"${column.id}\">\r\n\r\n<#if typeid??>\r\n <#assign _typeid=\"${typeid}\">\r\n\r\nselect \r\n @rownum := @rownum + 1 AS typeindex,\r\n id,\r\n id as typeid,\r\n category_title as typetitle,\r\n <#--返回父id集合-->\r\n category_parent_id as pids,\r\n <#--栏目选中的样式-->\r\n IF(<#if selfid?has_content>${selfid}<#else>${_typeid} = id ,\"${class!\'\'}\",\"\") as class,\r\n <#--动态链接-->\r\n <#if isDo?? && isDo>\r\n CONCAT(\"/${modelName}/list.do?typeid=\", id) as typelink,\r\n <#else>\r\n CONCAT(category_path,\"/index.html\") as typelink,\r\n \r\n category_keyword as typekeyword,\r\n category_diy_url as typeurl,\r\n category_flag as flag,\r\n category_descrip as typedescrip,\r\n ( CASE category_img WHEN \'\' THEN category_img ELSE CONVERT ( JSON_UNQUOTE( JSON_EXTRACT( category_img -> \'$[0]\', \'$.path\' ) ) USING utf8 ) END ) as typelitpic ,\r\n(select count(*) from cms_category c where c.category_id=typeid and c.del=0) as childsize\r\n from (SELECT @rownum := 0) r,cms_category \r\n where \r\n cms_category.del=0 \r\n <#--根据站点编号查询-->\r\n <#if appId?? >\r\n and cms_category.app_id=${appId}\r\n \r\n <#--栏目属性-->\r\n <#if flag?? >\r\n and category_flag like CONCAT(\'%\',\'${flag}\',\'%\') \r\n \r\n <#if noflag?? >\r\n and category_flag not like CONCAT(\'%\',\'${noflag}\',\'%\') \r\n \r\n<#if type?has_content>\r\n <#--顶级栏目(单个)-->\r\n <#if type==\"top\">\r\n and id=(select left(category_parent_id,LOCATE(\",\",category_parent_id)-1) from cms_category where category_id = ${_typeid})\r\n <#elseif type==\"nav\">\r\n and(category_id=0 or category_id is null)\r\n <#--同级栏目(多个)-->\r\n <#elseif type==\"level\">\r\n and\r\n <#if _typeid?has_content>\r\n category_id=(select category_id from cms_category where id=${_typeid})\r\n <#else>\r\n 1=1\r\n \r\n <#--当前栏目(单个)-->\r\n <#elseif type==\"self\">\r\n and \r\n <#if _typeid?has_content>\r\n id=${_typeid}\r\n <#else>\r\n 1=1\r\n \r\n <#--当前栏目的所属栏目(多个)-->\r\n <#elseif type==\"path\">\r\n and \r\n <#if _typeid?has_content>\r\n id in (<#if column?? && column.categoryParentId??>${column.categoryParentId},${_typeid})\r\n <#else>\r\n 1=1\r\n \r\n <#--子栏目(多个)-->\r\n <#elseif type==\"son\">\r\n and \r\n <#if _typeid?has_content>\r\n category_id=${_typeid}\r\n <#else>\r\n 1=1\r\n \r\n <#--上一级栏目没有则取当前栏目(单个)-->\r\n <#elseif type==\"parent\">\r\n and \r\n <#if _typeid?has_content>\r\n <#if column?? && column.categoryId??>\r\n id=${column.categoryId}\r\n <#else>\r\n id=${_typeid}\r\n \r\n <#else>\r\n 1=1\r\n \r\n <#--子栏目或同级栏目(多个)-->\r\n <#elseif type==\"sonOrLevel\">\r\n and \r\n <#if _typeid?has_content>\r\n category_id= if((SELECT count(*) FROM cms_category\r\n WHERE id=${_typeid})>0,${_typeid},(select id from cms_category where id=${_typeid}))\r\n <#else>\r\n 1=1\r\n \r\n \r\n<#else> <#--默认son-->\r\n and\r\n <#if _typeid?has_content>\r\n category_id=${_typeid}\r\n <#else>\r\n (category_id=0 or category_id is null)\r\n \r\n\r\n<#--字段排序-->\r\n <#if orderby?? >\r\n ORDER BY \r\n <#if orderby==\"date\"> category_datetime\r\n <#elseif orderby==\"sort\"> category_sort\r\n <#else>cms_content.id\r\n <#else>\r\n ORDER BY id\r\n \r\n <#if order?? >\r\n <#if order==\"desc\"> desc\r\n <#if order==\"asc\"> asc\r\n ', 1); INSERT INTO `mdiy_tag_sql` VALUES (7, 5, 'select \r\nAPP_NAME as name,\r\napp_logo as logo,\r\napp_keyword as keyword,\r\napp_description as descrip,\r\napp_copyright as copyright,\r\n<#--动态解析 -->\r\n<#if isDo?? && isDo>\r\n\"${url}\" as url,\r\n\"${url}\" as host,\r\n<#--使用地址栏的域名 -->\r\n<#elseif url??>\r\nCONCAT(\"${url}\",\"/${html}/\",app_id,\"/<#if m??>${m}\") as url,\r\n\"${url}\" as host,\r\n<#else>\r\nCONCAT(REPLACE(REPLACE(TRIM(substring_index(app_url,\"\\n\",1)), CHAR(10),\'\'), CHAR(13),\'\'),\"/html/\",app_id,\"/<#if m??>${m}\") as url,\r\nREPLACE(REPLACE(TRIM(substring_index(app_url,\"\\n\",1)), CHAR(10),\'\'), CHAR(13),\'\') as host,\r\n\r\nCONCAT(\"templets/\",app_id,\"/\",<#if m??>CONCAT(app_style,\"/${m}\")<#else>app_style) as style <#-- 判断是否为手机端 -->\r\nfrom app where app_id = ${appId} limit 1', 1); -INSERT INTO `mdiy_tag_sql` VALUES (8, 7, 'SELECT \r\ncms_content.id as id,\r\nleft(content_title,${titlelen?default(40)}) as title,\r\ncontent_title as fulltitle,\r\ncontent_author as author, \r\ncontent_source as source, \r\ncontent_details as content,\r\ncategory_title as typetitle,\r\ncms_category.id as typeid,\r\ncategory_img AS typelitpic,\r\n<#--动态链接-->\r\n<#if isDo?? && isDo>\r\nCONCAT(\"/${modelName}/list.do?typeid=\", category.id) as typelink,\r\n<#else>\r\n(SELECT \"index.html\") as typelink,\r\n\r\ncontent_img as litpic,\r\n<#--内容页动态链接-->\r\n<#if isDo?? && isDo>\r\nCONCAT(\"/mcms/view.do?id=\", cms_content.id) as link,\r\n<#else>\r\ncontent_url AS link,\r\n\r\ncontent_datetime as date,\r\ncontent_description as descrip,\r\nCONCAT(\"\") as hit,\r\ncontent_type as flag,\r\ncategory_title as typetitle,\r\n<#if tableName??>${tableName}.*,\r\ncontent_keyword as keyword\r\nFROM cms_content\r\nLEFT JOIN cms_category ON content_category_id=cms_category.id \r\n<#--判断是否有自定义模型表-->\r\n<#if tableName??>left join ${tableName} on ${tableName}.link_id=cms_content.id\r\nWHERE \r\n1=1\r\n<#if id??> and cms_content.id=${id}', 1); +INSERT INTO `mdiy_tag_sql` VALUES (8, 7, 'SELECT \r\ncms_content.id as id,\r\nleft(content_title,${titlelen?default(40)}) as title,\r\ncontent_title as fulltitle,\r\ncontent_author as author, \r\ncontent_source as source, \r\ncontent_details as content,\r\ncategory_title as typetitle,\r\ncms_category.id as typeid,\r\n ( CASE cms_category.category_img WHEN \'\' THEN cms_category.category_img ELSE CONVERT ( JSON_UNQUOTE( JSON_EXTRACT( cms_category.category_img -> \'$[0]\', \'$.path\' ) ) USING utf8 ) END ) AS typelitpic,\r\n<#--动态链接-->\r\n<#if isDo?? && isDo>\r\nCONCAT(\"/${modelName}/list.do?typeid=\", category.id) as typelink,\r\n<#else>\r\n(SELECT \"index.html\") as typelink,\r\n\r\n( CASE cms_content.content_img WHEN \'\' THEN cms_content.content_img ELSE CONVERT ( JSON_UNQUOTE( JSON_EXTRACT( cms_content.content_img -> \'$[0]\', \'$.path\' ) ) USING utf8 ) END ) AS litpic,\r\n<#--内容页动态链接-->\r\n<#if isDo?? && isDo>\r\nCONCAT(\"/mcms/view.do?id=\", cms_content.id) as link,\r\n<#else>\r\ncontent_url AS link,\r\n\r\ncontent_datetime as date,\r\ncontent_description as descrip,\r\nCONCAT(\"\") as hit,\r\ncontent_type as flag,\r\ncategory_title as typetitle,\r\n<#if tableName??>${tableName}.*,\r\ncontent_keyword as keyword\r\nFROM cms_content\r\nLEFT JOIN cms_category ON content_category_id=cms_category.id \r\n<#--判断是否有自定义模型表-->\r\n<#if tableName??>left join ${tableName} on ${tableName}.link_id=cms_content.id\r\nWHERE \r\n1=1\r\n<#if id??> and cms_content.id=${id}', 1); INSERT INTO `mdiy_tag_sql` VALUES (9, 8, '<#assign select=\"(SELECT \'\')\"/>\r\n<#if orderby?? >\r\n <#if orderby==\"date\"> \r\n <#assign _orderby=\"content_datetime\">\r\n <#elseif orderby==\"updatedate\">\r\n <#assign _orderby=\"content_updatetime\">\r\n <#elseif orderby==\"hit\"> \r\n <#assign _orderby=\"content_hit\">\r\n <#elseif orderby==\"sort\">\r\n <#assign _orderby=\"content_sort\">\r\n <#else><#assign _orderby=\"cms_content.id\">\r\n <#else>\r\n <#assign _orderby=\"cms_content.id\">\r\n \r\n<#if (pageTag.preId) gt 0>\r\nSELECT \r\ncms_content.id as id,\r\nleft(content_title,${titlelen?default(40)}) as title,\r\ncontent_title as fulltitle,\r\ncontent_author as author, \r\ncontent_source as source, \r\ncontent_details as content,\r\ncategory.category_title as typename,\r\ncategory.category_id as typeid,\r\n(SELECT \"index.html\") as typelink,\r\ncontent_img as litpic,\r\n<#--内容页动态链接-->\r\n <#if isDo?? && isDo>\r\n CONCAT(\"/${modelName}/view.do?id=\", cms_content.id,\"&orderby=${_orderby}\",\"&order=${order!\'ASC\'}\") as link,\r\n <#else>\r\n CONCAT(category_path,\"/\",cms_content.id,\".html\") AS link,\r\n \r\ncontent_datetime as date,\r\ncontent_description as descrip,\r\ncontent_hit as hit,\r\ncontent_type as flag,\r\ncontent_keyword as keyword \r\nFROM cms_content \r\nLEFT JOIN cms_category as category ON content_category_id=category.id \r\nWHERE cms_content.id=${pageTag.preId}\r\n<#else>\r\nSELECT \r\n${select} as id,\r\n${select} as title,\r\n${select} as fulltitle,\r\n${select} as author, \r\n${select} as source, \r\n${select} as content,\r\n${select} as typename,\r\n${select} as typeid,\r\n${select} as typelink,\r\n${select} as litpic,\r\n${select} as link,\r\n${select} as date,\r\n${select} as descrip,\r\n${select} as hit,\r\n${select} as flag,\r\n${select} as keyword FROM cms_content\r\n', NULL); INSERT INTO `mdiy_tag_sql` VALUES (10, 9, ' select\r\n <#if !(pageTag.indexUrl??)>\r\n <#--判断是否有栏目对象,用于搜索不传栏目-->\r\n <#if column??>\r\n <#assign path=column.categoryPath/>\r\n <#else>\r\n <#assign path=\"\"/>\r\n \r\n <#--总记录数、总页数-->\r\n (SELECT ${pageTag.total}) as total,\r\n <#--记录总数-->\r\n (SELECT ${pageTag.size}) as rcount,\r\n <#--当前页码-->\r\n (SELECT ${pageTag.pageNo}) as cur,\r\n <#--首页-->\r\n CONCAT(\"${path}\", \"/index.html\") as `index`,\r\n <#--上一页-->\r\n <#if (pageTag.pageNo?eval-1) gt 1>\r\n CONCAT(\"${path}\",\"/list-${pageTag.pageNo?eval-1}.html\") as pre,\r\n <#else>\r\n CONCAT(\"${path}\",\"/index.html\") as pre,\r\n \r\n <#--下一页-->\r\n <#if pageTag.total==1>\r\n CONCAT(\"${path}\", \"/index.html\") as `next`,\r\n CONCAT(\"${path}\", \"/index.html\") as `last`\r\n <#else>\r\n <#if pageTag.pageNo?eval gte pageTag.total>\r\n CONCAT(\"${path}\",\"/list-${pageTag.total}.html\") as next,\r\n <#else>\r\n CONCAT(\"${path}\",\"/list-${pageTag.pageNo?eval+1}.html\") as next,\r\n \r\n <#--最后一页-->\r\n CONCAT(\"${path}\",\"/list-${pageTag.total}.html\") as last\r\n \r\n<#else><#--判断是否是搜索页面-->\r\n \"${pageTag.indexUrl}\" as `index`,\"${pageTag.lastUrl}\" as `last`,\"${pageTag.preUrl}\" as `pre`,\"${pageTag.nextUrl}\" as `next`,\'${pageTag.total}\' as total,\'${pageTag.size}\' as rcount,\'${pageTag.pageNo}\' as cur\r\n', NULL); INSERT INTO `mdiy_tag_sql` VALUES (11, 10, '<#assign select=\"(SELECT \'\')\"/>\r\n<#if orderby?? >\r\n <#if orderby==\"date\"> \r\n <#assign _orderby=\"content_datetime\">\r\n <#elseif orderby==\"updatedate\">\r\n <#assign _orderby=\"content_updatetime\">\r\n <#elseif orderby==\"hit\"> \r\n <#assign _orderby=\"content_hit\">\r\n <#elseif orderby==\"sort\">\r\n <#assign _orderby=\"content_sort\">\r\n <#else><#assign _orderby=\"cms_content.id\">\r\n <#else>\r\n <#assign _orderby=\"cms_content.id\">\r\n \r\n<#if (pageTag.nextId) gt 0>\r\nSELECT \r\ncms_content.id as id,\r\nleft(content_title,${titlelen?default(40)}) as title,\r\ncontent_title as fulltitle,\r\ncontent_author as author, \r\ncontent_source as source, \r\ncontent_details as content,\r\ncategory.category_title as typename,\r\ncategory.category_id as typeid,\r\n(SELECT \"index.html\") as typelink,\r\ncontent_img as litpic,\r\n<#--内容页动态链接-->\r\n <#if isDo?? && isDo>\r\n CONCAT(\"/${modelName}/view.do?id=\", cms_content.id,\"&orderby=${_orderby}\",\"&order=${order!\'ASC\'}\") as link,\r\n <#else>\r\n CONCAT(category_path,\"/\",cms_content.id,\".html\") AS link,\r\n \r\ncontent_datetime as date,\r\ncontent_description as descrip,\r\ncontent_hit as hit,\r\ncontent_type as flag,\r\ncontent_keyword as keyword \r\nFROM cms_content \r\nLEFT JOIN cms_category as category ON content_category_id=category.id \r\nWHERE cms_content.id=${pageTag.nextId}\r\n<#else>\r\nSELECT \r\n${select} as id,\r\n${select} as title,\r\n${select} as fulltitle,\r\n${select} as author, \r\n${select} as source, \r\n${select} as content,\r\n${select} as typename,\r\n${select} as typeid,\r\n${select} as typelink,\r\n${select} as litpic,\r\n${select} as link,\r\n${select} as date,\r\n${select} as descrip,\r\n${select} as hit,\r\n${select} as flag,\r\n${select} as keyword FROM cms_content\r\n', NULL); @@ -535,7 +557,7 @@ INSERT INTO `model` VALUES (265, '自定义页面', '20010000', 264, 'mdiy/page/ INSERT INTO `model` VALUES (266, '修改', '20010004', 269, 'mdiy:form:update', '2018-09-06 09:38:51', NULL, 0, 0, 0, '264,269', NULL); INSERT INTO `model` VALUES (267, '新增', '20010002', 269, 'mdiy:form:save', '2018-09-06 09:38:51', NULL, 0, 0, 0, '264,269', NULL); INSERT INTO `model` VALUES (268, '查看', '20010001', 269, 'mdiy:form:view', '2018-09-06 09:38:51', NULL, 0, 0, 0, '264,269', NULL); -INSERT INTO `model` VALUES (269, '自定义表单', '20020000', 264, 'mdiy/form/index.do', '2018-09-06 09:38:51', NULL, 0, 0, 1, '264', NULL); +INSERT INTO `model` VALUES (269, '自定义表单', '20020000', 264, 'mdiy/post/index.do', '2018-09-06 09:38:51', NULL, 0, 0, 1, '264', NULL); INSERT INTO `model` VALUES (280, '自定义字典', '20050000', 264, 'mdiy/dict/index.do', '2018-09-06 09:38:53', NULL, 0, 0, 1, '264', NULL); INSERT INTO `model` VALUES (281, '删除', '20050003', 280, 'mdiy:dict:del', '2018-09-06 09:38:53', NULL, 0, 0, 0, '264,280', NULL); INSERT INTO `model` VALUES (282, '修改', '20050004', 280, 'mdiy:dict:update', '2018-09-06 09:38:53', NULL, 0, 0, 0, '264,280', NULL); diff --git a/src/main/java/net/mingsoft/cms/action/CategoryAction.java b/src/main/java/net/mingsoft/cms/action/CategoryAction.java index 5d2a5f34..c56c7122 100644 --- a/src/main/java/net/mingsoft/cms/action/CategoryAction.java +++ b/src/main/java/net/mingsoft/cms/action/CategoryAction.java @@ -99,6 +99,7 @@ public class CategoryAction extends BaseAction{ BaseEntity categoryEntity = categoryBiz.getEntity(Integer.parseInt(category.getId())); model.addAttribute("categoryEntity",categoryEntity); } + model.addAttribute("appId",BasicUtil.getAppId()); return "/cms/category/form"; } diff --git a/src/main/java/net/mingsoft/cms/action/ContentAction.java b/src/main/java/net/mingsoft/cms/action/ContentAction.java index ddab9a5c..d2818ebb 100644 --- a/src/main/java/net/mingsoft/cms/action/ContentAction.java +++ b/src/main/java/net/mingsoft/cms/action/ContentAction.java @@ -102,6 +102,7 @@ public class ContentAction extends BaseAction{ BaseEntity contentEntity = contentBiz.getEntity(Integer.parseInt(content.getId())); model.addAttribute("contentEntity",contentEntity); } + model.addAttribute("appId",BasicUtil.getAppId()); return "/cms/content/form"; } diff --git a/src/main/java/net/mingsoft/cms/action/GeneraterAction.java b/src/main/java/net/mingsoft/cms/action/GeneraterAction.java index b02df132..ab64edd6 100644 --- a/src/main/java/net/mingsoft/cms/action/GeneraterAction.java +++ b/src/main/java/net/mingsoft/cms/action/GeneraterAction.java @@ -24,7 +24,6 @@ package net.mingsoft.cms.action; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.copier.CopyOptions; import cn.hutool.core.io.FileUtil; -import net.mingsoft.basic.action.BaseAction; import net.mingsoft.basic.biz.IModelBiz; import net.mingsoft.basic.entity.AppEntity; import net.mingsoft.basic.util.BasicUtil; @@ -52,12 +51,12 @@ import java.util.ArrayList; import java.util.List; /** - * + * * @ClassName: GeneraterAction * @Description:TODO 生成器 * @author: 铭飞开发团队 * @date: 2018年1月31日 下午2:52:07 - * + * * @Copyright: 2018 www.mingsoft.net Inc. All rights reserved. */ @Controller("cmsGenerater") @@ -92,7 +91,7 @@ public class GeneraterAction extends BaseAction { /** * 更新主页 - * + * * @return */ @RequestMapping("/index") @@ -102,7 +101,7 @@ public class GeneraterAction extends BaseAction { /** * 生成主页 - * + * * @param request * @param response */ @@ -114,7 +113,7 @@ public class GeneraterAction extends BaseAction { String tmpFileName = request.getParameter("url"); // 生成后的文件名称 String generateFileName = request.getParameter("position"); - + // 获取文件所在路径 首先判断用户输入的模版文件是否存在 if (!FileUtil.exist(ParserUtil.buildTempletPath())) { this.outJson(response, false, getResString("templet.file")); @@ -128,12 +127,12 @@ public class GeneraterAction extends BaseAction { } } } - + /** * 生成列表的静态页面 - * + * * @param request * @param response * @param CategoryId @@ -194,7 +193,7 @@ public class GeneraterAction extends BaseAction { /** * 根据栏目id更新所有的文章 - * + * * @param request * @param response * @param columnId @@ -219,12 +218,12 @@ public class GeneraterAction extends BaseAction { this.outJson(response, false); } } - + /** * 用户预览主页 - * + * * @param request * @return */ @@ -236,4 +235,4 @@ public class GeneraterAction extends BaseAction { + File.separator + position + ParserUtil.HTML_SUFFIX; return "redirect:" + indexPosition; } -} \ No newline at end of file +} diff --git a/src/main/java/net/mingsoft/cms/resources/resources.properties b/src/main/java/net/mingsoft/cms/resources/resources.properties index 61730331..4bf15c7b 100644 --- a/src/main/java/net/mingsoft/cms/resources/resources.properties +++ b/src/main/java/net/mingsoft/cms/resources/resources.properties @@ -33,3 +33,4 @@ category.id=\u6240\u5C5E\u680F\u76EE content.sort=\u81EA\u5B9A\u4E49\u987A\u5E8F category.diy.url=\u81EA\u5B9A\u4E49\u94FE\u63A5 content.keyword=\u5173\u952E\u5B57 +templet.file=\u672A\u627E\u5230\u6A21\u677F\u6587\u4EF6 diff --git a/src/main/java/net/mingsoft/cms/resources/resources_zh_CN.properties b/src/main/java/net/mingsoft/cms/resources/resources_zh_CN.properties index 61730331..4bf15c7b 100644 --- a/src/main/java/net/mingsoft/cms/resources/resources_zh_CN.properties +++ b/src/main/java/net/mingsoft/cms/resources/resources_zh_CN.properties @@ -33,3 +33,4 @@ category.id=\u6240\u5C5E\u680F\u76EE content.sort=\u81EA\u5B9A\u4E49\u987A\u5E8F category.diy.url=\u81EA\u5B9A\u4E49\u94FE\u63A5 content.keyword=\u5173\u952E\u5B57 +templet.file=\u672A\u627E\u5230\u6A21\u677F\u6587\u4EF6 diff --git a/src/main/java/net/mingsoft/config/ShiroConfig.java b/src/main/java/net/mingsoft/config/ShiroConfig.java index 3442d52d..a580427d 100644 --- a/src/main/java/net/mingsoft/config/ShiroConfig.java +++ b/src/main/java/net/mingsoft/config/ShiroConfig.java @@ -1,8 +1,6 @@ package net.mingsoft.config; -import java.util.LinkedHashMap; -import java.util.Map; - +import net.mingsoft.basic.security.BaseAuthRealm; import org.apache.shiro.mgt.SecurityManager; import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor; import org.apache.shiro.spring.web.ShiroFilterFactoryBean; @@ -11,9 +9,9 @@ import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreato import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.PropertySource; -import net.mingsoft.basic.security.BaseAuthRealm; +import java.util.LinkedHashMap; +import java.util.Map; @Configuration public class ShiroConfig { @@ -21,6 +19,29 @@ public class ShiroConfig { @Value("${ms.manager.path}") private String managerPath; + /** + * 开启Shiro的注解(如@RequiresRoles , @RequiresPermissions),需借助SspringAOP扫描使用Sshiro注解的类,并在必要时进行安全逻辑验证 + * 配置以下两个bean(Defaul tAdvisorAutoProxyCreator和uthorizat ionAttributeSourceAdvisor)即可实现此功能 + */ + @Bean + public DefaultAdvisorAutoProxyCreator advisorAutoProxyCreator(){ + DefaultAdvisorAutoProxyCreator advisorAutoProxyCreator = new DefaultAdvisorAutoProxyCreator(); + advisorAutoProxyCreator.setProxyTargetClass(true); + return advisorAutoProxyCreator; + } + + /** + * 开启shiro aop注解支持 + * 使用代理方式;所以需要开启代码支持 + * @param securityManager + */ + @Bean + public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor(SecurityManager securityManager){ + AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor = new AuthorizationAttributeSourceAdvisor(); + authorizationAttributeSourceAdvisor.setSecurityManager(securityManager); + return authorizationAttributeSourceAdvisor; + } + @Bean public AuthorizationAttributeSourceAdvisor getAuthorizationAttributeSourceAdvisor( DefaultWebSecurityManager securityManager) { diff --git a/src/main/webapp/WEB-INF/manager/cms/category/form.ftl b/src/main/webapp/WEB-INF/manager/cms/category/form.ftl index beed697d..a7c26d55 100644 --- a/src/main/webapp/WEB-INF/manager/cms/category/form.ftl +++ b/src/main/webapp/WEB-INF/manager/cms/category/form.ftl @@ -200,7 +200,7 @@ :limit="1" :on-exceed="categoryImghandleExceed" :disabled="false" - :data="{uploadPath:'/cms/category','isRename':true,'appId':true}" + :data="{uploadPath:'/${appId}/cms/category','isRename':true}" :on-success="categoryImgSuccess" accept="image/*" list-type="picture-card"> @@ -232,12 +232,12 @@ \ No newline at end of file + created: function () { + /* this.categoryListUrlOptionsGet(); + this.categoryUrlOptionsGet();*/ + this.list(); + } + }); + diff --git a/src/main/webapp/WEB-INF/manager/cms/content/form.ftl b/src/main/webapp/WEB-INF/manager/cms/content/form.ftl index 91f2d108..083d6b59 100644 --- a/src/main/webapp/WEB-INF/manager/cms/content/form.ftl +++ b/src/main/webapp/WEB-INF/manager/cms/content/form.ftl @@ -184,7 +184,7 @@ :limit="1" :on-exceed="contentImghandleExceed" :disabled="false" - :data="{uploadPath:'/cms/content','isRename':true,'appId':true}" + :data="{uploadPath:'/${appId}/cms/content','isRename':true}" :on-success="contentImgSuccess" accept="image/*" list-type="picture-card"> @@ -247,12 +247,16 @@ \ No newline at end of file + diff --git a/src/main/webapp/WEB-INF/manager/cms/generate/index.ftl b/src/main/webapp/WEB-INF/manager/cms/generate/index.ftl index 45257583..f5b291f0 100644 --- a/src/main/webapp/WEB-INF/manager/cms/generate/index.ftl +++ b/src/main/webapp/WEB-INF/manager/cms/generate/index.ftl @@ -119,113 +119,163 @@ \ No newline at end of file + diff --git a/src/main/webapp/WEB-INF/manager/main.ftl b/src/main/webapp/WEB-INF/manager/main.ftl index a6a6cf0b..39631f2c 100644 --- a/src/main/webapp/WEB-INF/manager/main.ftl +++ b/src/main/webapp/WEB-INF/manager/main.ftl @@ -427,92 +427,115 @@ \ No newline at end of file + diff --git a/src/main/webapp/static/plugins/ms/1.0.0/compatible.js b/src/main/webapp/static/plugins/ms/1.0.0/compatible.js index 28e6a06d..213b6af3 100644 --- a/src/main/webapp/static/plugins/ms/1.0.0/compatible.js +++ b/src/main/webapp/static/plugins/ms/1.0.0/compatible.js @@ -1,3 +1,6 @@ +//ie的兼容 + +//Object.assign 对ie对支持 if (typeof Object.assign != 'function') { Object.assign = function(target) { 'use strict'; @@ -17,4 +20,4 @@ if (typeof Object.assign != 'function') { } return target; }; -} +} \ No newline at end of file diff --git a/src/main/webapp/static/plugins/ms/1.0.0/ms.http.js b/src/main/webapp/static/plugins/ms/1.0.0/ms.http.js index 1bd75cad..3faa6c65 100644 --- a/src/main/webapp/static/plugins/ms/1.0.0/ms.http.js +++ b/src/main/webapp/static/plugins/ms/1.0.0/ms.http.js @@ -9,6 +9,8 @@ function(config) { config.headers = { 'Content-Type': 'application/x-www-form-urlencoded', + 'Cache-Control': 'no-cache', + 'Pragma': 'no-cache', 'X-Requested-With': 'XMLHttpRequest' } if (config.method === 'post' && config.headers["Content-Type"] === "application/x-www-form-urlencoded") { @@ -171,4 +173,4 @@ } window.ms.http = http; window.ms.isLoginRedirect = true; -}()); \ No newline at end of file +}()); diff --git a/src/main/webapp/static/plugins/ms/1.0.0/ms.util.js b/src/main/webapp/static/plugins/ms/1.0.0/ms.util.js index 8edfbf23..137ac3cb 100644 --- a/src/main/webapp/static/plugins/ms/1.0.0/ms.util.js +++ b/src/main/webapp/static/plugins/ms/1.0.0/ms.util.js @@ -1,5 +1,5 @@ /** - * 通用工具类 + * 通用工具类 */ (function() { @@ -20,23 +20,38 @@ log(e.message); } } - //树形数据组织 - function treeData (source, id, parentId, children) { - let cloneData = JSON.parse(JSON.stringify(source)) - return cloneData.filter(father => { - let branchArr = cloneData.filter(child => father[id] == child[parentId]); - branchArr.length > 0 ? father[children] = branchArr : '' - return !father[parentId]||father[parentId]=='0' // 如果第一层不是parentId=0,请自行修改 - }) + + /** + * 列表数据转化为树形结构的列表 + * @param source 数据源list + * @param id 编号 + * @param parentId 父级编号 + * @param children 树形子集变量 + * @returns {*} + * 支持父级编号为 0或null + * 原始数据[{id:1,titile:"标题",pid:0},{id:2,titile:"标题",pid:1}] + * 转化树形数据:[{id:1,titile:"标题",pid:0,children:[{id:2,titile:"标题",pid:1}]}] + */ + function treeData(source, id, parentId, children) { + var cloneData = JSON.parse(JSON.stringify(source)); + return cloneData.filter(function (father) { + var branchArr = cloneData.filter(function (child) { + return father[id] == child[parentId]; + }); + branchArr.length > 0 ? father[children] = branchArr : ''; + return !father[parentId] || father[parentId] == '0' || father[parentId] == null ; + }); } //验证是否为子集 - function childValidate (sourceList,id,parentId,key,parentKey){ - var data=sourceList.find(x=>x[key]==parentId); - if(data&&data[parentKey]!='0'&&data[parentKey]){ - if(id==data[parentKey]){ - return false + function childValidate(sourceList, id, parentId, key, parentKey) { + var data = sourceList.find(function (x) { + return x[key] == parentId; + }); + if (data && data[parentKey] != '0' && data[parentKey]) { + if (id == data[parentKey]) { + return false; } - return childValidate(sourceList,id,data[parentKey],key,parentKey) + return childValidate(sourceList, id, data[parentKey], key, parentKey); } return true; } @@ -44,20 +59,19 @@ //日期处理 var date = { //格式化时间 - fmt: function(date, fmt) { - var date = new Date(date); - log(fmt); + fmt: function(de, fmt) { + var date = new Date(typeof de == "string"?de.replace(/-/g, "/"):de); if (!fmt) { fmt = "yyyy-mm-dd"; } var o = { - "M+": date.getMonth() + 1, //月份 - "d+": date.getDate(), //日 - "h+": date.getHours(), //小时 - "m+": date.getMinutes(), //分 - "s+": date.getSeconds(), //秒 - "q+": Math.floor((date.getMonth() + 3) / 3), //季度 - "S": date.getMilliseconds() //毫秒 + "M+": date.getMonth() + 1, //月份 + "d+": date.getDate(), //日 + "h+": date.getHours(), //小时 + "m+": date.getMinutes(), //分 + "s+": date.getSeconds(), //秒 + "q+": Math.floor((date.getMonth() + 3) / 3), //季度 + "S": date.getMilliseconds() //毫秒 }; if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length)); @@ -226,4 +240,4 @@ } window.ms.util = util; window.ms.debug = false -}()); \ No newline at end of file +}());