forum status
This commit is contained in:
parent
e5edb85b91
commit
f4c0fd4054
@ -22,14 +22,10 @@ class Forum extends AdminController
|
||||
if(Request::isAjax()){
|
||||
$data = Request::only(['id','name','title','sec']);
|
||||
$where =array();
|
||||
//var_dump($data);
|
||||
if (!empty($data['sec'])) {
|
||||
switch ($data['sec']) {
|
||||
case '0':
|
||||
$data['status'] = $data['sec'];
|
||||
break;
|
||||
case '1':
|
||||
$data['status'] = $data['sec'];
|
||||
$data['a.status'] = 1;
|
||||
break;
|
||||
case '2':
|
||||
$data['is_top'] = 1;
|
||||
@ -38,32 +34,32 @@ class Forum extends AdminController
|
||||
$data['is_hot'] = 1;
|
||||
break;
|
||||
case '4':
|
||||
$data['is_replay'] = 0;
|
||||
$data['is_reply'] = 0;
|
||||
break;
|
||||
case '5':
|
||||
$data['a.status'] = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
unset($data['sec']);
|
||||
}
|
||||
|
||||
unset($data['status']);
|
||||
|
||||
if(!empty($data['id'])){
|
||||
$data['a.id'] = $data['id'];
|
||||
unset($data['id']);
|
||||
}
|
||||
if(!empty($data['status'])){
|
||||
$data['a.status'] = $data['status'];
|
||||
unset($data['status']);
|
||||
}
|
||||
|
||||
if(!empty($data['title'])){
|
||||
$where[] = ['title', 'like', '%'.$data['title'].'%'];
|
||||
//var_dump($map);
|
||||
unset($data['title']);
|
||||
}
|
||||
|
||||
$map = array_filter($data);
|
||||
|
||||
$map = array_filter($data,[$this,"filtr"]);
|
||||
|
||||
$forumList = Db::name('article')
|
||||
->alias('a')
|
||||
->join('user u','a.user_id = u.id')
|
||||
->field('a.id as aid,name,user_img,title,a.update_time as update_time,is_top,is_hot,a.status as astatus')
|
||||
->field('a.id as aid,name,user_img,title,a.update_time as update_time,is_top,is_hot,is_reply,a.status as status')
|
||||
->where('a.delete_time',0)
|
||||
->where($map)
|
||||
->where($where)
|
||||
@ -76,7 +72,7 @@ class Forum extends AdminController
|
||||
$res['msg'] = '';
|
||||
$res['count'] = $count;
|
||||
foreach($forumList as $k=>$v){
|
||||
$res['data'][]= ['id'=>$v['aid'],'poster'=>$v['name'],'avatar'=>$v['user_img'],'content'=>$v['title'],'posttime'=>date("Y-m-d",$v['update_time']),'top'=>$v['is_top'],'hot'=>$v['is_hot'],'check'=>$v['astatus']];
|
||||
$res['data'][]= ['id'=>$v['aid'],'poster'=>$v['name'],'avatar'=>$v['user_img'],'content'=>$v['title'],'posttime'=>date("Y-m-d",$v['update_time']),'top'=>$v['is_top'],'hot'=>$v['is_hot'],'reply'=>$v['is_reply'],'check'=>$v['status']];
|
||||
}
|
||||
} else {
|
||||
$res = ['code'=>-1,'msg'=>'没有查询结果!'];
|
||||
|
@ -19,13 +19,14 @@ layui.define(['table', 'form'], function(exports){
|
||||
,url: '/admin/Forum/list' //帖子数据接口
|
||||
,cols: [[
|
||||
{type: 'checkbox', fixed: 'left'}
|
||||
,{field: 'id', width: 100, title: 'ID', sort: true}
|
||||
,{field: 'poster', title: '发帖人'}
|
||||
,{field: 'avatar', title: '头像', width: 100, templet: '#imgTpl'}
|
||||
,{field: 'content', title: '发帖内容',templet: '#title'}
|
||||
,{field: 'posttime', title: '发帖时间', sort: true}
|
||||
,{field: 'id', width: 55, title: 'ID', sort: true}
|
||||
,{field: 'poster', title: '贴主'}
|
||||
,{field: 'avatar', title: '头像', width: 100, templet: '#imgTpl', align: 'center'}
|
||||
,{field: 'content', title: '标题', width: 200,templet: '#title'}
|
||||
,{field: 'posttime', title: '时间', sort: true}
|
||||
,{field: 'top', title: '置顶', templet: '#buttonTpl', minWidth: 80, align: 'center'}
|
||||
,{field: 'hot', title: '精贴', templet: '#buttonHot', minWidth: 80, align: 'center'}
|
||||
,{field: 'reply', title: '评论状态', templet: '#buttonReply', minWidth: 80, align: 'center'}
|
||||
,{field: 'check', title: '审帖', templet: '#buttonCheck', minWidth: 80, align: 'center'}
|
||||
,{title: '操作', width: 150, align: 'center', fixed: 'right', toolbar: '#table-forum-list'}
|
||||
]]
|
||||
|
@ -31,9 +31,8 @@
|
||||
<option value="1">正常</option>
|
||||
<option value="2">置顶</option>
|
||||
<option value="3">热门</option>
|
||||
<option value="4">禁回</option>
|
||||
<option value="0">封禁</option>
|
||||
|
||||
<option value="4">禁评</option>
|
||||
<option value="5">封禁</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@ -69,7 +68,14 @@
|
||||
{{# } else { }}
|
||||
<button class="layui-btn layui-btn-primary layui-btn-xs">正常</button>
|
||||
{{# } }}
|
||||
</script>
|
||||
</script>
|
||||
<script type="text/html" id="buttonReply">
|
||||
{{# if(d.reply == 1){ }}
|
||||
<button class="layui-btn layui-btn-primary layui-btn-xs">正常</button>
|
||||
{{# } else { }}
|
||||
<button class="layui-btn layui-btn-xs">禁评</button>
|
||||
{{# } }}
|
||||
</script>
|
||||
<script type="text/html" id="buttonCheck">
|
||||
{if condition="checkRuleButton('admin/forum/check')"}<input type="checkbox" name="check" lay-skin="switch" lay-filter="forumcheck" lay-text="正常|封禁" {{# if(d.check == 1){ }} checked {{# } }} id="{{d.id}}" >{else}<button class="layui-btn layui-btn-xs layui-btn-radius layui-btn-disabled">无审核权</button>{/if}
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user