From 0a958f2b1a99700e2b9b16488ceb5e741fd5cf15 Mon Sep 17 00:00:00 2001 From: tao Date: Tue, 2 Aug 2022 20:46:01 +0800 Subject: [PATCH] 1.9.8 --- README.md | 4 +- app/admin/controller/Seo.php | 4 +- app/admin/controller/TagLink.php | 80 ++++++++++ app/admin/route/route.php | 11 +- app/admin/view/tag_link/add.html | 37 +++++ app/admin/view/tag_link/edit.html | 27 ++++ app/admin/view/tag_link/index.html | 185 ++++++++++++++++++++++ app/common.php | 3 +- app/index/controller/Article.php | 16 ++ app/install/data/taoler.sql | 15 ++ config/taglink.php | 3 + public/.gitignore | 3 +- public/static/res/mods/index.js | 4 +- vendor/composer/installed.php | 4 +- vendor/services.php | 2 +- vendor/taoser/think-setarr/src/SetArr.php | 4 +- view/taoler/index/index/index.html | 2 +- 17 files changed, 385 insertions(+), 19 deletions(-) create mode 100644 app/admin/controller/TagLink.php create mode 100644 app/admin/view/tag_link/add.html create mode 100644 app/admin/view/tag_link/edit.html create mode 100644 app/admin/view/tag_link/index.html create mode 100644 config/taglink.php diff --git a/README.md b/README.md index e6c79d2..37e2883 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ Fly模板: 一款至简的社区模板。 -![alt taoler官网](https://www.aieok.com/storage/1/article_pic/20220802/54c8364fffd9ca1d15856efd90b689bc.png "TaoLerCMS") +![alt taoler官网](https://www.aieok.com/storage/1/article_pic/20220802/edd9bfc2ca1d1ec52a551b2233b5ab62.png "TaoLerCMS") #### 安装教程 @@ -100,6 +100,8 @@ 4. 安装前需要先创建mysql数据库(准备:数据库连接地址,数据库用户名,密码,端口) 5. 如果手动导入数据库,管理员用户名和密码,默认admin/123456,前后台的管理员密码一致。前后端管理员账户是独立的,前端主要对文章内容的审查管理等操作。 +![alt taoler官网](https://www.aieok.com/storage/1/article_pic/20220802/54c8364fffd9ca1d15856efd90b689bc.png "TaoLerAdmin") + #### 前后台独立域名的绑定 1. 支持设置绑定域名 diff --git a/app/admin/controller/Seo.php b/app/admin/controller/Seo.php index 05b8043..0a835bf 100644 --- a/app/admin/controller/Seo.php +++ b/app/admin/controller/Seo.php @@ -2,7 +2,7 @@ /* * @Author: TaoLer * @Date: 2022-04-13 09:54:31 - * @LastEditTime: 2022-05-02 11:54:00 + * @LastEditTime: 2022-05-07 12:00:01 * @LastEditors: TaoLer * @Description: 搜索引擎SEO优化设置 * @FilePath: \TaoLer\app\admin\controller\Seo.php @@ -106,6 +106,8 @@ class Seo extends AdminController } } } + // 获取Access Token分词的必选参数,设置时写入 + $baidu['grant_type'] = 'client_credentials'; $res = SetArr::name('taoler')->edit([ 'baidu' => $baidu, ]); diff --git a/app/admin/controller/TagLink.php b/app/admin/controller/TagLink.php new file mode 100644 index 0000000..acf9973 --- /dev/null +++ b/app/admin/controller/TagLink.php @@ -0,0 +1,80 @@ +0, 'msg'=>'', 'count' => count($tags)]; + foreach($tags as $k=>$v) { + $arr['data'][] = ['tag'=>$k, 'link'=>$v]; + } + } else { + $arr = ['code'=>-1, 'msg'=>'没有数据']; + } + return json($arr); + } + + public function add() + { + if(Request::isAjax()) { + $data = Request::only(['tag','link']); + $link = '\''.$data['link'].'\''; + $arr = [$data['tag'] => $link]; + $res = SetArr::name('taglink')->add($arr); + if($res == true){ + return json(['code'=>0,'msg'=>'设置成功']); + } + } + return View::fetch(); + } + + public function edit() + { + $tag = input('tag'); + if(Request::isAjax()) { + $data = Request::only(['tag','link']); + $link = '\''.$data['link'].'\''; + $arr = [$data['tag'] => $link]; + $res = SetArr::name('taglink')->edit($arr); + if($res == true){ + return json(['code'=>0,'msg'=>'设置成功']); + } + } + + $link = config('taglink.'.$tag); + View::assign(['tag'=>$tag, 'link'=>$link]); + return View::fetch(); + } + + public function delete() + { + if(Request::isPost()) { + $tag = input('tag'); + $arr = [$tag => null]; + $res = SetArr::name('taglink')->delete($arr); + if($res == true){ + return json(['code'=>0,'msg'=>'删除成功']); + } + } + } + +} \ No newline at end of file diff --git a/app/admin/route/route.php b/app/admin/route/route.php index 57ee5d1..1632955 100644 --- a/app/admin/route/route.php +++ b/app/admin/route/route.php @@ -1,18 +1,17 @@ + * @Author: TaoLer * @Date: 2021-12-06 16:04:50 - * @LastEditTime: 2022-04-21 17:02:15 + * @LastEditTime: 2022-05-07 18:33:23 * @LastEditors: TaoLer - * @Description: 搜索引擎SEO优化设置 + * @Description: admin路由配置 * @FilePath: \TaoLer\app\admin\route\route.php - * Copyright (c) 2020~2022 http://www.aieok.com All rights reserved. + * Copyright (c) 2020~2022 https://www.aieok.com All rights reserved. */ - use think\facade\Route; // 动态详情页URL别称 $detail_as = config('taoler.url_rewrite.article_as'); Route::get('captcha/[:config]','\\think\\captcha\\CaptchaController@index'); -Route::get(config('taoler.url_rewrite.article_as').'', '\app\index\controller\Article@detail')->name('detail_id'); +Route::get("$detail_as$", '\app\index\controller\Article@detail')->name('detail_id'); diff --git a/app/admin/view/tag_link/add.html b/app/admin/view/tag_link/add.html new file mode 100644 index 0000000..a39dd44 --- /dev/null +++ b/app/admin/view/tag_link/add.html @@ -0,0 +1,37 @@ +{extend name="public/base" /} + +{block name="body"} +
+ +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+ +{/block} +{block name="js"} + +{/block} \ No newline at end of file diff --git a/app/admin/view/tag_link/edit.html b/app/admin/view/tag_link/edit.html new file mode 100644 index 0000000..493c57b --- /dev/null +++ b/app/admin/view/tag_link/edit.html @@ -0,0 +1,27 @@ +{extend name="public/base" /} + +{block name="body"} +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+ +{/block} +{block name="js"} + +{/block} \ No newline at end of file diff --git a/app/admin/view/tag_link/index.html b/app/admin/view/tag_link/index.html new file mode 100644 index 0000000..d5fb131 --- /dev/null +++ b/app/admin/view/tag_link/index.html @@ -0,0 +1,185 @@ +{extend name="public/base" /} + +{block name="body"} +
+
+
+
+
+ + +
+
+ + + +
+
+ +
+
+
+
+
+ +{/block} +{block name="js"} + +{/block} \ No newline at end of file diff --git a/app/common.php b/app/common.php index 358dd6f..5f5492d 100644 --- a/app/common.php +++ b/app/common.php @@ -7,6 +7,7 @@ use think\facade\Db; use think\facade\Cache; use think\facade\Session; use taoser\think\Auth; + // 应用公共文件 function mailto($to,$title,$content) { @@ -98,8 +99,6 @@ function getArtContent($content) return mb_substr(strip_tags($content),0,150).'...'; } - - //根据帖子收藏主键ID,查询帖子名称 if(!function_exists('getArticName')) { diff --git a/app/index/controller/Article.php b/app/index/controller/Article.php index 1c019fa..20fa6f3 100644 --- a/app/index/controller/Article.php +++ b/app/index/controller/Article.php @@ -71,6 +71,8 @@ class Article extends BaseController $page = input('page') ? input('page') : 1; $article = new ArticleModel(); $artDetail = $article->getArtDetail($id,$page); + // 设置tag内链 + $artDetail['content'] = $this->setArtTagLink($artDetail['content']); $arId = $artDetail['cate_id']; $tpl = Db::name('cate')->where('id',$arId)->value('detpl'); $download = $artDetail['upzip'] ? download($artDetail['upzip'],'file') : ''; @@ -509,5 +511,19 @@ class Article extends BaseController return $data; } + + //设置文章内容tag + protected function setArtTagLink($content) + { + // tag链接数组 + $tag = Config::get('taglink'); + if(count($tag)) { + foreach($tag as $key=>$value) { + $content = str_replace("$key", 'a('.$value.')['.$key.']',$content); + } + } + + return $content; + } } \ No newline at end of file diff --git a/app/install/data/taoler.sql b/app/install/data/taoler.sql index 67b0cdb..20df6b0 100644 --- a/app/install/data/taoler.sql +++ b/app/install/data/taoler.sql @@ -266,6 +266,7 @@ INSERT INTO `tao_auth_rule` VALUES ('97', 'addons', '插件', '', '1', '1', '0', INSERT INTO `tao_auth_rule` VALUES ('98', 'Addons/index', '插件市场', '', '1', '1', '97', '1', '', '1', '0', '', '1635757426', '0', '0'); INSERT INTO `tao_auth_rule` VALUES ('99', 'Addons/addonsList', '插件列表', '', '1', '1', '98', '2', '', '-1', '0', '', '1638775199', '0', '0'); INSERT INTO `tao_auth_rule` VALUES ('111','Seo/index','SEO', '', '1','1','0','0','layui-icon-component','1','7','','1649829142','0','0'); +INSERT INTO `tao_auth_rule` VALUES ('112', 'TagLink/index', 'TagLinks', '', '1', '1', '93', '1', '', '1', '0', '', '1652053762', '1652053830', '0'); -- ---------------------------- -- Table structure for tao_cate @@ -436,6 +437,20 @@ CREATE TABLE `tao_message_to` ( -- Records of tao_message_to -- ---------------------------- +-- +-- 表的结构 `tao_push_jscode` +-- + +CREATE TABLE `tao_push_jscode` ( + `id` int(2) NOT NULL AUTO_INCREMENT COMMENT '自增ID', + `name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '平台名', + `jscode` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'js代码', + `create_time` int NOT NULL DEFAULT '0' COMMENT '创建时间', + `update_time` int NOT NULL DEFAULT '0' COMMENT '更新时间', + `delete_time` int NOT NULL DEFAULT '0' COMMENT '删除时间', + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='站长平台自动推送js代码'; + -- ---------------------------- -- Table structure for tao_slider -- ---------------------------- diff --git a/config/taglink.php b/config/taglink.php new file mode 100644 index 0000000..60c0351 --- /dev/null +++ b/config/taglink.php @@ -0,0 +1,3 @@ +
'; }) @@ -538,7 +538,7 @@ layui.define(['layer', 'laytpl', 'form', 'element', 'upload', 'util', 'imgcom'], var text = (str.match(/\)\[([\s\S]*?)\]/)||[])[1]; if(!href) return str; var rel = /^(http(s)*:\/\/)\b(?!(\w+\.)*(sentsin.com|layui.com))\b/.test(href.replace(/\s/g, '')); - return ''+ (text||href) +''; + return ''+ (text||href) +''; }) //转义横线 diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index 5935b46..6c69cb8 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -5,7 +5,7 @@ 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), - 'reference' => '334c91212372abf2e9a2441668700e9a794b635d', + 'reference' => 'a9887fb4dd7614f13e14e21e16a876c3d435b23b', 'name' => 'taoser/taoler', 'dev' => true, ), @@ -160,7 +160,7 @@ 'type' => 'project', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), - 'reference' => '334c91212372abf2e9a2441668700e9a794b635d', + 'reference' => 'a9887fb4dd7614f13e14e21e16a876c3d435b23b', 'dev_requirement' => false, ), 'taoser/think-addons' => array( diff --git a/vendor/services.php b/vendor/services.php index 998d534..bf2ef5c 100644 --- a/vendor/services.php +++ b/vendor/services.php @@ -1,5 +1,5 @@ 'taoser\\addons\\Service', diff --git a/vendor/taoser/think-setarr/src/SetArr.php b/vendor/taoser/think-setarr/src/SetArr.php index 1e5c92f..383562f 100644 --- a/vendor/taoser/think-setarr/src/SetArr.php +++ b/vendor/taoser/think-setarr/src/SetArr.php @@ -2,7 +2,7 @@ /* * @Author: TaoLer * @Date: 2022-04-14 16:05:35 - * @LastEditTime: 2022-04-20 14:49:27 + * @LastEditTime: 2022-05-09 11:31:00 * @LastEditors: TaoLer * @Description: 搜索引擎SEO优化设置 * @FilePath: \TaoLer\vendor\taoser\think-setarr\src\SetArr.php @@ -692,7 +692,7 @@ class SetArr echo $k.'不存在 '; return false; } - $patk = '/[^\n]*\'' . $v . '\'(.*?)\r?\n/'; + $patk = '/[^\n]*\'' . $k . '\'(.*?)\r?\n/'; } // 正则查找然后替换 diff --git a/view/taoler/index/index/index.html b/view/taoler/index/index/index.html index 7a0c243..b8db16e 100644 --- a/view/taoler/index/index/index.html +++ b/view/taoler/index/index/index.html @@ -1,6 +1,6 @@ {extend name="public:base" /} -{block name="title"}{$sysInfo.webname}-{$sysInfo.webtitle}{/block} +{block name="title"}{$sysInfo.webtitle}{/block} {block name="keywords"}{$sysInfo.keywords}{/block} {block name="description"}{$sysInfo.descript}{/block} {block name="column"}{include file="public/column" /}{/block}