Commit 86ebc545 by 李洋

微信

parent e91bb604
...@@ -193,6 +193,11 @@ class MessageApiController extends Controller ...@@ -193,6 +193,11 @@ class MessageApiController extends Controller
$chn_tpl_model_wechatnotify['channel_type'] = $data['wechat_notify_channel_type']; $chn_tpl_model_wechatnotify['channel_type'] = $data['wechat_notify_channel_type'];
$chn_tpl_model_wechatnotify['title'] = $data['wechat_notify_title']; $chn_tpl_model_wechatnotify['title'] = $data['wechat_notify_title'];
$chn_tpl_model_wechatnotify['tpl_id'] = $insert_tpl_id; $chn_tpl_model_wechatnotify['tpl_id'] = $insert_tpl_id;
$chn_tpl_model_wechatnotify['url'] = $data['wechat_notify_url'];
$wechat_head = $data['wechat_notify_head'];
$wechat_tail = $data['wechat_notify_tail'];
$wechat_content = json_encode(array('wechat_tpl_head'=>$wechat_head,'wechat_tpl_tail'=>$wechat_tail));
$chn_tpl_model_wechatnotify['content'] = $wechat_content;
if (empty($chn_tpl_model_wechatnotify['channel_tpl_id'])) { if (empty($chn_tpl_model_wechatnotify['channel_tpl_id'])) {
$chn_tpl_model_wechatnotify['create_time'] = time(); $chn_tpl_model_wechatnotify['create_time'] = time();
$chn_tpl_model_wechatnotify['update_time'] = time(); $chn_tpl_model_wechatnotify['update_time'] = time();
...@@ -251,9 +256,15 @@ class MessageApiController extends Controller ...@@ -251,9 +256,15 @@ class MessageApiController extends Controller
$params['content_2'] = $data['content_2']; $params['content_2'] = $data['content_2'];
$params['content_3'] = $data['content_3']; $params['content_3'] = $data['content_3'];
$params['op_type'] = $data['op_type']; $params['op_type'] = $data['op_type'];
$params['url'] = $data['url']; $params['url_1'] = $data['url_1'];
$params['obj_user'] = $data['obj_user']; $params['obj_user'] = $data['obj_user'];
$params['wechat_tpl_id'] = $data['wechat_tpl_id']; $params['title_4'] = $data['title_4'];
$params['url_4'] = $data['url_4'];
$wechat_head = $data['wechat_notify_head'];
$wechat_tail = $data['wechat_notify_tail'];
$wechat_content = json_encode(array('wechat_tpl_head'=>$wechat_head,'wechat_tpl_tail'=>$wechat_tail));
$params['content_4'] = $wechat_content;
$params['expect_send_time'] = $data['expect_send_time']; $params['expect_send_time'] = $data['expect_send_time'];
//csrf //csrf
$check['k1'] = time(); $check['k1'] = time();
......
...@@ -191,7 +191,7 @@ class MessageController extends Controller ...@@ -191,7 +191,7 @@ class MessageController extends Controller
//1.首次进页面无搜索条件 //1.首次进页面无搜索条件
if($search_desc==null && $search_channel==null) if($search_desc==null && $search_channel==null)
{ {
$info = $cnt->table('lie_msg_tpl')->where('source_type','1')->paginate(20); $info = $cnt->table('lie_msg_tpl')->where('source_type','1')->orderBy('tpl_id','desc')->paginate(20);
$search_channel = 0; $search_channel = 0;
$search_desc = ''; $search_desc = '';
}else//2.有搜索条件 }else//2.有搜索条件
...@@ -199,10 +199,10 @@ class MessageController extends Controller ...@@ -199,10 +199,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('description','like',"%$search_desc%")->paginate(20); $info = $cnt->table('lie_msg_tpl')->where('source_type','1')->where('description','like',"%$search_desc%")->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_desc%")->paginate(20); $info = $cnt->table('lie_msg_tpl')->where('source_type','1')->where('channels','like',"%$search_channel%")->where('description','like',"%$search_desc%")->orderBy('tpl_id','desc')->paginate(20);
} }
} }
...@@ -269,7 +269,7 @@ class MessageController extends Controller ...@@ -269,7 +269,7 @@ class MessageController extends Controller
//1.首次进页面无搜索条件 //1.首次进页面无搜索条件
if(null==$search_desc && null==$search_channel && null==$search_sendtime_start && null==$search_sendtime_end) if(null==$search_desc && null==$search_channel && null==$search_sendtime_start && null==$search_sendtime_end)
{ {
$info = $db->table('lie_msg_log')->groupBy('tpl_id')->having('source_type','=',2)->get(); $info = $db->table('lie_msg_log')->groupBy('tpl_id')->having('source_type','=',2)->orderBy('log_id','desc')->get();
$search_channel = 0; $search_channel = 0;
$search_desc = ''; $search_desc = '';
$search_sendtime_start = ''; $search_sendtime_start = '';
...@@ -293,14 +293,14 @@ class MessageController extends Controller ...@@ -293,14 +293,14 @@ class MessageController extends Controller
$info = $db->table('lie_msg_log')->groupBy('lie_msg_log.tpl_id')->having('lie_msg_log.source_type','=',2) $info = $db->table('lie_msg_log')->groupBy('lie_msg_log.tpl_id')->having('lie_msg_log.source_type','=',2)
->whereBetween('lie_msg_log.actual_send_time',[$start_time,$end_time]) ->whereBetween('lie_msg_log.actual_send_time',[$start_time,$end_time])
->join('lie_msg_tpl','lie_msg_log.tpl_id','=','lie_msg_tpl.tpl_id') ->join('lie_msg_tpl','lie_msg_log.tpl_id','=','lie_msg_tpl.tpl_id')
->where('lie_msg_tpl.description','like',"%$search_desc%")->get(); ->where('lie_msg_tpl.description','like',"%$search_desc%")->orderBy('log_id','desc')->get();
}else }else
{ {
$info = $db->table('lie_msg_log')->groupBy('lie_msg_log.tpl_id')->having('lie_msg_log.source_type','=',2) $info = $db->table('lie_msg_log')->groupBy('lie_msg_log.tpl_id')->having('lie_msg_log.source_type','=',2)
->join('lie_msg_tpl','lie_msg_log.tpl_id','=','lie_msg_tpl.tpl_id') ->join('lie_msg_tpl','lie_msg_log.tpl_id','=','lie_msg_tpl.tpl_id')
->whereBetween('lie_msg_log.actual_send_time',[$start_time,$end_time]) ->whereBetween('lie_msg_log.actual_send_time',[$start_time,$end_time])
->where('lie_msg_tpl.channels','like',"%$search_channel%") ->where('lie_msg_tpl.channels','like',"%$search_channel%")
->where('lie_msg_tpl.description','like',"%$search_desc%")->get(); ->where('lie_msg_tpl.description','like',"%$search_desc%")->orderBy('log_id','desc')->get();
} }
} }
...@@ -372,7 +372,7 @@ class MessageController extends Controller ...@@ -372,7 +372,7 @@ class MessageController extends Controller
$db = DB::connection('message'); $db = DB::connection('message');
if($search_id==null && $search_user==null && $search_sendtime_start==null && $search_sendtime_end==null && $search_channel==null && $search_status==null) if($search_id==null && $search_user==null && $search_sendtime_start==null && $search_sendtime_end==null && $search_channel==null && $search_status==null)
{ {
$info = $db->table('lie_msg_log')->paginate(20); $info = $db->table('lie_msg_log')->orderBy('log_id','desc')->paginate(20);
$search_id = ''; $search_id = '';
$search_user = ''; $search_user = '';
$search_sendtime_start = ''; $search_sendtime_start = '';
...@@ -398,24 +398,24 @@ class MessageController extends Controller ...@@ -398,24 +398,24 @@ class MessageController extends Controller
$info = $db->table('lie_msg_log') $info = $db->table('lie_msg_log')
->where('log_id','like',"%$search_id%")->where('obj_user','like',"%$search_user%") ->where('log_id','like',"%$search_id%")->where('obj_user','like',"%$search_user%")
->whereBetween('actual_send_time',[$start_time,$end_time]) ->whereBetween('actual_send_time',[$start_time,$end_time])
->where('status',$search_status)->paginate(20); ->where('status',$search_status)->orderBy('log_id','desc')->paginate(20);
}elseif($search_channel!=0 && $search_status==0) }elseif($search_channel!=0 && $search_status==0)
{ {
$info = $db->table('lie_msg_log') $info = $db->table('lie_msg_log')
->where('log_id','like',"%$search_id%")->where('obj_user','like',"%$search_user%") ->where('log_id','like',"%$search_id%")->where('obj_user','like',"%$search_user%")
->whereBetween('actual_send_time',[$start_time,$end_time])->where('channel_type',$search_channel) ->whereBetween('actual_send_time',[$start_time,$end_time])->where('channel_type',$search_channel)
->paginate(20); ->orderBy('log_id','desc')->paginate(20);
}elseif($search_channel==0 && $search_status==0) }elseif($search_channel==0 && $search_status==0)
{ {
$info = $db->table('lie_msg_log') $info = $db->table('lie_msg_log')
->where('log_id','like',"%$search_id%")->where('obj_user','like',"%$search_user%") ->where('log_id','like',"%$search_id%")->where('obj_user','like',"%$search_user%")
->whereBetween('actual_send_time',[$start_time,$end_time])->paginate(20); ->whereBetween('actual_send_time',[$start_time,$end_time])->orderBy('log_id','desc')->paginate(20);
}else }else
{ {
$info = $db->table('lie_msg_log') $info = $db->table('lie_msg_log')
->where('log_id','like',"%$search_id%")->where('obj_user','like',"%$search_user%") ->where('log_id','like',"%$search_id%")->where('obj_user','like',"%$search_user%")
->whereBetween('actual_send_time',[$start_time,$end_time])->where('channel_type',$search_channel) ->whereBetween('actual_send_time',[$start_time,$end_time])->where('channel_type',$search_channel)
->where('status',$search_status)->paginate(20); ->where('status',$search_status)->orderBy('log_id','desc')->paginate(20);
} }
} }
...@@ -478,7 +478,7 @@ class MessageController extends Controller ...@@ -478,7 +478,7 @@ class MessageController extends Controller
foreach ($tpl_channels_arr as $channel_type) foreach ($tpl_channels_arr as $channel_type)
{ {
$channel_tpl_obj = $db->table('lie_msg_channel_tpl')->where('tpl_id',$info->tpl_id)->where('channel_type',$channel_type)->first(); $channel_tpl_obj = $db->table('lie_msg_channel_tpl')->where('tpl_id',$info->tpl_id)->where('channel_type',$channel_type)->first();
$channel_tpls[$channel_type] = $channel_tpl_obj;
//将channel_tpl_id赋给正确的变量中 //将channel_tpl_id赋给正确的变量中
if($channel_type==1) if($channel_type==1)
{ {
...@@ -492,7 +492,10 @@ class MessageController extends Controller ...@@ -492,7 +492,10 @@ class MessageController extends Controller
}elseif($channel_type==4) }elseif($channel_type==4)
{ {
$wechatNotify_chn_tpl_id = $channel_tpl_obj->channel_tpl_id; $wechatNotify_chn_tpl_id = $channel_tpl_obj->channel_tpl_id;
//将head 和 tail从content中解析出来
$channel_tpl_obj->content = json_decode($channel_tpl_obj->content,true);
} }
$channel_tpls[$channel_type] = $channel_tpl_obj;
} }
$info->channel_tpls = $channel_tpls; $info->channel_tpls = $channel_tpls;
...@@ -598,6 +601,11 @@ class MessageController extends Controller ...@@ -598,6 +601,11 @@ class MessageController extends Controller
foreach ($tpl_channels_arr as $channel_type) foreach ($tpl_channels_arr as $channel_type)
{ {
$channel_tpl_obj = $db->table('lie_msg_channel_tpl')->where('tpl_id',$info->tpl_id)->where('channel_type',$channel_type)->first(); $channel_tpl_obj = $db->table('lie_msg_channel_tpl')->where('tpl_id',$info->tpl_id)->where('channel_type',$channel_type)->first();
if($channel_type==4)
{
//将head 和 tail从content中解析出来
$channel_tpl_obj->content = json_decode($channel_tpl_obj->content,true);
}
$channel_tpls[$channel_type] = $channel_tpl_obj; $channel_tpls[$channel_type] = $channel_tpl_obj;
} }
$info->channel_tpls = $channel_tpls; $info->channel_tpls = $channel_tpls;
......
$('#msg_tpl_submit').click(function() $('#msg-tpl-submit').click(function()
{ {
//前端校验 //前端校验
...@@ -76,7 +76,7 @@ $('#msg_tpl_submit').click(function() ...@@ -76,7 +76,7 @@ $('#msg_tpl_submit').click(function()
//微信通知 //微信通知
if($("input[id='chk-channels-wechat-notify']").is(':checked')) if($("input[id='chk-channels-wechat-notify']").is(':checked'))
{ {
if(!$("#wechat-notify_tpl_title").val()) if(!$("#wechat-notify-tpl-title").val())
{ {
Prompt('请填写微信模板编号', 5); Prompt('请填写微信模板编号', 5);
return false; return false;
...@@ -120,8 +120,10 @@ function addTemplate() ...@@ -120,8 +120,10 @@ function addTemplate()
wechat_notify_tpl_id:$('#wechatnotify-chn-tpl-id').val(), wechat_notify_tpl_id:$('#wechatnotify-chn-tpl-id').val(),
wechat_notify_channel_type:4, wechat_notify_channel_type:4,
wechat_notify_title:$('#wechat-notify_tpl_title').val(),//存放的是微信模板的id wechat_notify_title:$('#wechat-notify-tpl-title').val(),//存放的是微信模板的id
wechat_notify_head:$('#wechat-notify-tpl-head').val(),
wechat_notify_tail:$('#wechat-notify-tpl-tail').val(),
wechat_notify_url:$('#wechat-notify-tpl-url').val(),
}, },
dataType: 'json', dataType: 'json',
......
...@@ -13,7 +13,7 @@ layui.use('laydate', function(){ ...@@ -13,7 +13,7 @@ layui.use('laydate', function(){
}); });
var sendTime = ''; var sendTime = '';
$('#msg_tpl_submit').click(function() $('#msg-tpl-submit').click(function()
{ {
//前端校验 //前端校验
...@@ -88,7 +88,7 @@ $('#msg_tpl_submit').click(function() ...@@ -88,7 +88,7 @@ $('#msg_tpl_submit').click(function()
//微信通知 //微信通知
if($("input[id='chk-channels-wechat-notify']").is(':checked')) if($("input[id='chk-channels-wechat-notify']").is(':checked'))
{ {
if(!$("#wechat-notify_tpl_title").val()) if(!$("#wechat-notify-tpl-title").val())
{ {
Prompt('请填写微信模板编号', 5); Prompt('请填写微信模板编号', 5);
return false; return false;
...@@ -140,14 +140,17 @@ function sendManualMessage() ...@@ -140,14 +140,17 @@ function sendManualMessage()
title_1:$('#inner-tpl-title').val()?$('#inner-tpl-title').val():'', title_1:$('#inner-tpl-title').val()?$('#inner-tpl-title').val():'',
content_1:ue_inner.getContent()?ue_inner.getContent():'', content_1:ue_inner.getContent()?ue_inner.getContent():'',
op_type:$("input[name='inner-tpl-op']:checked").val()?$("input[name='inner-tpl-op']:checked").val():'', op_type:$("input[name='inner-tpl-op']:checked").val()?$("input[name='inner-tpl-op']:checked").val():'',
url:$('#inner-tpl-op-url-text').val()?$('#inner-tpl-op-url-text').val():'', url_1:$('#inner-tpl-op-url-text').val()?$('#inner-tpl-op-url-text').val():'',
content_2:$('#sms-tpl-content').val()?$('#sms-tpl-content').val():'', content_2:$('#sms-tpl-content').val()?$('#sms-tpl-content').val():'',
title_3:$('#email-tpl-title').val()?$('#email-tpl-title').val():'', title_3:$('#email-tpl-title').val()?$('#email-tpl-title').val():'',
content_3:ue_email.getContent()?ue_email.getContent():'', content_3:ue_email.getContent()?ue_email.getContent():'',
wechat_tpl_id:$('#wechat-notify_tpl_title').val()?$('#wechat-notify_tpl_title').val():'',//存放的是微信模板的id title_4:$('#wechat-notify-tpl-title').val()?$('#wechat-notify-tpl-title').val():'',//存放的是微信模板的id
wechat_notify_head:$('#wechat-notify-tpl-head').val(),
wechat_notify_tail:$('#wechat-notify-tpl-tail').val(),
url_4:$('#wechat-notify-tpl-url').val(),
obj_user:$('#msg-specified-users-text').val()?$('#msg-specified-users-text').val():'is_to_all', obj_user:$('#msg-specified-users-text').val()?$('#msg-specified-users-text').val():'is_to_all',
expect_send_time:sendTime?sendTime:'', expect_send_time:sendTime?sendTime:'',
......
...@@ -239,9 +239,30 @@ ...@@ -239,9 +239,30 @@
<div role="tabpanel" class="tab-pane fade" id="wechat-notify"> <div role="tabpanel" class="tab-pane fade" id="wechat-notify">
<input type="hidden" id="wechatnotify-chn-tpl-id" value="{{ $wechatNotify_chn_tpl_id }}"> <input type="hidden" id="wechatnotify-chn-tpl-id" value="{{ $wechatNotify_chn_tpl_id }}">
<div class="col-sm-10 form-inline" style="margin-top: 40px"> <div class="col-sm-10 form-inline" style="margin-top: 40px">
<label class="col-sm-2 control-label"><span style="color: red">*</span> 微信模板:</label> <label class="col-sm-2 control-label"><span style="color: red">*</span> 微信模板ID:</label>
<div class="col-sm-3"> <div class="col-sm-3">
<input type="text" id="wechat-notify_tpl_title" class="form-control" placeholder="请输入微信模板编号" value=@if(!empty($info->channel_tpls['4'])) "{{ $info->channel_tpls['4']->title }}" @endif> <input type="text" id="wechat-notify-tpl-title" class="form-control" placeholder="请输入微信模板编号" value=@if(!empty($info->channel_tpls['4'])) "{{ $info->channel_tpls['4']->title }}" @endif>
</div>
</div>
<div class="col-sm-10 form-inline" style="margin-top: 40px">
<label class="col-sm-2 control-label"> 微信模板头:</label>
<div class="col-sm-3">
<input type="text" id="wechat-notify-tpl-head" class="form-control" placeholder="请输入微信模板头" value=@if(!empty($info->channel_tpls['4'])) "{{ $info->channel_tpls['4']->content['wechat_tpl_head'] }}" @endif>
</div>
</div>
<div class="col-sm-10 form-inline" style="margin-top: 40px">
<label class="col-sm-2 control-label"> 微信模板尾:</label>
<div class="col-sm-3">
<input type="text" id="wechat-notify-tpl-tail" class="form-control" placeholder="请输入微信模板尾" value=@if(!empty($info->channel_tpls['4'])) "{{ $info->channel_tpls['4']->content['wechat_tpl_tail'] }}" @endif>
</div>
</div>
<div class="col-sm-10 form-inline" style="margin-top: 40px">
<label class="col-sm-2 control-label"> 跳转URL:</label>
<div class="col-sm-3">
<input type="text" id="wechat-notify-tpl-url" class="form-control" placeholder="请输入跳转URL" value=@if(!empty($info->channel_tpls['4'])) "{{ $info->channel_tpls['4']->url }}" @endif>
</div> </div>
</div> </div>
</div> </div>
...@@ -254,7 +275,7 @@ ...@@ -254,7 +275,7 @@
{{--外部统一提交按钮--}} {{--外部统一提交按钮--}}
<div class="col-sm-10" style="margin-top: 40px"> <div class="col-sm-10" style="margin-top: 40px">
<div align="center"> <div align="center">
<button class="btn btn-primary" id="msg_tpl_submit">提交</button> <button class="btn btn-primary" id="msg-tpl-submit">提交</button>
</div> </div>
</div> </div>
......
...@@ -248,9 +248,30 @@ ...@@ -248,9 +248,30 @@
{{--微信通知--}} {{--微信通知--}}
<div role="tabpanel" class="tab-pane fade" id="wechat-notify"> <div role="tabpanel" class="tab-pane fade" id="wechat-notify">
<div class="col-sm-10 form-inline" style="margin-top: 40px"> <div class="col-sm-10 form-inline" style="margin-top: 40px">
<label class="col-sm-2 control-label"><span style="color: red">*</span> 微信模板:</label> <label class="col-sm-2 control-label"><span style="color: red">*</span> 微信模板ID:</label>
<div class="col-sm-3"> <div class="col-sm-3">
<input type="text" id="wechat-notify_tpl_title" class="form-control" placeholder="请输入微信模板编号" value=@if(!empty($info->channel_tpls['4'])) "{{ $info->channel_tpls['4']->title }}" @endif > <input type="text" id="wechat-notify-tpl-title" class="form-control" placeholder="请输入微信模板编号" value=@if(!empty($info->channel_tpls['4'])) "{{ $info->channel_tpls['4']->title }}" @endif >
</div>
</div>
<div class="col-sm-10 form-inline" style="margin-top: 40px">
<label class="col-sm-2 control-label"> 微信模板头:</label>
<div class="col-sm-3">
<input type="text" id="wechat-notify-tpl-head" class="form-control" placeholder="请输入微信模板头" value=@if(!empty($info->channel_tpls['4'])) "{{ $info->channel_tpls['4']->content['wechat_tpl_head'] }}" @endif>
</div>
</div>
<div class="col-sm-10 form-inline" style="margin-top: 40px">
<label class="col-sm-2 control-label"> 微信模板尾:</label>
<div class="col-sm-3">
<input type="text" id="wechat-notify-tpl-tail" class="form-control" placeholder="请输入微信模板尾" value=@if(!empty($info->channel_tpls['4'])) "{{ $info->channel_tpls['4']->content['wechat_tpl_tail'] }}" @endif>
</div>
</div>
<div class="col-sm-10 form-inline" style="margin-top: 40px">
<label class="col-sm-2 control-label"> 跳转URL:</label>
<div class="col-sm-3">
<input type="text" id="wechat-notify-tpl-url" class="form-control" placeholder="请输入跳转URL" value=@if(!empty($info->channel_tpls['4'])) "{{ $info->channel_tpls['4']->url }}" @endif>
</div> </div>
</div> </div>
</div> </div>
...@@ -289,7 +310,7 @@ ...@@ -289,7 +310,7 @@
{{--外部统一提交按钮--}} {{--外部统一提交按钮--}}
<div class="col-sm-10" style="margin-top: 40px"> <div class="col-sm-10" style="margin-top: 40px">
<div align="center"> <div align="center">
<button class="btn btn-primary" id="msg_tpl_submit">提交发送</button> <button class="btn btn-primary" id="msg-tpl-submit">提交发送</button>
</div> </div>
</div> </div>
@endif @endif
......
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