From a22aea37e85904d8e79b4d991cf05bef949a202a Mon Sep 17 00:00:00 2001 From: monanxiao Date: Wed, 22 Mar 2023 10:32:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=90=8E=E5=8F=B0=E6=9D=91?= =?UTF-8?q?=E6=B0=91=E4=BA=92=E5=8A=A8=E5=B1=95=E7=A4=BA=E3=80=81=E5=AE=A1?= =?UTF-8?q?=E6=A0=B8=E7=AD=89=E4=B8=9A=E5=8A=A1=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/controller/nk/Community.php | 45 ++++++++++++- app/admin/view/nk/comment/index.html | 1 - app/admin/view/nk/community/edit.html | 90 ++++++++++++++++++++++++++ app/admin/view/nk/community/index.html | 51 ++++++++++++++- 4 files changed, 183 insertions(+), 4 deletions(-) create mode 100644 app/admin/view/nk/community/edit.html diff --git a/app/admin/controller/nk/Community.php b/app/admin/controller/nk/Community.php index 935782e..5d2675a 100644 --- a/app/admin/controller/nk/Community.php +++ b/app/admin/controller/nk/Community.php @@ -29,6 +29,8 @@ class Community extends BaseController '/admin/nk.community/del', '/admin/nk.community/read', ]; + // 获取用户信息 + $this->users = Db::table('fa_szxc_information_usermsg')->where('status',1)->field('user_id,name')->select(); } /** * 数据列表 @@ -70,7 +72,7 @@ class Community extends BaseController foreach ($list as $k=>$v){ $arr[]=$v['community_id']; } - $list2=Db::connect('shop')->name('community')->where('community_id','in',$arr)->select(); + $list2=Db::connect('shop')->name('community')->where('community_id','in',$arr)->order('community_id desc')->select(); }else{ $list2=[]; } @@ -84,6 +86,47 @@ class Community extends BaseController } + public function edit(){ + + $param = get_params(); + if (request()->isAjax()) { + + $is_show = $param['status'] == 1 ? 1 : 0; + $data = [ + 'refusal' => $param['refusal'], + 'status' => $param['status'], + 'is_show' => $is_show, + ]; + + $res = Db::connect('shop')->name('community') + ->where('community_id', $param['id']) + ->strict(false) + ->update($data); + + if ($res){ + return to_assign(0, '操作成功'); + }else{ + return to_assign(1, '操作失败,原因:'.$res); + } + + }else{ + + $id = isset($param['id']) ? $param['id'] : 0; + $detail = Db::connect('shop')->name('community')->where('community_id',$id)->find(); + View::assign('editor', get_system_config('other','editor')); + + if (!empty($detail)) { + View::assign('detail', $detail); + View::assign('users', $this->users); + + return view(); + } + else{ + throw new \think\exception\HttpException(404, '找不到页面'); + } + } + } + /** * 查看信息 */ diff --git a/app/admin/view/nk/comment/index.html b/app/admin/view/nk/comment/index.html index dce5d9a..4c8d358 100644 --- a/app/admin/view/nk/comment/index.html +++ b/app/admin/view/nk/comment/index.html @@ -28,7 +28,6 @@ +{/block} + \ No newline at end of file diff --git a/app/admin/view/nk/community/index.html b/app/admin/view/nk/community/index.html index 8ff064d..bab67bc 100644 --- a/app/admin/view/nk/community/index.html +++ b/app/admin/view/nk/community/index.html @@ -21,12 +21,21 @@ {/block} @@ -56,6 +65,44 @@ },{ field: 'title', title: '标题', + },{ + field: 'content', + title: '内容', + },{ + field: 'status', + title: '状态', + templet: function (d) + { + switch (d.status) { + case 0: + + return '待审核'; + break; + case 1: + + return '审核通过'; + break; + case -1: + + return '不通过,原因:' + d.refusal; + break; + } + } + },{ + field: 'is_show', + title: '显示状态', + templet: function (d) + { + switch (d.is_show) { + case 0: + return '不显示'; + break; + case 1: + + return '显示'; + break; + } + } },{ fixed: 'right', field: 'right',