From 3f385526a12572ee11a80dae285c4b8eadb0c42b Mon Sep 17 00:00:00 2001 From: liyukun <1099438829@qq.com> Date: Thu, 4 Nov 2021 00:02:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E7=95=99=E8=A8=80=E5=92=8C?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=96=87=E4=BB=B6=E7=95=99=E8=A8=80=E5=AE=A1?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/controller/Article.php | 53 ++++++ app/admin/controller/Message.php | 2 +- app/admin/view/article/comment.html | 267 ++++++++++++++++++++++++++++ app/admin/view/article/index.html | 3 +- app/admin/view/message/index.html | 8 +- app/common/model/Comment.php | 26 ++- app/common/model/MessageForm.php | 2 +- app/index/controller/Index.php | 2 +- 8 files changed, 354 insertions(+), 9 deletions(-) create mode 100644 app/admin/view/article/comment.html diff --git a/app/admin/controller/Article.php b/app/admin/controller/Article.php index 4d4c1bc..eed0dfa 100644 --- a/app/admin/controller/Article.php +++ b/app/admin/controller/Article.php @@ -5,6 +5,7 @@ namespace app\admin\controller; use app\common\model\Document as aModel; use app\common\model\DocumentCategory as cModel; use app\common\model\DocumentArticle; +use app\common\model\Comment as CommentModel; use app\Request; use app\admin\service\UtilService as Util; use think\Exception; @@ -203,4 +204,56 @@ class Article extends AuthController $this->assign("info",$info); return $this->fetch(); } + + /** + * 文章管理主页 + * @return string + * @throws \Exception + */ + public function comment($article_id ='') + { + return $this->fetch(); + } + + /** + * 文章评论列表 + * @return mixed + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + * @author 李玉坤 + * @date 2021-11-03 23:28 + */ + public function commentList() + { + $where = Util::postMore([ + ['document_id',''], + ['name',''], + ['tel',''], + ['email',''], + ['start_time',''], + ['end_time',''], + ['page',1], + ['limit',20], + ]); + if ($where['document_id'] == "") return app("json")->fail("参数错误"); + return app("json")->layui(CommentModel::systemPage($where)); + } + + + /** + * 修改字段 + * @param $id + * @return mixed + * @author 李玉坤 + * @date 2021-02-16 23:12 + */ + public function commentField($id) + { + if (!$id) return app("json")->fail("参数有误,Id为空!"); + $where = Util::postMore([['field',''],['value','']]); + if ($where['field'] == '' || $where['value'] =='') return app("json")->fail("参数有误!"); + return CommentModel::update([$where['field']=>$where['value']],['id'=>$id]) ? app("json")->success("操作成功") : app("json")->fail("操作失败"); + } + } \ No newline at end of file diff --git a/app/admin/controller/Message.php b/app/admin/controller/Message.php index caf5707..34aed63 100644 --- a/app/admin/controller/Message.php +++ b/app/admin/controller/Message.php @@ -49,7 +49,7 @@ class Message extends AuthController public function lst(Request $request) { $where = Util::postMore([ - ['name',''], + ['author',''], ['tel',''], ['email',''], ['start_time',''], diff --git a/app/admin/view/article/comment.html b/app/admin/view/article/comment.html new file mode 100644 index 0000000..6f14ead --- /dev/null +++ b/app/admin/view/article/comment.html @@ -0,0 +1,267 @@ + + + + 文章评论管理 - {:system_config("title")}后台管理系统 + {include file="public/header" /} + + +
+
+
+
+

搜索

+
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+ +
+ + ~ + +
+
+ +
+
+
+
+
+
+
+
+ 删除 +
+
+
+
+
+
+
+
+
+{include file="public/footer"/} + + + \ No newline at end of file diff --git a/app/admin/view/article/index.html b/app/admin/view/article/index.html index 66e923e..49e37c2 100644 --- a/app/admin/view/article/index.html +++ b/app/admin/view/article/index.html @@ -124,7 +124,8 @@ title: '操作', formatter:function (value,row,index) { let html ='\n' + - ''; + '\n'+ + '\n'; return html; }, events : { diff --git a/app/admin/view/message/index.html b/app/admin/view/message/index.html index 2c058df..f75cf5e 100644 --- a/app/admin/view/message/index.html +++ b/app/admin/view/message/index.html @@ -13,10 +13,10 @@
- +
- +
@@ -98,7 +98,7 @@ field: 'id', title: 'ID' },{ - field: 'name', + field: 'author', title: '姓名' }, { field: 'tel', @@ -123,7 +123,7 @@ let content = '
\n' + '
\n' + '
姓名:
\n' + - '
'+row.name+'
\n' + + '
'+row.author+'
\n' + '
\n' + '
\n' + '
联系方式:
\n' + diff --git a/app/common/model/Comment.php b/app/common/model/Comment.php index 87a8543..eec35d7 100644 --- a/app/common/model/Comment.php +++ b/app/common/model/Comment.php @@ -11,5 +11,29 @@ namespace app\common\model; */ class Comment extends BaseModel { - + /** + * 列表 + * @param $where + * @return array + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + * @author 李玉坤 + * @date 2021-02-15 23:24 + */ + public static function systemPage($where): array + { + $model = new self; + $model = $model->order('create_time','desc'); + if (isset($where['name']) && $where['name'] !== '') $model->where('name', "like", "%$where[name]%"); + if (isset($where['email']) && $where['email'] !== '') $model->where('email', "like", "%$where[email]%"); + if (isset($where['tel']) && $where['tel'] !== '') $model->where('tel', "like", "%$where[tel]%"); + if (isset($where['start_time']) && $where['start_time'] != '') $model = $model->where("m.created_at", ">", strtotime($where['start_time'] . " 00:00:00")); + if (isset($where['end_time']) && $where['end_time'] != '') $model = $model->where("m.created_at", "<", strtotime($where['end_time'] . " 23:59:59")); + $count = self::counts($model); + if ($where['page'] && $where['limit']) $model = $model->page((int)$where['page'],(int)$where['limit']); + $data = $model->select(); + if ($data) $data = $data->toArray(); + return compact('data','count'); + } } \ No newline at end of file diff --git a/app/common/model/MessageForm.php b/app/common/model/MessageForm.php index 0938701..06154dc 100644 --- a/app/common/model/MessageForm.php +++ b/app/common/model/MessageForm.php @@ -25,7 +25,7 @@ class MessageForm extends BaseModel { $model = new self; $model = $model->order('create_time','desc'); - if (isset($where['name']) && $where['name'] !== '') $model->where('name', "like", "%$where[name]%"); + if (isset($where['author']) && $where['author'] !== '') $model->where('author', "like", "%$where[name]%"); if (isset($where['email']) && $where['email'] !== '') $model->where('email', "like", "%$where[email]%"); if (isset($where['tel']) && $where['tel'] !== '') $model->where('tel', "like", "%$where[tel]%"); if (isset($where['start_time']) && $where['start_time'] != '') $model = $model->where("m.created_at", ">", strtotime($where['start_time'] . " 00:00:00")); diff --git a/app/index/controller/Index.php b/app/index/controller/Index.php index 5f45d7e..8d43a23 100644 --- a/app/index/controller/Index.php +++ b/app/index/controller/Index.php @@ -91,7 +91,7 @@ class Index extends Base { if(request()->isPost()){ $data = Util::postMore([ - ['name',''], + ['author',''], ['tel',''], ['email',''], ['content',''],