Commit 1ad003fd by 孙龙

优化后台

parent 16161b5a
...@@ -26,6 +26,24 @@ class MessageApiController extends Controller ...@@ -26,6 +26,24 @@ class MessageApiController extends Controller
exit(); exit();
} }
//删除消息模板
public function deletetemplate($request){
$data = $request->input();
try{
$tid = isset($data['id']) && $data['id'] ? intval($data['id']) : 0 ;
$cnt = DB::connection('message');
$bk = $cnt->table('lie_msg_tpl')->where("tpl_id",$tid)->update(['status'=>-1]);
if($bk){
$this->Export(0, '');
}else{
throw new \Exception('操作失败');
}
}catch(\Exception $e){
$this->Export(1000, '操作失败');
}
}
//新增/编辑 消息模板 //新增/编辑 消息模板
private function addTemplate($request) private function addTemplate($request)
{ {
......
...@@ -184,6 +184,8 @@ class MessageController extends Controller ...@@ -184,6 +184,8 @@ class MessageController extends Controller
$template_create = $res_perm['template_create']; $template_create = $res_perm['template_create'];
$template_edit = $res_perm['template_edit']; $template_edit = $res_perm['template_edit'];
// $template_check = $template_create = $template_edit =true;
//搜索 //搜索
$search_desc = $request->input('search_desc'); $search_desc = $request->input('search_desc');
$search_channel = $request->input('search_channel'); $search_channel = $request->input('search_channel');
...@@ -194,7 +196,7 @@ class MessageController extends Controller ...@@ -194,7 +196,7 @@ class MessageController extends Controller
//1.首次进页面无搜索条件 //1.首次进页面无搜索条件
if($search_desc==null && $search_channel==null && $search_keyword == null) if($search_desc==null && $search_channel==null && $search_keyword == null)
{ {
$info = $cnt->table('lie_msg_tpl')->where('source_type','1')->orderBy('tpl_id','desc')->paginate(20); $info = $cnt->table('lie_msg_tpl')->where("status",'0')->where('source_type','1')->orderBy('tpl_id','desc')->paginate(20);
$search_channel = 0; $search_channel = 0;
$search_desc = ''; $search_desc = '';
}else//2.有搜索条件 }else//2.有搜索条件
...@@ -202,10 +204,10 @@ class MessageController extends Controller ...@@ -202,10 +204,10 @@ class MessageController extends Controller
//渠道里没有0,所以如果没选,将此条件剔除掉 //渠道里没有0,所以如果没选,将此条件剔除掉
if(0==$search_channel) if(0==$search_channel)
{ {
$info = $cnt->table('lie_msg_tpl')->where('source_type','1')->where('ex_str','like',"%$search_desc%")->where('description','like',"%$search_keyword%")->orderBy('tpl_id','desc')->paginate(20); $info = $cnt->table('lie_msg_tpl')->where('source_type','1')->where("status",'0')->where('ex_str','like',"%$search_desc%")->where('description','like',"%$search_keyword%")->orderBy('tpl_id','desc')->paginate(20);
}else }else
{ {
$info = $cnt->table('lie_msg_tpl')->where('source_type','1')->where('channels','like',"%$search_channel%")->where('description','like',"%$search_keyword%")->where('ex_str','like',"%$search_desc%")->orderBy('tpl_id','desc')->paginate(20); $info = $cnt->table('lie_msg_tpl')->where('source_type','1')->where("status",'0')->where('channels','like',"%$search_channel%")->where('description','like',"%$search_keyword%")->where('ex_str','like',"%$search_desc%")->orderBy('tpl_id','desc')->paginate(20);
} }
} }
...@@ -237,6 +239,7 @@ class MessageController extends Controller ...@@ -237,6 +239,7 @@ class MessageController extends Controller
'微信通知', '微信通知',
'钉钉通知' '钉钉通知'
]; ];
$data=[ $data=[
'title'=>'asd', 'title'=>'asd',
'id'=>$id, 'id'=>$id,
......
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
<IfModule deflate_module>
# 对js,html,xml,css,普通文本开启Gzip压缩
AddOutputFilterByType DEFLATE application/x-javascript text/html text/plain text/xml text/css
</IfModule>
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>资料管理后台 | 首页</title> <title>消息管理后台 | 首页</title>
{{--<script>document.domain="{{ Config::get('website.domain') }}";</script>--}} {{--<script>document.domain="{{ Config::get('website.domain') }}";</script>--}}
@include('table.css') @include('table.css')
......
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
<tr role="row"> <tr role="row">
<th style="width:100px;" class="text-center">模板编号</th> <th style="width:100px;" class="text-center">模板编号</th>
<th style="width:100px;" class="text-center">模板标题</th> <th style="width:100px;" class="text-center">模板标题</th>
<th style="width:100px;" class="text-center">关键字</th>
<th style="width:150px;" class="text-center">消息描述</th> <th style="width:150px;" class="text-center">消息描述</th>
<th style="width:100px;" class="text-center">消息渠道</th> <th style="width:100px;" class="text-center">消息渠道</th>
<th style="width:100px;" class="text-center">操作</th> <th style="width:100px;" class="text-center">操作</th>
...@@ -63,10 +64,16 @@ ...@@ -63,10 +64,16 @@
<tr role="row" style="text-align: center"> <tr role="row" style="text-align: center">
<td>{{ $info[$i]->tpl_id }}</td> <td>{{ $info[$i]->tpl_id }}</td>
<td>{{ $info[$i]->title }}</td> <td>{{ $info[$i]->title }}</td>
<td>{{ $info[$i]->description }}</td>
<td>{{ $info[$i]->ex_str }}</td> <td>{{ $info[$i]->ex_str }}</td>
<td>{{ $info[$i]->show_channels_str }}</td> <td>{{ $info[$i]->show_channels_str }}</td>
@if($template_edit) @if($template_edit)
<td><a href="{{url('message/addtemplate')}}?tpl_id={{$info[$i]->tpl_id}}" class="btn btn-xs btn-outline btn-primary">编辑</a></td> <td>
<a href="{{url('message/addtemplate')}}?tpl_id={{$info[$i]->tpl_id}}" class="btn btn-xs btn-outline btn-primary">编辑</a>
<a onclick="deletemlate({{$info[$i]->tpl_id}})" href="#" class="btn btn-xs btn-outline btn-primary">删除</a>
</td>
@endif @endif
</tr> </tr>
@endfor @endfor
...@@ -107,5 +114,26 @@ ...@@ -107,5 +114,26 @@
</div> </div>
</div> </div>
@endif @endif
<script src="/js/Message/layer/layer.js"></script>
<script>
var deletemplateurl = '{{url('msgapi/deletetemplate')}}';
function deletemlate(id){
layer.confirm('确定删除?', {
btn: ['确定','取消'] //按钮
}, function(){
$.post(deletemplateurl,{'id':id},function(res){
if(res.errcode == 0){
layer.msg('删除成功', {icon: 1});
window.location.reload();
}else{
layer.msg('删除失败', {icon: 1});
}
},'json');
}, function(){
});
}
</script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment