diff --git a/app/admin/controller/nk/Article.php b/app/admin/controller/nk/Article.php index dffa5ff..0117bae 100644 --- a/app/admin/controller/nk/Article.php +++ b/app/admin/controller/nk/Article.php @@ -71,7 +71,7 @@ class Article extends BaseController ->page($params['page']) ->limit($params['limit']) ->order('id desc') - ->field('id,title,user_id,county,township,village,image,view_time') + ->field('id,title,user_id,content,county,township,village,image,view_time') ->select(); $result = ['total' => $total, 'data' => $list]; diff --git a/app/admin/controller/nk/Feedback.php b/app/admin/controller/nk/Feedback.php index 53abfa9..9f259dd 100644 --- a/app/admin/controller/nk/Feedback.php +++ b/app/admin/controller/nk/Feedback.php @@ -34,11 +34,66 @@ class Feedback extends BaseController public function index() { if (request()->isAjax()) { - $params= get_params(); - $params['category_id']=$this->category_id; - (new Article())->index($params); + $params = get_params(); + $where[]= ['status','=',1]; + if (isset($params['keywords']) && !empty($params['keywords'])){ + $where[]=['title','like','%'.$params['keywords'].'%']; + } + if($this->adminInfo['position_id'] != 1){ //不是超级管理员 + $www['admin_id'] = $this->adminInfo['id']; + $user_address = Db::table('fa_szxc_information_useraddress')->where($www)->find(); + if ($user_address) { + if ($user_address['auth_range'] == 1) { + $where[]= ['county','=',$user_address['area_id']]; + $where[] =['township','=', $user_address['street_id']]; + $where[] =['village','=', $user_address['village_id']]; + } elseif ($user_address['auth_range'] == 2) { + $where[]= ['county','=',$user_address['area_id']]; + $where[] =['township','=', $user_address['street_id']]; + } + } + } + $category_id =$params['category_id']; + + if($category_id){ + $map[] = ['category_id','in',$category_id]; + }else{ + $map = []; + } + $total = Db::table('fa_article') + ->where($where) + ->where($map) + ->count(); + + $list = Db::table('fa_article') + ->withAttr('nickname',function ($value,$data){ + return Db::table('fa_szxc_information_usermsg')->where('user_id',$data['user_id'])->value('name'); + }) + ->withAttr('area',function ($value,$data){ + return Db::table('fa_geo_area')->where('area_code',$data['county'])->value('area_name'); + }) + ->withAttr('street',function ($value,$data){ + return Db::table('fa_geo_street')->where('street_code',$data['township'])->value('street_name'); + }) + ->withAttr('village',function ($value,$data){ + return Db::table('fa_geo_village')->where('village_id',$data['village'])->value('village_name'); + }) + ->where($where) + ->where($map) + ->page($params['page']) + ->limit($params['limit']) + ->order('id desc') + ->field('id,title,user_id,content,is_solve,county,township,village,image,view_time') + ->select(); + + $result = ['total' => $total, 'data' => $list]; + + return table_assign(0, '', $result); } - return view('nk/article/index',['url'=>$this->url]); + + View::assign('url', $this->url); + + return view(); } /** * 添加 @@ -76,12 +131,30 @@ class Feedback extends BaseController */ public function read() { - $params = get_params(); - (new Article())->read($params); + $param= get_params(); + $id = isset($param['id']) ? $param['id'] : 0; - return view('nk/article/read',['url'=>$this->url]); + $detail = Db::table('fa_article')->where('id',$id)->find(); + + if ($detail) { + + $detail['comment'] = Db::table('fa_article_comment') + ->where('vote_id',$id) + ->withAttr('user_info',function ($value,$data){ + return Db::table('fa_szxc_information_usermsg')->where('user_id', $data['user_id'])->value('name'); + }) + ->select(); + + View::assign('detail', $detail); + View::assign('admin_id', $this->adminInfo['id']); + return view(); + + }else{ + throw new \think\exception\HttpException(404, '找不到页面'); + } } + /** * 修改 */ diff --git a/app/admin/view/nk/feedback/add.html b/app/admin/view/nk/feedback/add.html new file mode 100644 index 0000000..597e2d3 --- /dev/null +++ b/app/admin/view/nk/feedback/add.html @@ -0,0 +1,221 @@ +{extend name="common/base"/} +{block name="style"} + +{/block} + +{block name="body"} +
+

新建文章

+ + + + + + {notempty name="is_vote"} + + + + + {/notempty} + + + + + + + + {if {:session('gougu_admin')['group_access']==1} + + + + + + + + + + + + + + + + + + + + {/if} + + + + + + + + + + +
文章标题*
结束时间* + +
文章摘要 + + 缩略图 +
+ +
+ + +
+
+
区县 +
+
+ +
+
+
街道/镇 +
+
+
+
+
+
村/社区 +
+
+
+
+
+
用户* +
+ +
+
文章内容
+ +
+
+ + +
+
+{/block} + + + +{block name="script"} + + +{/block} + \ No newline at end of file diff --git a/app/admin/view/nk/feedback/edit.html b/app/admin/view/nk/feedback/edit.html new file mode 100644 index 0000000..50555eb --- /dev/null +++ b/app/admin/view/nk/feedback/edit.html @@ -0,0 +1,240 @@ +{extend name="common/base"/} +{block name="style"} + +{/block} + +{block name="body"} +
+

编辑文章表

+ + + + + + {notempty name="is_vote"} + + + + + {/notempty} + + + + + + + + {if {:session('gougu_admin')['group_access']==1} + + + + + + + + + + + + + + + + + + + {/if} + + + + + + + +
文章标题*
结束时间* + +
摘要 + + 缩略图 +
+ +
+ + +
+
+
区县 +
+
+ +
+
+
街道/镇 +
+
+
+
+
+
村/社区 +
+
+
+
+
+
用户* +
+ +
+
文章内容
+ +
+
+ + + +
+
+{/block} + + + +{block name="script"} + + +{/block} + \ No newline at end of file diff --git a/app/admin/view/nk/feedback/index.html b/app/admin/view/nk/feedback/index.html new file mode 100644 index 0000000..d56a4c7 --- /dev/null +++ b/app/admin/view/nk/feedback/index.html @@ -0,0 +1,178 @@ +{extend name="common/base"/} + +{block name="body"} + +
+
+
+ +
+ +
+
+
+ + + + + + + + +{/block} + + + +{block name="script"} + +{/block} + \ No newline at end of file diff --git a/app/admin/view/nk/feedback/read.html b/app/admin/view/nk/feedback/read.html new file mode 100644 index 0000000..bf1495f --- /dev/null +++ b/app/admin/view/nk/feedback/read.html @@ -0,0 +1,87 @@ +{extend name="common/base"/} +{block name="style"} + +{/block} + +{block name="body"} +
+

诉求详情

+ + + + + + + + + + + + + + + + {if in_array($detail.category_id,[149,157,158,148,147,165]) } + + + + + {/if} + +{if $detail.is_solve == 0} + {if in_array($detail.category_id,[149,157,158,148,147,165]) } + + + + + {/if} + + +
诉求{$detail.title}
创建时间{$detail.view_time}
诉求内容 + {$detail.content|raw} +
回复内容: + {volist name="$detail.comment" id="vo"} + {$vo.user_info}的回复:{$vo.content}
+ {/volist} +
回复: + +
+ {if in_array($detail.category_id,[149,157,158,148,147,165]) } +
+ + + + +
+ {/if} + +{/if} +
+{/block} + + + +{block name="script"} + +{/block} + \ No newline at end of file