Commit 11845dac by 李洋

1、更改时间搜索为区间

parent b36bbb3a
...@@ -261,23 +261,25 @@ class MessageController extends Controller ...@@ -261,23 +261,25 @@ class MessageController extends Controller
//搜索条件 //搜索条件
$search_desc = $request->input('search_desc'); $search_desc = $request->input('search_desc');
$search_channel = $request->input('search_channel'); $search_channel = $request->input('search_channel');
$search_sendtime = $request->input('search_sendtime'); $search_sendtime_start = $request->input('search_sendtime_start');
$search_sendtime_end = $request->input('search_sendtime_end');
$db = DB::connection('message'); $db = DB::connection('message');
//1.首次进页面无搜索条件 //1.首次进页面无搜索条件
if(null==$search_desc && null==$search_channel && null==$search_sendtime) 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)->get();
$search_channel = 0; $search_channel = 0;
$search_desc = ''; $search_desc = '';
$search_sendtime = ''; $search_sendtime_start = '';
$search_sendtime_end = '';
}else//2.有搜索条件 }else//2.有搜索条件
{ {
//时间为查询选择的当天 //时间为查询选择的当天
if(!empty($search_sendtime)) if(!empty($search_sendtime_start) && !empty($search_sendtime_end))
{ {
$start_time = strtotime($search_sendtime); $start_time = strtotime($search_sendtime_start);
$end_time = strtotime($search_sendtime)+86400; $end_time = strtotime($search_sendtime_end);
}else//否则为极限时间 }else//否则为极限时间
{ {
$start_time = 31507200; $start_time = 31507200;
...@@ -339,7 +341,8 @@ class MessageController extends Controller ...@@ -339,7 +341,8 @@ class MessageController extends Controller
'msg_channels'=>$msg_channels, 'msg_channels'=>$msg_channels,
'search_desc'=>$search_desc, 'search_desc'=>$search_desc,
'search_channel'=>$search_channel, 'search_channel'=>$search_channel,
'search_sendtime'=>$search_sendtime, 'search_sendtime_start'=>$search_sendtime_start,
'search_sendtime_end'=>$search_sendtime_end,
'manualhistorylist_check'=>$manualhistorylist_check, 'manualhistorylist_check'=>$manualhistorylist_check,
'manualmessage_edit'=>$manualmessage_edit, 'manualmessage_edit'=>$manualmessage_edit,
...@@ -360,26 +363,28 @@ class MessageController extends Controller ...@@ -360,26 +363,28 @@ class MessageController extends Controller
//搜索条件 //搜索条件
$search_id = $request->input('search_id'); $search_id = $request->input('search_id');
$search_user = $request->input('search_user'); $search_user = $request->input('search_user');
$search_sendtime = $request->input('search_sendtime'); $search_sendtime_start = $request->input('search_sendtime_start');
$search_sendtime_end = $request->input('search_sendtime_end');
$search_channel = $request->input('search_channel'); $search_channel = $request->input('search_channel');
$search_status = $request->input('search_status'); $search_status = $request->input('search_status');
$db = DB::connection('message'); $db = DB::connection('message');
if($search_id==null && $search_user==null && $search_sendtime==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')->paginate(20);
$search_id = ''; $search_id = '';
$search_user = ''; $search_user = '';
$search_sendtime = ''; $search_sendtime_start = '';
$search_sendtime_end = '';
$search_channel = 0; $search_channel = 0;
$search_status = 0; $search_status = 0;
}else }else
{ {
//时间为查询选择的当天 //时间为查询选择的当天
if(!empty($search_sendtime)) if(!empty($search_sendtime_start) && !empty($search_sendtime_end))
{ {
$start_time = strtotime($search_sendtime); $start_time = strtotime($search_sendtime_start);
$end_time = strtotime($search_sendtime)+86400; $end_time = strtotime($search_sendtime_end);
}else//否则为极限时间 }else//否则为极限时间
{ {
$start_time = 31507200; $start_time = 31507200;
...@@ -428,7 +433,8 @@ class MessageController extends Controller ...@@ -428,7 +433,8 @@ class MessageController extends Controller
'msg_channels'=>$msg_channels, 'msg_channels'=>$msg_channels,
'search_id'=>$search_id, 'search_id'=>$search_id,
'search_user'=>$search_user, 'search_user'=>$search_user,
'search_sendtime'=>$search_sendtime, 'search_sendtime_start'=>$search_sendtime_start,
'search_sendtime_end'=>$search_sendtime_end,
'search_channel'=>$search_channel, 'search_channel'=>$search_channel,
'search_status'=>$search_status, 'search_status'=>$search_status,
......
...@@ -5,8 +5,18 @@ layui.use('laydate', function(){ ...@@ -5,8 +5,18 @@ layui.use('laydate', function(){
//执行一个laydate实例 //执行一个laydate实例
laydate.render({ laydate.render({
elem: '#Choice_start', //指定元素 elem: '#Choice_start', //指定元素
type:'datetime', // type:'datetime',
format:'yyyy-MM-dd HH:mm' // format:'yyyy-MM-dd HH:mm'
});
});
layui.use('laydate', function(){
var laydate = layui.laydate;
//执行一个laydate实例
laydate.render({
elem: '#Choice_end', //指定元素
// type:'datetime',
// format:'yyyy-MM-dd HH:mm'
}); });
}); });
...@@ -14,8 +24,9 @@ layui.use('laydate', function(){ ...@@ -14,8 +24,9 @@ layui.use('laydate', function(){
$('#search-btn').click(function () { $('#search-btn').click(function () {
var search_id = $('#search-msg-id').val(); var search_id = $('#search-msg-id').val();
var search_user = $('#search-msg-userobj').val(); var search_user = $('#search-msg-userobj').val();
var search_sendtime = $('#Choice_start').val(); var search_sendtime_start = $('#Choice_start').val();
var search_sendtime_end = $('#Choice_end').val();
var search_channel = $('#search-msg-channel option:selected').val(); var search_channel = $('#search-msg-channel option:selected').val();
var search_status = $('#search-msg-status option:selected').val(); var search_status = $('#search-msg-status option:selected').val();
window.location.href="/message/allhistorylist?search_id="+search_id+"&search_user="+search_user+"&search_sendtime="+search_sendtime+"&search_channel="+search_channel+"&search_status="+search_status; window.location.href="/message/allhistorylist?search_id="+search_id+"&search_user="+search_user+"&search_sendtime_start="+search_sendtime_start+"&search_sendtime_end="+search_sendtime_end+"&search_channel="+search_channel+"&search_status="+search_status;
}) })
\ No newline at end of file
...@@ -9,11 +9,22 @@ layui.use('laydate', function(){ ...@@ -9,11 +9,22 @@ layui.use('laydate', function(){
// format:'yyyy-MM-dd HH-mm' // format:'yyyy-MM-dd HH-mm'
}); });
}); });
layui.use('laydate', function(){
var laydate = layui.laydate;
//执行一个laydate实例
laydate.render({
elem: '#Choice_end', //指定元素
// type:'datetime',
// format:'yyyy-MM-dd HH-mm'
});
});
//指定条件搜索 //指定条件搜索
$('#search-btn').click(function () { $('#search-btn').click(function () {
var search_desc = $('#search-desc').val(); var search_desc = $('#search-desc').val();
var search_channel = $('#choose-tpl option:selected').val(); var search_channel = $('#choose-tpl option:selected').val();
var search_sendtime = $('#Choice_start').val(); var search_sendtime_start = $('#Choice_start').val();
window.location.href="/message/manualhistorylist?search_desc="+search_desc+"&search_channel="+search_channel+"&search_sendtime="+search_sendtime; var search_sendtime_end = $('#Choice_end').val();
window.location.href="/message/manualhistorylist?search_desc="+search_desc+"&search_channel="+search_channel+"&search_sendtime_start="+search_sendtime_start+"&search_sendtime_end="+search_sendtime_end;
}) })
\ No newline at end of file
...@@ -43,7 +43,8 @@ ...@@ -43,7 +43,8 @@
<input class="form-control" type="text" id="search-msg-userobj" placeholder="请输入用户" value="{{ $search_user }}"> <input class="form-control" type="text" id="search-msg-userobj" placeholder="请输入用户" value="{{ $search_user }}">
<label>发送时间:</label> <label>发送时间:</label>
<input type="text" class="form-control" id="Choice_start" name="create_time_start/condition" value="{{ $search_sendtime }}"/> <input type="text" class="form-control" id="Choice_start" name="create_time_start/condition" value="{{ $search_sendtime_start }}"/>-
<input type="text" class="form-control" id="Choice_end" name="create_time_end/condition" value="{{ $search_sendtime_end }}"/>
</div> </div>
<div class="div-b" style="text-align: center"> <div class="div-b" style="text-align: center">
......
...@@ -35,7 +35,8 @@ ...@@ -35,7 +35,8 @@
@endfor @endfor
</select> </select>
<label>发送时间:</label> <label>发送时间:</label>
<input type="text" class="form-control" id="Choice_start" name="create_time_start/condition" value="{{ $search_sendtime }}"/> <input type="text" class="form-control" id="Choice_start" name="create_time_start/condition" value="{{ $search_sendtime_start }}"/>-
<input type="text" class="form-control" id="Choice_end" name="create_time_end/condition" value="{{ $search_sendtime_end }}"/>
<input class="btn btn-primary btn-sm" id="search-btn" style="float: right; margin-right: 60px" value="搜索"/> <input class="btn btn-primary btn-sm" id="search-btn" style="float: right; margin-right: 60px" value="搜索"/>
</div> </div>
</form> </form>
......
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