From a5acd6cb6e96785035cb87395bfa8b658afe9db9 Mon Sep 17 00:00:00 2001 From: taoser Date: Mon, 1 Apr 2024 10:22:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B8=96=E5=AD=90=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/BaseController.php | 16 +- app/admin/controller/content/Comment.php | 22 + app/admin/controller/content/Forum.php | 23 + app/admin/view/content/comment/index.html | 180 ++++-- app/admin/view/content/forum/index.html | 673 +++++++++++--------- app/admin/view/user/user/index.html | 2 +- app/admin/view/user/vip/index.html | 57 +- app/common/controller/BaseController.php | 4 +- app/common/model/Article.php | 4 +- app/common/taglib/Article.php | 6 + app/index/controller/Article.php | 32 +- app/index/controller/User.php | 39 +- config/taoler.php | 2 +- public/static/res/css/global.css | 10 +- view/taoler/index/article/ask/detail.html | 12 +- view/taoler/index/article/blog/detail.html | 2 +- view/taoler/index/article/news/detail.html | 2 +- view/taoler/index/article/posts/detail.html | 406 ++++++------ view/taoler/index/public/header.html | 38 +- view/taoler/index/public/menu.html | 95 +-- view/taoler/index/public/user.html | 4 +- view/taoler/index/user/home.html | 17 +- view/taoler/index/user/index.html | 2 +- 23 files changed, 909 insertions(+), 739 deletions(-) diff --git a/app/BaseController.php b/app/BaseController.php index 53eeb1d..083316e 100644 --- a/app/BaseController.php +++ b/app/BaseController.php @@ -45,6 +45,13 @@ abstract class BaseController */ protected $middleware = []; + /** + * article content + * + * @var string + */ + protected $content = ''; + /** * 构造方法 * @access public @@ -221,7 +228,7 @@ abstract class BaseController curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, false ); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30); + curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 60); $file = curl_exec($ch); curl_close($ch); return $this->saveAsImage($url, $file); @@ -265,8 +272,9 @@ abstract class BaseController //下载网络图片到本地并替换 public function downUrlPicsReaplace($content) { + $this->content = $content; // 批量下载网络图片并替换 - $images = $this->getArticleAllpic($content); + $images = $this->getArticleAllpic($this->content); if(count($images)) { foreach($images as $image){ //1.带http地址的图片,2.非本站的网络图片 3.非带有?号等参数的图片 @@ -275,13 +283,13 @@ abstract class BaseController //下载远程图片(可下载) $newImageUrl = $this->downloadImage($image); //替换图片链接 - $content = str_replace($image, Request::domain().$newImageUrl, $content); + $this->content = str_replace($image, Request::domain().$newImageUrl, $this->content); } } //不可下载的图片,如加密或者带有参数的图片如?type=jpeg,直接返回content } - return $content; + return $this->content; } /** diff --git a/app/admin/controller/content/Comment.php b/app/admin/controller/content/Comment.php index 0008f55..63b12e4 100644 --- a/app/admin/controller/content/Comment.php +++ b/app/admin/controller/content/Comment.php @@ -166,7 +166,29 @@ class Comment extends AdminController return json(['code'=>0,'msg'=>'评论被禁止','icon'=>5]); } return json(['code'=>-1,'msg'=>'审核出错']); + } + /** + * 多选批量审核 + * + * @return Json + */ + public function checkSelect() + { + $param = Request::param('data'); + $data = []; + foreach($param as $v) { + $data[] = ['id' => (int)$v['id'], 'status' => $v['check'] == '1' ? '-1' : '1']; + } + + //获取状态 + $res = $this->model->saveAll($data); + + if($res){ + return json(['code'=>0,'msg'=>'审核成功','icon'=>6]); + }else { + return json(['code'=>-1,'msg'=>'失败啦','icon'=>6]); + } } diff --git a/app/admin/controller/content/Forum.php b/app/admin/controller/content/Forum.php index 232040c..85297c4 100644 --- a/app/admin/controller/content/Forum.php +++ b/app/admin/controller/content/Forum.php @@ -277,6 +277,29 @@ class Forum extends AdminController } } + /** + * 多选批量审核 + * + * @return Json + */ + public function checkSelect() + { + $param = Request::param('data'); + $data = []; + foreach($param as $v) { + $data[] = ['id' => (int)$v['id'], 'status' => $v['check'] == '1' ? '-1' : '1']; + } + + //获取状态 + $res = $this->model->saveAll($data); + + if($res){ + return json(['code'=>0,'msg'=>'审核成功','icon'=>6]); + }else { + return json(['code'=>-1,'msg'=>'失败啦','icon'=>6]); + } + } + /** * 上传接口 * diff --git a/app/admin/view/content/comment/index.html b/app/admin/view/content/comment/index.html index 9d46b7b..fcb9ee9 100644 --- a/app/admin/view/content/comment/index.html +++ b/app/admin/view/content/comment/index.html @@ -5,74 +5,77 @@ 管理员管理 - -
-
-
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- - -
-
-
-
-
-
-
-
-
-
+ +
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ + +
+
+
+
+
+
+
+
+
+
- + - - + + - + @@ -125,7 +128,9 @@ window.refresh(); } else if (obj.event === 'batchRemove') { window.batchRemove(obj); - } + } else if (obj.event === 'checkSelect') { + window.checkSelect(obj); + } }); form.on('submit(comment-query)', function(data) { @@ -246,6 +251,53 @@ }); } + // 全选审核 + window.checkSelect = function(obj) { + var id = obj.config.id; + var checkStatus = table.checkStatus(id); + var data = checkStatus.data; + + if (data.length === 0) { + layer.msg("未选中数据", { + icon: 3, + time: 1000 + }); + return false; + } + + layer.confirm('确定要审核?', { + icon: 3, + title: '提示' + }, function(index) { + layer.close(index); + let loading = layer.load(); + console.log(data) + $.ajax({ + type: "post", + url: "{:url('content.comment/checkSelect')}", + dataType: 'json', + data: {data}, + success: function(result) { + layer.close(loading); + if (result.code === 0) { + layer.msg(result.msg, { + icon: 1, + time: 1000 + }, function() { + table.reload('comment-table'); + }); + } else { + layer.msg(result.msg, { + icon: 2, + time: 1000 + }); + } + } + }) + }); + } + + window.refresh = function(param) { table.reload('comment-table'); } diff --git a/app/admin/view/content/forum/index.html b/app/admin/view/content/forum/index.html index 61d96d0..f4850b8 100644 --- a/app/admin/view/content/forum/index.html +++ b/app/admin/view/content/forum/index.html @@ -5,339 +5,392 @@ 用户管理 - -
-
-
-
-
- -
-
-
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- - -
-
-
-
-
-
-
-
-
-
+ +
+
+
+
+
+ +
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ + +
+
+
+
+
+
+
+
+
+
- + - - - - - + + + + + - + - - + + - - + layer.confirm('确定要审核?', { + icon: 3, + title: '提示' + }, function(index) { + layer.close(index); + let loading = layer.load(); + console.log(data) + $.ajax({ + type: "post", + url: "{:url('content.forum/checkSelect')}", + dataType: 'json', + data: {data}, + success: function(result) { + layer.close(loading); + if (result.code === 0) { + layer.msg(result.msg, { + icon: 1, + time: 1000 + }, function() { + table.reload('forum-table'); + }); + } else { + layer.msg(result.msg, { + icon: 2, + time: 1000 + }); + } + } + }) + }); + } + + // 刷新 + window.refresh = function(param) { + table.reload('forum-table'); + } + + }); + + diff --git a/app/admin/view/user/user/index.html b/app/admin/view/user/user/index.html index 1eefd7a..f4facd1 100644 --- a/app/admin/view/user/user/index.html +++ b/app/admin/view/user/user/index.html @@ -81,7 +81,7 @@