Commit 21e6707a by 李洋

所有历史消息

parent 915e5bdd
...@@ -304,7 +304,6 @@ class MessageController extends Controller ...@@ -304,7 +304,6 @@ class MessageController extends Controller
// 所有历史消息 // 所有历史消息
private function allhistorylist(Request $request, $id, $viewid) private function allhistorylist(Request $request, $id, $viewid)
{ {
Csrf($request);
$perms_arr = ['allhistorylist_check']; $perms_arr = ['allhistorylist_check'];
$res_perm = $this->getUserPerms($request,$perms_arr); $res_perm = $this->getUserPerms($request,$perms_arr);
$allhistorylist_check = $res_perm['allhistorylist_check']; $allhistorylist_check = $res_perm['allhistorylist_check'];
...@@ -313,7 +312,9 @@ class MessageController extends Controller ...@@ -313,7 +312,9 @@ class MessageController extends Controller
if(!empty($conditions['page']) && !empty($conditions['limit'])){ if(!empty($conditions['page']) && !empty($conditions['limit'])){
$items = DB::connection('message')->table('lie_msg_log as ml') $items = DB::connection('message')->table('lie_msg_log as ml')
->leftjoin('lie_msg_tpl as mt','ml.tpl_id','=','mt.tpl_id') ->leftjoin('lie_msg_tpl as mt','ml.tpl_id','=','mt.tpl_id')
->select('ml.log_id','ml.status','ml.obj_user','ml.source_type','ml.tpl_id','ml.channel_type','ml.create_time','ml.expect_send_time','ml.actual_send_time','ml.title','ml.content','ml.wechat_tpl_id','mt.ex_str') ->leftjoin('lie_msg_tpl_sub_classify as mtsc','mtsc.sub_cls_id','=','mt.sub_cls_id')
->leftjoin('lie_msg_tpl_classify as mtc','mtc.cls_id','=','mtsc.cls_id')
->select('ml.log_id','ml.status','ml.obj_user','ml.source_type','ml.tpl_id','ml.channel_type','ml.create_time','ml.expect_send_time','ml.actual_send_time','ml.title','ml.content','ml.wechat_tpl_id','mt.ex_str','mtc.cls_name','mtsc.sub_cls_name','mtsc.sub_cls_id','mtsc.cls_id')
->where(function($query) use($conditions){ ->where(function($query) use($conditions){
if(!empty($conditions['msg_tpl_desc'])) if(!empty($conditions['msg_tpl_desc']))
{ {
...@@ -339,6 +340,12 @@ class MessageController extends Controller ...@@ -339,6 +340,12 @@ class MessageController extends Controller
{ {
$query->where('ml.status',$conditions['msg_status']); $query->where('ml.status',$conditions['msg_status']);
} }
if (!empty($conditions['msg_tpl_cls'])){
$query->where('mtsc.cls_id',$conditions['msg_tpl_cls']);
}
if (!empty($conditions['msg_tpl_sub_cls'])){
$query->where('mtsc.sub_cls_id',$conditions['msg_tpl_sub_cls']);
}
}) })
// ->groupBy('ml.log_id') //todo:这里要改一下 想下怎么改 用mysql作groupby+分页 // ->groupBy('ml.log_id') //todo:这里要改一下 想下怎么改 用mysql作groupby+分页
->orderBy('ml.log_id','desc') ->orderBy('ml.log_id','desc')
...@@ -351,15 +358,27 @@ class MessageController extends Controller ...@@ -351,15 +358,27 @@ class MessageController extends Controller
$item['status_str'] = Config('msgconfig.msg_status')[$item['status']]; $item['status_str'] = Config('msgconfig.msg_status')[$item['status']];
$item['channel_type_str'] = Config('msgconfig.msg_channels')[$item['channel_type']]; $item['channel_type_str'] = Config('msgconfig.msg_channels')[$item['channel_type']];
$item['msg_tpl_str'] = $item['ex_str']; $item['msg_tpl_str'] = $item['ex_str'];
$item['cls_name'] = !empty($item['cls_name'])?$item['cls_name']:'' ;
$item['sub_cls_name'] = !empty($item['sub_cls_name'])?$item['sub_cls_name']:'' ;
} }
unset($item); unset($item);
return json_encode(['code'=>0,'count'=>$items['total'],'msg'=>'success','data'=>$items['data']]); return json_encode(['code'=>0,'count'=>$items['total'],'msg'=>'success','data'=>$items['data']]);
} }
//消息模板分类
$clses = [];
$cls = DB::connection('message')->table('lie_msg_tpl_classify')->select('cls_id','cls_name')->get();
foreach ($cls as &$c){
$c = objectToArray($c);
$clses[$c['cls_id']] = $c['cls_name'];
}
unset($c);
$data=[ $data=[
'title'=>'asd', 'title'=>'asd',
'id'=>$id, 'id'=>$id,
'info'=>[], 'info'=>[],
'clses'=>$clses,
'allhistorylist_check'=>$allhistorylist_check 'allhistorylist_check'=>$allhistorylist_check
]; ];
......
//选择定时推送时间 //选择定时推送时间
layui.use(['laydate','form','table'], function(){ layui.use(['laydate','form','table'], function(){
var $ = layui.$;
var laydate = layui.laydate; var laydate = layui.laydate;
var form = layui.form; var form = layui.form;
var table = layui.table; var table = layui.table;
...@@ -37,16 +38,39 @@ layui.use(['laydate','form','table'], function(){ ...@@ -37,16 +38,39 @@ layui.use(['laydate','form','table'], function(){
limit: 20, limit: 20,
id:'table', id:'table',
cols: [[ //表头 cols: [[ //表头
{field: 'log_id', title: '消息编号',align:'center'}, {field: 'log_id', title: '消息编号',align:'center',width:100},
{field: 'msg_tpl_str', title: '消息模板',align:'center',width:150}, {field: 'msg_tpl_str', title: '消息模板',align:'center',width:150},
{field: 'title', title: '消息标题',align:'center'}, {field: 'title', title: '消息标题',align:'center',width:150},
{field: 'content', title: '消息内容',align:'center'}, {field: 'content', title: '消息内容',align:'center',width:150},
{field: 'channel_type_str', title: '消息渠道',align:'center'}, {field: 'cls_name', title: '模板分类',align:'center',width:150},
{field: 'obj_user', title: '推送目标',align:'center'}, {field: 'sub_cls_name', title: '模板二级分类',align:'center',width:150},
{field: 'create_time_str', title: '创建时间',align:'center',width:130}, {field: 'channel_type_str', title: '消息渠道',align:'center',width:150},
{field: 'actual_send_time_str', title: '推送时间',align:'center',width:130}, {field: 'obj_user', title: '推送目标',align:'center',width:150},
{field: 'status_str', title: '推送状态',align:'center'} {field: 'create_time_str', title: '创建时间',align:'center',width:180},
{field: 'actual_send_time_str', title: '推送时间',align:'center',width:180},
{field: 'status_str', title: '推送状态',align:'center',width:150, fixed:'right'}
]] ]]
}); });
//监听模板分类选择 并刷新二级分类数据
form.on('select(msg_tpl_cls)', function(data){
var sel_msg_tpl_cls = data.value;
$.ajax({
url: "/msgapi/getSubTplCls",
dataType: 'json',
data: {
sel_msg_tpl_cls: sel_msg_tpl_cls
},
success: function (result) {
var optionstring = "";
$.each(result.data, function(i,item){
optionstring += "<option value=" + item.sub_cls_id + ">" + item.sub_cls_name + "</option>";
});
$("#msg_tpl_sub_cls").html('<option value=""></option>' + optionstring);
form.render('select');
}
});
});
form.render(); form.render();
}); });
\ No newline at end of file
<style> <style>
.filter-label-left{ .filter-label-left{
width: 90px; width: 120px;
text-align: left; text-align: left;
} }
.first-label{ .first-label{
margin-left: 20px; margin-left: 20px;
margin-top: 20px; margin-top: 20px;
} }
.filter-select{
margin-top: 20px;
width: 150px;
}
</style> </style>
@if($allhistorylist_check) @if($allhistorylist_check)
...@@ -36,10 +40,11 @@ ...@@ -36,10 +40,11 @@
</div> </div>
</div> </div>
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item">
<div class="layui-inline"> <div class="layui-inline">
<label class="layui-form-label filter-label-left first-label">消息状态:</label> <label class="layui-form-label filter-label-left first-label">消息状态:</label>
<div class="layui-input-inline" style="width: 150px; margin-top: 20px;"> <div class="layui-input-inline filter-select">
<select name="msg_status" lay-filter="msg_status"> <select name="msg_status" lay-filter="msg_status">
<option value="" selected="">请选择</option> <option value="" selected="">请选择</option>
@foreach(Config('msgconfig.msg_status') as $k=>$v) @foreach(Config('msgconfig.msg_status') as $k=>$v)
...@@ -59,9 +64,33 @@ ...@@ -59,9 +64,33 @@
<input type="text" class="layui-input" name="end_time" id="end_time" autocomplete="off"> <input type="text" class="layui-input" name="end_time" id="end_time" autocomplete="off">
</div> </div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label filter-label-left first-label">消息模板分类:</label>
<div class="layui-input-inline filter-select">
<select name="msg_tpl_cls" lay-filter="msg_tpl_cls" id="msg_tpl_cls">
<option value="">请选择</option>
@foreach($clses as $k=>$v)
<option value="{{$k}}">{{$v}}</option>
@endforeach
</select>
</div>
<label class="layui-form-label filter-label-left first-label">消息模板二级分类:</label>
<div class="layui-input-inline filter-select">
<select name="msg_tpl_sub_cls" lay-filter="msg_tpl_sub_cls" id="msg_tpl_sub_cls">
<option value="">请选择</option>
</select>
</div>
<div class="layui-input-inline" style="margin-top: 20px; float: right;"> <div class="layui-input-inline" style="margin-top: 20px; float: right;">
<button class="layui-btn" lay-submit lay-filter="search" data-type="reload">查询</button> <button class="layui-btn" lay-submit lay-filter="search" data-type="reload">查询</button>
</div> </div>
</div> </div>
</div> </div>
......
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