-
+
+
@@ -74,7 +73,6 @@
-
@@ -96,9 +94,6 @@
-
-
-
diff --git a/app/admin/view/content/tag/add.html b/app/admin/view/content/tag/add.html
new file mode 100644
index 0000000..1d02b04
--- /dev/null
+++ b/app/admin/view/content/tag/add.html
@@ -0,0 +1,91 @@
+
+{extend name="public/admin_form" /}
+
+{block name="body"}
+
+
+{/block}
+{block name="js"}
+
+{/block}
\ No newline at end of file
diff --git a/app/admin/view/content/tag/edit.html b/app/admin/view/content/tag/edit.html
new file mode 100644
index 0000000..95c49fd
--- /dev/null
+++ b/app/admin/view/content/tag/edit.html
@@ -0,0 +1,90 @@
+{extend name="public/admin_form" /}
+
+{block name="body"}
+
+
+{/block}
+
+{block name="js"}
+
+{/block}
\ No newline at end of file
diff --git a/app/admin/view/content/tag/index.html b/app/admin/view/content/tag/index.html
new file mode 100644
index 0000000..2f91489
--- /dev/null
+++ b/app/admin/view/content/tag/index.html
@@ -0,0 +1,191 @@
+{extend name="public/admin_base" /}
+
+{block name="body"}
+
+
+
+
+{/block}
+{block name="js"}
+
+{/block}
\ No newline at end of file
diff --git a/app/admin/view/user/user/edit.html b/app/admin/view/user/user/edit.html
index c9cab75..17b0ca4 100644
--- a/app/admin/view/user/user/edit.html
+++ b/app/admin/view/user/user/edit.html
@@ -90,8 +90,7 @@
icon: 1,
time: 1000
}, function() {
- parent.layer.close(parent.layer.getFrameIndex(window
- .name)); //关闭当前页
+ parent.layer.close(parent.layer.getFrameIndex(window.name)); //关闭当前页
parent.layui.table.reload("user-table");
});
} else {
diff --git a/app/common.php b/app/common.php
index 922f1bc..b33329d 100644
--- a/app/common.php
+++ b/app/common.php
@@ -58,11 +58,6 @@ try {
return 1;
}
-//根据user area_id查询区域简称
-function getAsing($area_id){
- return Db::name('user_area')->where('id',$area_id)->cache(3600)->value('asing');
-}
-
//根据用户主键ID,查询用户名称
if(!function_exists('getUserName'))
{
diff --git a/app/common/controller/AdminController.php b/app/common/controller/AdminController.php
index 76e85b7..4aab919 100644
--- a/app/common/controller/AdminController.php
+++ b/app/common/controller/AdminController.php
@@ -148,7 +148,7 @@ class AdminController extends \app\BaseController
}
/**
- * 获取路由
+ * 把后台管理文章或帖子的路由转换为实际应用的路由
* @param int $aid
* @param string $appName
* @param string $ename
@@ -203,6 +203,14 @@ class AdminController extends \app\BaseController
return $this->getDomain() . str_replace($map_admin, $appName, $articleUrl);
}
//3.admin未绑定域名也未映射
+ // 1.应用绑定了域名
+ if($app_bind) {
+ return $this->getDomain() . $articleUrl;
+ }
+ // 2.应用进行了映射
+ if($app_map){
+ return $this->getDomain() . str_replace('admin', $app_map, $articleUrl);
+ }
return str_replace('admin', $appName, $articleUrl);
}
diff --git a/app/common/controller/BaseController.php b/app/common/controller/BaseController.php
index ba8f254..fdf4c6f 100644
--- a/app/common/controller/BaseController.php
+++ b/app/common/controller/BaseController.php
@@ -69,7 +69,6 @@ class BaseController extends BaseCtrl
// 显示导航nav
protected function showNav()
{
- $appname = app('http')->getName();
//1.查询分类表获取所有分类
$cate = new Cate();
$cateList = $cate->menu();
diff --git a/app/common/model/Article.php b/app/common/model/Article.php
index ee61378..96980d3 100644
--- a/app/common/model/Article.php
+++ b/app/common/model/Article.php
@@ -195,7 +195,7 @@ class Article extends Model
{
return Cache::remember('article_'.$id, function() use($id){
//查询文章
- return $this::field('id,title,content,status,cate_id,user_id,goods_detail_id,is_top,is_hot,is_reply,pv,jie,upzip,downloads,keywords,description,title_color,create_time,update_time')
+ return $this::field('id,title,content,status,cate_id,user_id,goods_detail_id,is_top,is_hot,is_reply,pv,jie,upzip,downloads,keywords,description,read_type,art_pass,title_color,create_time,update_time')
->where(['status'=>1])
->with([
'cate' => function($query){
diff --git a/app/common/model/Cate.php b/app/common/model/Cate.php
index 5f5372f..a029a59 100644
--- a/app/common/model/Cate.php
+++ b/app/common/model/Cate.php
@@ -81,10 +81,9 @@ class Cate extends Model
// 如果菜单下无内容,URl不能点击
public function menu()
{
- $appname = app('http')->getName();
try {
- return $this->where(['status' => 1, 'appname' => $appname])
- ->cache('catename' . $appname, 3600)
+ return $this->where(['status' => 1])
+ ->cache('catename', 3600)
->append(['url'])
->select()
->toArray();
diff --git a/app/common/model/Tag.php b/app/common/model/Tag.php
index a67ebec..3835936 100644
--- a/app/common/model/Tag.php
+++ b/app/common/model/Tag.php
@@ -42,20 +42,16 @@ class Tag extends Model
/**
* 删除数据
- *
- * @param [type] $id
- * @return void
+ * @param $id
+ * @return bool
*/
public function delTag($id)
{
- //
$res = $this::destroy($id);
-
- if($res == true) {
+ if($res) {
return true;
- } else {
- return false;
}
+ return false;
}
}
\ No newline at end of file
diff --git a/app/index/controller/Article.php b/app/index/controller/Article.php
index cec1c24..d6b6998 100644
--- a/app/index/controller/Article.php
+++ b/app/index/controller/Article.php
@@ -3,10 +3,12 @@
namespace app\index\controller;
use app\common\controller\BaseController;
+use think\App;
use think\facade\View;
use think\facade\Request;
use think\facade\Db;
use think\facade\Cache;
+use think\facade\Session;
use think\facade\Config;
use app\common\model\Cate;
use app\common\model\Comment;
@@ -22,8 +24,16 @@ class Article extends BaseController
protected $middleware = [
'logincheck' => ['except' => ['cate','detail','download'] ],
];
-
- //文章分类
+
+ protected $model;
+
+ public function __construct(App $app)
+ {
+ parent::__construct($app);
+ $this->model = new ArticleModel();
+ }
+
+ //文章分类
public function cate()
{
$cate = new Cate();
@@ -75,13 +85,19 @@ class Article extends BaseController
$page = input('page',1);
//输出内容
$article = new ArticleModel();
- $artDetail = $article->getArtDetail($id);
+ $artDetail = $this->model->getArtDetail($id);
+
+ if($artDetail['read_type'] == 1 && session('art_pass_'.$id) != $artDetail['art_pass'])
+ {
+ $artDetail['content'] = '加密文件!请正确输入密码查看!';
+ }
+
if(is_null($artDetail)){
// 抛出 HTTP 异常
throw new \think\exception\HttpException(404, '无内容');
}
//用户个人tag标签
- $userTags = $article->where(['user_id'=>$artDetail['user_id'],'status'=>1])->where('keywords','<>','')->column('keywords');
+ $userTags = $this->model->where(['user_id'=>$artDetail['user_id'],'status'=>1])->where('keywords','<>','')->column('keywords');
//转换为字符串
$tagStr = implode(",",$userTags);
//转换为数组并去重
@@ -137,7 +153,6 @@ class Article extends BaseController
//评论
$comments = $this->getComments($id, $page);
- //halt($comments);
//最新评论时间
$lrDate_time = Db::name('comment')->where('article_id', $id)->max('update_time',false) ?? time();
// 热议文章
@@ -169,6 +184,7 @@ class Article extends BaseController
'userZanList' => $userZanList,
'userTagCount'=> $userTagCount,
'jspage' => 'jie',
+ 'passJieMi' => session('art_pass_'.$id),
$download,
]);
@@ -242,7 +258,7 @@ class Article extends BaseController
// 检验发帖是否开放
if(config('taoler.config.is_post') == 0 ) return json(['code'=>-1,'msg'=>'抱歉,系统维护中,暂时禁止发帖!']);
// 数据
- $data = Request::only(['cate_id', 'title', 'title_color', 'content', 'upzip', 'keywords', 'description', 'captcha']);
+ $data = Request::only(['cate_id', 'title', 'title_color','read_type','art_pass', 'content', 'upzip', 'keywords', 'description', 'captcha']);
$data['user_id'] = $this->uid;
$tagId = input('tagid');
@@ -339,7 +355,7 @@ class Article extends BaseController
$article = ArticleModel::find($id);
if(Request::isAjax()){
- $data = Request::only(['id','cate_id','title','title_color','user_id','content','upzip','keywords','description','captcha']);
+ $data = Request::only(['id','cate_id','title','title_color','read_type','art_pass','user_id','content','upzip','keywords','description','captcha']);
$data['user_id'] = $this->uid;
$tagId = input('tagid');
@@ -393,6 +409,8 @@ class Article extends BaseController
//删除原有缓存显示编辑后内容
Cache::delete('article_'.$id);
+ Session::delete('art_pass_'.$id);
+
$link = $this->getRouteUrl((int) $id, $article->cate->ename);
hook('SeoBaiduPush', ['link'=>$link]); // 推送给百度收录接口
@@ -618,49 +636,32 @@ class Article extends BaseController
}
- public function getCateTree()
- {
- //
- $cate = Db::name('cate')->order(['id' => 'ASC','sort' => 'ASC'])->where(['delete_time'=>0])->select()->toArray();
-
- $cateTree = array2tree($cate);
+ /**
+ * 分类树
+ * @return \think\response\Json
+ */
+ public function getCateTree()
+ {
+ $data = $this->showNav();
+ $count = count($data);
+ $tree = [];
+ if($count){
+ $tree = ['code'=>0, 'msg'=>'ok','count'=>$count];
+ $tree['data'] = $data;
+ }
- $count = count($cateTree);
- $tree = [];
- if($cateTree){
- $tree = ['code'=>0,'msg'=>'','count'=>$count];
-
- $res = []; //auth_rule储存数据表中的表结构
- foreach($cateTree as $k => $v){
- //第一层子权限
- $children = [];
- if(isset($v['children'])){
-
- foreach($v['children'] as $m => $j){
- //第二层子权限
- $chichi = [];
- if(isset($j['children'])){
- //第三层子权限
- foreach($j as $s){
- if(isset($s['children'])){
- $chichi[] = ['id'=>$s['id'],'catename'=>$s['catename'],'pid'=>$s['pid']]; //子数据的子数据
- }
- }
- }
-
- //if($j['level'] < 3){}
- $children[] = ['id'=>$j['id'],'catename'=>$j['catename'],'pid'=>$j['pid'],'children'=>$chichi]; //子数据
- }
- }
- $data[] = ['id'=>$v['id'],'catename'=>$v['catename'],'pid'=>$v['pid'],'children'=>$children];
- }
-
- //构造一个顶级菜单pid=0的数组。把权限放入顶级菜单下子权限中
- //$tree['data'][] = ['id'=>0,'catename'=>'顶级','pid'=>0,'children'=>$data];
- $tree['data'] = $data;
- }
- return json($tree);
- }
-
+ return json($tree);
+ }
+
+ public function jiemi()
+ {
+ $param = Request::param();
+ $article = $this->model->find($param['id']);
+ if($article['art_pass'] == $param['art_pass']) {
+ session('art_pass_'.$param['id'], $param['art_pass']);
+ return json(['code' => 0, 'msg' => '解密成功']);
+ }
+ return json(['code' => -1, 'msg' => '解密失败']);
+ }
}
\ No newline at end of file
diff --git a/app/index/controller/Comment.php b/app/index/controller/Comment.php
index 6984d03..1a4c7c8 100644
--- a/app/index/controller/Comment.php
+++ b/app/index/controller/Comment.php
@@ -2,12 +2,15 @@
namespace app\index\controller;
use app\common\controller\BaseController;
+use think\facade\View;
+use think\facade\Request;
use think\facade\Session;
use think\facade\Cache;
use app\common\model\Comment as CommentModel;
use app\common\model\Article;
use app\common\model\UserZan;
+
class Comment extends BaseController
{
//采纳评论
@@ -76,6 +79,24 @@ class Comment extends BaseController
}
return json($res);
}
+
+ //更新评论
+ public function edit()
+ {
+ if(Request::isAjax()) {
+ $param = Request::param();
+// halt($param);
+ $result = CommentModel::update($param);
+ if($result) {
+ return json(['code' => 0, 'msg' => '编辑成功']);
+ }
+ return json(['code' => 0, 'msg' => '编辑失败']);
+ }
+ $comms = CommentModel::find(input('id'));
+ View::assign(['comment' => $comms, 'jspage' => '']);
+ return View::fetch();
+
+ }
//评论点赞
public function jiedaZan()
diff --git a/app/index/route/route.php b/app/index/route/route.php
index faf047b..7c18ee6 100644
--- a/app/index/route/route.php
+++ b/app/index/route/route.php
@@ -50,6 +50,9 @@ Route::group(function () {
->middleware(\app\middleware\CheckRegister::class);
});
+// comment
+Route::rule('comment/edit/[:id]','comment/edit');
+
// article
Route::group('art',function () use($detail_as,$cate_as){
Route::rule('add/[:cate]','Article/add')->name('add_article');
diff --git a/config/taoler.php b/config/taoler.php
index 6ad2362..2f28173 100644
--- a/config/taoler.php
+++ b/config/taoler.php
@@ -16,7 +16,7 @@ return [
// 应用名,此项不可更改
'appname' => 'TaoLer',
// 版本配置
- 'version' => '2.2.9',
+ 'version' => '2.2.10',
// 加盐
'salt' => 'taoler',
// 数据库备份目录
diff --git a/public/static/res/mods/jie.js b/public/static/res/mods/jie.js
index 17fd17b..7c6d2b0 100644
--- a/public/static/res/mods/jie.js
+++ b/public/static/res/mods/jie.js
@@ -205,37 +205,36 @@ layui.define('fly', function(exports){
});
}
,edit: function(li){ //编辑评论
- fly.json(commentGetDa, {
- id: li.data('id')
- }, function(res){
- var data = res.rows;
- layer.prompt({
- formType: 2
- ,value: data.content
- ,maxlength: 100000
- ,title: '编辑回帖'
- ,area: ['738px', '310px']
- ,success: function(layero){
+ if(taonystatus == 0) {
- if(taonystatus == 0) {
- fly.layEditor({
- elem: layero.find('textarea')
- });
- } else {
- // 编辑器
+ fly.json(commentGetDa, {
+ id: li.data('id')
+ }, function (res) {
+ var data = res.rows;
+ layer.prompt({
+ formType: 2
+ , value: data.content
+ , maxlength: 100000
+ , title: '编辑回帖'
+ , area: ['738px', '310px']
+ , success: function (layero) {
+ fly.layEditor({
+ elem: layero.find('textarea')
+ });
}
- }
- }, function(value, index){
- fly.json(commentUpdateDa, {
- id: li.data('id')
- ,content: value
- }, function(res){
- layer.close(index);
- layer.msg(res.msg);
- li.find('.detail-body').html(fly.content(value));
+ }, function (value, index) {
+ fly.json(commentUpdateDa, {
+ id: li.data('id')
+ , content: value
+ }, function (res) {
+ layer.close(index);
+ layer.msg(res.msg);
+ li.find('.detail-body').html(fly.content(value));
+ });
});
});
- });
+ }
+
}
,del: function(li){ //删除评论
layer.confirm('确认删除该回答么?', function(index){
diff --git a/view/taoler/index/article/add.html b/view/taoler/index/article/add.html
index 3026174..f8c175d 100644
--- a/view/taoler/index/article/add.html
+++ b/view/taoler/index/article/add.html
@@ -39,33 +39,33 @@