From 5e21c27aae069ac16ca20c376ccfcf3966b73a66 Mon Sep 17 00:00:00 2001 From: muzi_ys <1099438829@qq.com> Date: Wed, 30 Nov 2022 11:41:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E6=8A=A5=E9=94=99=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=BB=9F=E8=AE=A1=E4=BB=A3=E7=A0=81=E6=94=AF?= =?UTF-8?q?=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/controller/Article.php | 2 +- app/admin/controller/Category.php | 2 +- app/admin/controller/Index.php | 4 +- app/common/model/Document.php | 2 +- .../{Category.php => DocumentCategory.php} | 2 +- app/index/common.php | 16 ++-- app/index/controller/Article.php | 4 +- public/install/ape_blog.sql | 83 ++++++++----------- public/install/index.php | 2 +- public/template/default/pc/public/footer.html | 3 +- 10 files changed, 53 insertions(+), 67 deletions(-) rename app/common/model/{Category.php => DocumentCategory.php} (95%) diff --git a/app/admin/controller/Article.php b/app/admin/controller/Article.php index 9d81096..c6c9315 100644 --- a/app/admin/controller/Article.php +++ b/app/admin/controller/Article.php @@ -5,7 +5,7 @@ namespace app\admin\controller; use app\admin\extend\Util as Util; use app\common\model\Comment as CommentModel; use app\common\model\Document; -use app\common\model\Category as cModel; +use app\common\model\DocumentCategory as cModel; use think\db\exception\DataNotFoundException; use think\db\exception\DbException; use think\db\exception\ModelNotFoundException; diff --git a/app/admin/controller/Category.php b/app/admin/controller/Category.php index 44353ef..50cc377 100644 --- a/app/admin/controller/Category.php +++ b/app/admin/controller/Category.php @@ -4,7 +4,7 @@ namespace app\admin\controller; use app\admin\extend\Util as Util; use app\common\constant\Data; -use app\common\model\Category as aModel; +use app\common\model\DocumentCategory as aModel; use app\Request; use Exception; use think\db\exception\DataNotFoundException; diff --git a/app/admin/controller/Index.php b/app/admin/controller/Index.php index d9ac7fe..21dc01d 100644 --- a/app/admin/controller/Index.php +++ b/app/admin/controller/Index.php @@ -5,8 +5,8 @@ namespace app\admin\controller; use app\common\model\AdminAuth; use app\common\model\Document; use app\common\model\Document as DocumentModel; -use app\common\model\Category; -use app\common\model\Category as DocumentCategoryModel; +use app\common\model\DocumentCategory; +use app\common\model\DocumentCategory as DocumentCategoryModel; use app\common\model\FriendLink; use app\common\model\MessageForm; use app\common\model\AdminNotify; diff --git a/app/common/model/Document.php b/app/common/model/Document.php index 8ba5e78..cdfb1f7 100644 --- a/app/common/model/Document.php +++ b/app/common/model/Document.php @@ -40,7 +40,7 @@ class Document extends BaseModel $model = $model->order("sort desc")->order("id desc"); $count = self::counts($model); if ($where['page'] && $where['limit']) $model = $model->page((int)$where['page'], (int)$where['limit']); - $categoryList = Category::column('title', 'id'); + $categoryList = DocumentCategory::column('title', 'id'); $data = $model->select()->each(function ($item) use ($categoryList) { $item->category_title = $categoryList[$item->category_id] ?? ""; }); diff --git a/app/common/model/Category.php b/app/common/model/DocumentCategory.php similarity index 95% rename from app/common/model/Category.php rename to app/common/model/DocumentCategory.php index a813378..da094af 100644 --- a/app/common/model/Category.php +++ b/app/common/model/DocumentCategory.php @@ -13,7 +13,7 @@ use think\db\exception\ModelNotFoundException; * @author 木子的忧伤 * @date 2021-02-15 23:22 */ -class Category extends BaseModel +class DocumentCategory extends BaseModel { /** * 列表 diff --git a/app/index/common.php b/app/index/common.php index 48ef1c7..62b2338 100644 --- a/app/index/common.php +++ b/app/index/common.php @@ -3,7 +3,7 @@ use app\common\constant\Data; use app\common\model\Comment; use app\common\model\Document; -use app\common\model\Category; +use app\common\model\DocumentCategory; use app\common\model\Advert; use app\common\model\FriendLink; use app\common\model\Tag; @@ -44,7 +44,7 @@ function get_document_category_list() //缓存文章菜单 $documentCategory = cache(Data::DATA_DOCUMENT_CATEGORY_LIST); if ($documentCategory === null) { - $documentCategoryList = Category::where('status', 1)->order('sort asc')->select()->toArray(); + $documentCategoryList = DocumentCategory::where('status', 1)->order('sort asc')->select()->toArray(); //转换,让id作为数组的键 $documentCategory = []; foreach ($documentCategoryList as $item) { @@ -112,7 +112,7 @@ function get_document_category_by_name($name, $field = false) * @param int $row * @param string $where * @param string $orderby - * @return Category[]|array|bool|Collection + * @return DocumentCategory[]|array|bool|Collection * @throws Exception * @throws DataNotFoundException * @throws DbException @@ -158,7 +158,7 @@ function tpl_get_channel($type, $typeId, $row = 100, $where = '', $orderby = '') if (!$dc) { throw new Exception('分类不存在或已删除!'); } - $tempArr = Category::where('id', 'in', $dc['child'])->where('status', 1)->limit($row); + $tempArr = DocumentCategory::where('id', 'in', $dc['child'])->where('status', 1)->limit($row); $tempArr = $tempArr->select(); foreach ($tempArr as $key => $item) { //根据栏目类型,生成栏目url @@ -185,7 +185,7 @@ function tpl_get_channel($type, $typeId, $row = 100, $where = '', $orderby = '') $dc = get_document_category($typeId); if ($dc['pid'] != 0) { //获取根分类,此操作读取数据库,非缓存! - $dc = Category::where('pid', 0)->where('status', 1) + $dc = DocumentCategory::where('pid', 0)->where('status', 1) ->where("CONCAT(',',child,',') like '%,$typeId,%'")->limit($row); $dc = $dc->find(); } @@ -197,7 +197,7 @@ function tpl_get_channel($type, $typeId, $row = 100, $where = '', $orderby = '') break; case 'where': //根据自定义条件获取分类(where语句),此操作读取数据库,非缓存! - $tempArr = Category::where('status', 1)->where($where)->order($orderby)->limit($row); + $tempArr = DocumentCategory::where('status', 1)->where($where)->order($orderby)->limit($row); $tempArr = $tempArr->select(); foreach ($tempArr as $key => $item) { //根据栏目类型,生成栏目url @@ -208,7 +208,7 @@ function tpl_get_channel($type, $typeId, $row = 100, $where = '', $orderby = '') break; case 'ids': //根据多个栏目id,逗号隔开的那种,获得栏目列表 - $tempArr = Category::where('status', 1)->where('id', 'in', $typeId)->order($orderby)->limit($row); + $tempArr = DocumentCategory::where('status', 1)->where('id', 'in', $typeId)->order($orderby)->limit($row); $tempArr = $tempArr->select(); foreach ($tempArr as $key => $item) { //根据栏目类型,生成栏目url @@ -1038,7 +1038,7 @@ function comment_face($incoming_comment,$path) * @param int $row * @param string $where * @param string $orderby - * @return Category[]|array|bool|Collection + * @return DocumentCategory[]|array|bool|Collection * @throws Exception * @throws DataNotFoundException * @throws DbException diff --git a/app/index/controller/Article.php b/app/index/controller/Article.php index 419bb7a..d034d19 100644 --- a/app/index/controller/Article.php +++ b/app/index/controller/Article.php @@ -6,7 +6,7 @@ use app\admin\extend\Util as Util; use app\common\constant\Data; use app\common\model\Comment as commentModel; use app\common\model\Document; -use app\common\model\Category; +use app\common\model\DocumentCategory; use app\Request; use think\db\exception\DataNotFoundException; use think\db\exception\DbException; @@ -50,7 +50,7 @@ class Article extends Base } //赋值分类id,可能是通过栏目分类id获取的栏目分类数据 $id = $dc['id']; - $documentCategoryModel = new Category(); + $documentCategoryModel = new DocumentCategory(); //栏目存在 增加访问量 $documentCategoryModel->where('id|alias', $id)->inc('view')->update(); //判断后台统计配置是否开启 1 开启 diff --git a/public/install/ape_blog.sql b/public/install/ape_blog.sql index ffa80dc..fb2268d 100644 --- a/public/install/ape_blog.sql +++ b/public/install/ape_blog.sql @@ -11,7 +11,7 @@ Target Server Version : 50726 File Encoding : 65001 - Date: 27/11/2022 00:02:52 + Date: 30/11/2022 11:40:29 */ SET NAMES utf8mb4; @@ -128,15 +128,11 @@ CREATE TABLE `ape_admin_log` ( `user_agent` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT 'User-Agent', `create_time` int(10) NOT NULL DEFAULT 0 COMMENT '操作时间', PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '操作日志表' ROW_FORMAT = DYNAMIC; +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '操作日志表' ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of ape_admin_log -- ---------------------------- -INSERT INTO `ape_admin_log` VALUES (1, 1, 'admin', 'admin', 'index', 'main', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36 Edg/105.0.1343.53', 1669478531); -INSERT INTO `ape_admin_log` VALUES (2, 1, 'admin', 'admin', 'admin', 'index', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36 Edg/105.0.1343.53', 1669478536); -INSERT INTO `ape_admin_log` VALUES (3, 1, 'admin', 'admin', 'admin_auth', 'index', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36 Edg/105.0.1343.53', 1669478536); -INSERT INTO `ape_admin_log` VALUES (4, 1, 'admin', 'admin', 'admin_role', 'index', '127.0.0.1', 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36 Edg/105.0.1343.53', 1669478537); -- ---------------------------- -- Table structure for ape_admin_notify @@ -273,35 +269,6 @@ CREATE TABLE `ape_attachment_category` ( -- Records of ape_attachment_category -- ---------------------------- --- ---------------------------- --- Table structure for ape_category --- ---------------------------- -DROP TABLE IF EXISTS `ape_category`; -CREATE TABLE `ape_category` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `title` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '标题', - `alias` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '标志', - `icon` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '分类图标', - `pid` int(10) NOT NULL DEFAULT 0 COMMENT '上级分类ID', - `sort` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '排序(同级有效)', - `meta_title` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'SEO的网页标题', - `keywords` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '关键字', - `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '描述', - `status` tinyint(2) NOT NULL DEFAULT 1 COMMENT '是否显示', - `template` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '分类模板', - `view` int(10) NOT NULL DEFAULT 0 COMMENT '访问数', - `create_time` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间', - `update_time` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间', - PRIMARY KEY (`id`) USING BTREE, - UNIQUE INDEX `alias`(`alias`) USING BTREE COMMENT '别名URl', - INDEX `t_p_s`(`title`, `pid`, `status`) USING BTREE COMMENT '标题' -) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '分类表' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Records of ape_category --- ---------------------------- -INSERT INTO `ape_category` VALUES (1, '编程资料', '01df859b', '', 0, 99, '编程资料', '关于小站,源码云,源码云博客,关于源码云博客', '讲述的是傲娇天才酒评家陆微寻和元气失味少女何不醉因意外亲吻发生味觉互换,携手寻味觅爱的浪漫爱情故事。画风截然不同的二人因一场意外亲吻交换了味觉,从而开始了啼笑皆非又温馨浪漫的寻味之旅,在这个过程中他们互相了解,彼此影响,最终收获了味觉和爱情。', 1, 'list_default.html', 0, 0, 0); - -- ---------------------------- -- Table structure for ape_comment -- ---------------------------- @@ -361,12 +328,11 @@ CREATE TABLE `ape_document` ( UNIQUE INDEX `alias`(`alias`) USING BTREE, INDEX `idx_category_status`(`category_id`, `status`) USING BTREE, INDEX `idx_status_type_pid`(`status`, `uid`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '文档模型基础表' ROW_FORMAT = DYNAMIC; +) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '文档模型基础表' ROW_FORMAT = DYNAMIC; -- ---------------------------- -- Records of ape_document -- ---------------------------- -INSERT INTO `ape_document` VALUES (1, 'about', 1, '超级管理员', '关于', 0, '/storage/image/20220710/4f392482c34a194fe8e7fb9b6da95ae9.png', 'page', 'article.html', 0, 0, 0, '', 0, 1, 10, '', '源码云BLOG源码云博客是一款基于ThinkPHP6 + bootstrap+ MySql打造的,简单实用的开源免费的博客系统。各管理模块,操作简单,具有简约,易用,访问统计,内存占用低等特点,系统易', '', '', 99, '2022-07-10', 1657464554, 1657464554, 1, ''); -- ---------------------------- -- Table structure for ape_document_article @@ -381,16 +347,35 @@ CREATE TABLE `ape_document_article` ( -- ---------------------------- -- Records of ape_document_article -- ---------------------------- -INSERT INTO `ape_document_article` VALUES (0, '

阿萨大大大大大大大大大大大大大大大大大


dasdasdsaa


asdddddddddddddd

'); -INSERT INTO `ape_document_article` VALUES (2, '

饿哇日日日日日日日日日日日日日日日

'); -INSERT INTO `ape_document_article` VALUES (7, '

32423

32

423

423

4

2

34

2

34

'); -INSERT INTO `ape_document_article` VALUES (8, '

21321312

'); -INSERT INTO `ape_document_article` VALUES (9, '

2111111111111111111111

'); -INSERT INTO `ape_document_article` VALUES (10, '

324324234

'); -INSERT INTO `ape_document_article` VALUES (11, '

23423

'); -INSERT INTO `ape_document_article` VALUES (12, '

撒旦撒旦

'); -INSERT INTO `ape_document_article` VALUES (16, '

认为人

'); -INSERT INTO `ape_document_article` VALUES (17, '

23123

'); + +-- ---------------------------- +-- Table structure for ape_document_category +-- ---------------------------- +DROP TABLE IF EXISTS `ape_document_category`; +CREATE TABLE `ape_document_category` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '标题', + `alias` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '标志', + `icon` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '分类图标', + `pid` int(10) NOT NULL DEFAULT 0 COMMENT '上级分类ID', + `sort` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '排序(同级有效)', + `meta_title` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT 'SEO的网页标题', + `keywords` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '关键字', + `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '描述', + `status` tinyint(2) NOT NULL DEFAULT 1 COMMENT '是否显示', + `template` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '分类模板', + `view` int(10) NOT NULL DEFAULT 0 COMMENT '访问数', + `create_time` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间', + `update_time` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `alias`(`alias`) USING BTREE COMMENT '别名URl', + INDEX `t_p_s`(`title`, `pid`, `status`) USING BTREE COMMENT '标题' +) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '分类表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Records of ape_document_category +-- ---------------------------- +INSERT INTO `ape_document_category` VALUES (1, '编程资料', '01df859b', '', 0, 99, '编程资料', '关于小站,源码云,源码云博客,关于源码云博客', '讲述的是傲娇天才酒评家陆微寻和元气失味少女何不醉因意外亲吻发生味觉互换,携手寻味觅爱的浪漫爱情故事。画风截然不同的二人因一场意外亲吻交换了味觉,从而开始了啼笑皆非又温馨浪漫的寻味之旅,在这个过程中他们互相了解,彼此影响,最终收获了味觉和爱情。', 1, 'list_default.html', 0, 0, 0); -- ---------------------------- -- Table structure for ape_document_page @@ -545,7 +530,7 @@ CREATE TABLE `ape_system_config` ( `tag_type` varchar(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '标签类型', `upload_type` tinyint(1) NOT NULL DEFAULT 0 COMMENT '上传配置', `param` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '参数', - `value` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '内容', + `value` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '内容', `remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '备注', `rank` tinyint(2) NOT NULL DEFAULT 0 COMMENT '排序', `is_show` tinyint(1) UNSIGNED NOT NULL DEFAULT 1 COMMENT '是否显示', @@ -569,7 +554,7 @@ INSERT INTO `ape_system_config` VALUES (6, 1, '站点logo', 'logo', 'file', 'inp INSERT INTO `ape_system_config` VALUES (7, 1, '版权信息', 'copyright', 'text', 'input', 0, '', 'Copyright © 2022 apeBlog Powered by 源码云博客', '', 93, 1, 1, '1', '1', 1582793470, 1582793495); INSERT INTO `ape_system_config` VALUES (8, 1, '备案信息', 'icp', 'text', 'textarea', 0, '', '京ICP备19038953号 | 甘公网安备62062102000138号', '', 92, 1, 1, '1', '1', 1582793563, 1583375542); INSERT INTO `ape_system_config` VALUES (10, 1, '网站域名', 'domain', 'text', 'input', 0, '', 'http://apeblog.io', '', 90, 1, 1, '1', '1', 1588858018, 1582792265); -INSERT INTO `ape_system_config` VALUES (11, 1, '网站统计代码', 'statistics', 'text', 'textarea', 0, '', '', '', 89, 1, 1, '1', '1', 1582793470, 1582793495); +INSERT INTO `ape_system_config` VALUES (11, 1, '网站统计代码', 'statistics', 'text', 'textarea', 0, '', '', '', 89, 1, 1, '1', '1', 1582793470, 1582793495); INSERT INTO `ape_system_config` VALUES (12, 1, '主题信息', 'web_template', 'select', 'input', 0, 'default=>默认\nnew=>新bolg', 'default', '', 88, 1, 1, '1', '1', 1582793563, 1620610858); INSERT INTO `ape_system_config` VALUES (13, 1, '关闭网站', 'web_close', 'radio', 'input', 0, '1=>是\n0=>否', '0', '', 87, 1, 1, '1', '1', 1583126643, 1582792265); INSERT INTO `ape_system_config` VALUES (14, 1, '网站统计', 'web_statistics', 'radio', 'input', 0, '1=>开启\n0=>关闭', '1', '', 86, 1, 1, '1', '1', 1583126643, 1582792265); diff --git a/public/install/index.php b/public/install/index.php index 86ff3c4..f0c6e1d 100644 --- a/public/install/index.php +++ b/public/install/index.php @@ -286,7 +286,7 @@ switch ($step) { , 'ape_document' , 'ape_document_article' , 'ape_document_category' - , 'ape_document_category_content' + , 'ape_document_page' , 'ape_document_product' , 'ape_friend_link' , 'ape_invitation_code' diff --git a/public/template/default/pc/public/footer.html b/public/template/default/pc/public/footer.html index 05f87cf..72792f9 100644 --- a/public/template/default/pc/public/footer.html +++ b/public/template/default/pc/public/footer.html @@ -89,4 +89,5 @@ - \ No newline at end of file + +{:web_config('statistics')} \ No newline at end of file