修复后台村民互动展示、审核等业务逻辑

This commit is contained in:
monanxiao 2023-03-22 10:32:00 +08:00
parent 22a9379d54
commit dd8d756149
4 changed files with 183 additions and 4 deletions

View File

@ -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, '找不到页面');
}
}
}
/**
* 查看信息
*/

View File

@ -28,7 +28,6 @@
<script type="text/html" id="barDemo">
<div class="layui-btn-group">
{if {:session('gougu_admin')['group_access']==1}
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
{/if}
<a class="layui-btn layui-btn-normal layui-btn-xs {{# if(d.status != '待审核'){ }}{{# } else { }}layui-hide{{# } }}" lay-event="read">查看</a>

View File

@ -0,0 +1,90 @@
{extend name="common/base"/}
{block name="style"}
<style type="text/css">
.editormd-code-toolbar select {
display: inline-block
}
.editormd li {
list-style: inherit;
}
.layui-td-gray{
width: 110px;
}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<form class="layui-form p-4">
<h3 class="pb-3">编辑</h3>
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray">话题标题<font>*</font></td>
<td colspan="6">
<textarea class="layui-textarea" name="title" disabled>{$detail.title}</textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">话题内容<font>*</font></td>
<td colspan="6">
<textarea class="layui-textarea" name="content" disabled>{$detail.content}</textarea>
</td>
</tr>
<tr>
<td class="layui-td-gray">状态<font>*</font></td>
<td colspan="6">
<input type="radio" name="status" value="1" title="通过" checked>
<input type="radio" name="status" value="-1" title="不通过" >
</td>
</tr>
<tr>
<td class="layui-td-gray">原因<font>*</font></td>
<td colspan="6">
<textarea class="layui-textarea" name="refusal" placeholder="请输入不通过原因"></textarea>
</td>
</tr>
</table>
<div class="pt-3">
<input type="hidden" name="id" value="{$detail.community_id}"/>
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
</div>
</form>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
var moduleInit = ['tool', 'tagpicker', 'tinymce'];
function gouguInit() {
var form = layui.form, tool = layui.tool, tagpicker = layui.tagpicker,laydate = layui.laydate;
//监听提交
form.on('submit(webform)', function (data) {
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
tool.sideClose(1000);
}
}
tool.post("/admin/nk.community/edit", data.field, callback);
return false;
});
//日期选择
laydate.render({
elem: '#formDate',
max: 7,
showBottom: false
});
}
</script>
{/block}
<!-- /脚本 -->

View File

@ -21,12 +21,21 @@
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
<span class="layui-btn layui-btn-sm" lay-event="add" data-title="添加内容">+ 添加内容</span>
<!-- <span class="layui-btn layui-btn-sm" lay-event="add" data-title="添加内容">+ 添加内容</span> -->
</div>
</script>
<script type="text/html" id="barDemo">
<div class="layui-btn-group"><a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="read">查看</a><a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a></div>
<div class="layui-btn-group">
<a class="layui-btn layui-btn-normal layui-btn-xs {{# if(d.status != 0){ }}{{# } else { }}layui-hide{{# } }}" lay-event="read">查看</a>
<a class="layui-btn layui-btn-xs {{# if(d.status == 0){ }}{{# } else { }}layui-hide{{# } }}" lay-event="edit">审核</a>
{if {:session('gougu_admin')['group_access']==1}
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
{/if}
</div>
</script>
{/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',