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',