From 5ed3964b65aa3a024610c808de280dad4aa16a32 Mon Sep 17 00:00:00 2001 From: hdm Date: Thu, 8 Jul 2021 11:52:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=BB=86=E8=8A=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/controller/Article.php | 10 +++++----- app/admin/view/article/add.html | 23 ++++++++++++++--------- app/admin/view/article/edit.html | 15 ++++++++++----- app/admin/view/login/index.html | 4 ++-- app/common.php | 2 +- app/install/data/gougucms.sql | 11 ++++++----- 6 files changed, 38 insertions(+), 27 deletions(-) diff --git a/app/admin/controller/Article.php b/app/admin/controller/Article.php index dfaf2c3..7167edf 100644 --- a/app/admin/controller/Article.php +++ b/app/admin/controller/Article.php @@ -51,7 +51,6 @@ class Article extends BaseController if ($res) { add_log('edit', $data['id'], $data); } - return to_assign(); } else { try { @@ -65,7 +64,6 @@ class Article extends BaseController if ($insertId) { add_log('add', $insertId, $param); } - return to_assign(); } } @@ -105,7 +103,7 @@ class Article extends BaseController $where[] = ['a.status', '>=', 0]; $rows = empty($param['limit']) ? get_config(app . page_size) : $param['limit']; $content = ArticleList::where($where) - ->field('*,w.id as cate_id,a.id as id,w.title as cate_title,a.title as title') + ->field('a.*,w.id as cate_id,a.id as id,w.title as cate_title,a.title as title') ->alias('a') ->join('article_cate w', 'a.article_cate_id = w.id') ->order('a.create_time desc') @@ -143,8 +141,7 @@ class Article extends BaseController // 验证失败 输出错误信息 return to_assign(0, $e->getError()); } - $param['update_time'] = time(); - + $param['update_time'] = time(); Db::startTrans(); try { $res = ArticleList::strict(false)->field(true)->update($param); @@ -185,6 +182,9 @@ class Article extends BaseController $param['create_time'] = time(); Db::startTrans(); try { + if(empty($param['desc'])){ + $param['desc'] = getDescriptionFromContent($param['content'], 100); + } $aid = ArticleList::strict(false)->field(true)->insertGetId($param); if ($aid) { if (isset($param['keyword_names']) && $param['keyword_names']) { diff --git a/app/admin/view/article/add.html b/app/admin/view/article/add.html index f0c2c8a..16aa267 100644 --- a/app/admin/view/article/add.html +++ b/app/admin/view/article/add.html @@ -9,7 +9,7 @@ class="layui-input"> - 分类* + 文章分类* - + + 状态* @@ -51,24 +51,29 @@ - 文章来源 + 是否原创 - + + + + 作者/来源 + + 来源链接 - + - 摘要 + 文章摘要 缩略图
- +
@@ -77,7 +82,7 @@ - 内容* + 文章内容* diff --git a/app/admin/view/article/edit.html b/app/admin/view/article/edit.html index e4c06e7..45e7eab 100644 --- a/app/admin/view/article/edit.html +++ b/app/admin/view/article/edit.html @@ -10,7 +10,7 @@ class="layui-input" value="{$article.title}"> - 分类* + 文章分类* + + + 作者/来源 来源链接 - + @@ -72,7 +77,7 @@ 缩略图
- +
@@ -81,7 +86,7 @@ - 内容* + 文章内容* diff --git a/app/admin/view/login/index.html b/app/admin/view/login/index.html index 95a3cb7..6f77990 100644 --- a/app/admin/view/login/index.html +++ b/app/admin/view/login/index.html @@ -51,10 +51,10 @@
- +
- +
diff --git a/app/common.php b/app/common.php index 9556933..5f5fea7 100644 --- a/app/common.php +++ b/app/common.php @@ -20,7 +20,7 @@ function get_cache($key) //清空缓存 function clear_cache($key) { - Cache::clear($key); + Cache::delete($key); } diff --git a/app/install/data/gougucms.sql b/app/install/data/gougucms.sql index 26f67aa..3d8999b 100644 --- a/app/install/data/gougucms.sql +++ b/app/install/data/gougucms.sql @@ -303,8 +303,9 @@ CREATE TABLE `cms_article` ( `keywords` varchar(255) DEFAULT '' COMMENT '关键字', `desc` varchar(1000) DEFAULT '' COMMENT '摘要', `status` int(1) NOT NULL DEFAULT '1' COMMENT '1正常-1下架', - `thumb` varchar(255) NOT NULL DEFAULT '' COMMENT '缩略图', - `origin` varchar(255) NOT NULL DEFAULT '' COMMENT '来源', + `thumb` int(11) NOT NULL DEFAULT 0 COMMENT '缩略图id', + `original` int(1) NOT NULL DEFAULT 0 COMMENT '是否原创,1原创', + `origin` varchar(255) NOT NULL DEFAULT '' COMMENT '来源或作者', `origin_url` varchar(255) NOT NULL DEFAULT '' COMMENT '来源地址', `content` text NOT NULL, `read` int(11) NOT NULL DEFAULT '0' COMMENT '阅读量', @@ -321,7 +322,7 @@ CREATE TABLE `cms_article` ( -- ---------------------------- -- Records of cms_article -- ---------------------------- -INSERT INTO `cms_article` VALUES (1, '勾股CMS简介', '', '', 1, '', '', '', '

勾股CMS是一套基于ThinkPHP6 + Layui + MySql打造的轻量级、高性能快速建站的内容管理系统。后台管理模块,一目了然,操作简单,通用型后台权限管理框架,紧随潮流、极低门槛、开箱即用。

', 0, 0, 0, 0, 1, 1608178497, 1608180590, '0'); +INSERT INTO `cms_article` VALUES (1, '勾股CMS简介', '', '勾股CMS是一套基于ThinkPHP6+Layui+MySql打造的轻量级、高性能快速建站的内容管理系统。后台管理模块,一目了然,操作简单,通用型后台权限管理框架,紧随潮流、极低门槛、开箱即用。', 1, 0, 0, '', '', '

勾股CMS是一套基于ThinkPHP6 + Layui + MySql打造的轻量级、高性能快速建站的内容管理系统。后台管理模块,一目了然,操作简单,通用型后台权限管理框架,紧随潮流、极低门槛、开箱即用。

', 0, 2, 1, 0, 1, 1625071256, 0, 0); -- ---------------------------- -- Table structure for `cms_article_keywords` @@ -420,10 +421,10 @@ CREATE TABLE `cms_nav_info` ( -- ----------------------------- INSERT INTO `cms_nav_info` VALUES ('1', '0', '1', '首页', '/', '', '0', '1', '1', '0', '0'); INSERT INTO `cms_nav_info` VALUES ('2', '0', '1', '文档', '/', '', '0', '1', '2', '0', '0'); -INSERT INTO `cms_nav_info` VALUES ('3', '0', '1', '社区', '/', '', '1', '1', '3', '0', '0'); +INSERT INTO `cms_nav_info` VALUES ('3', '0', '1', '社区', '/', '', '0', '1', '3', '0', '0'); INSERT INTO `cms_nav_info` VALUES ('4', '0', '1', '腾讯云优惠', 'https://curl.qcloud.com/PPEgI0oV', '', '1', '1', '4', '0', '0'); INSERT INTO `cms_nav_info` VALUES ('5', '0', '1', '阿里云特惠', 'https://www.aliyun.com/activity/daily/bestoffer?userCode=dmrcx154', '', '1', '1', '5', '0', '0'); -INSERT INTO `cms_nav_info` VALUES ('6', '0', '1', '后台演示', 'https://cms.gougucms.com/admin/index/index.html', '', '1', '1', '6', '0', '0'); +INSERT INTO `cms_nav_info` VALUES ('6', '0', '1', '后台演示', 'https://www.gougucms.com/admin/index/index.html', '', '1', '1', '6', '0', '0'); -- ---------------------------- -- Table structure for `cms_slide`