Commit 36f567a0 by 李洋

update Code

parent 1fe18552
...@@ -273,18 +273,31 @@ class MessageController extends Controller ...@@ -273,18 +273,31 @@ class MessageController extends Controller
$search_sendtime = ''; $search_sendtime = '';
}else//2.有搜索条件 }else//2.有搜索条件
{ {
//时间为查询选择的当天
if(!empty($search_sendtime))
{
$start_time = strtotime($search_sendtime);
$end_time = strtotime($search_sendtime)+86400;
}else//否则为极限时间
{
$start_time = 31507200;
$end_time = 2524579200;
}
//渠道里没有0,所以如果没选,将此条件剔除掉 //渠道里没有0,所以如果没选,将此条件剔除掉
if(0==$search_channel) if(0==$search_channel)
{ {
$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)
// ->where('lie_msg_log.expect_send_time',$search_sendtime) // ->where('lie_msg_log.expect_send_time','>',$start_time)
// ->where('lie_msg_log.expect_send_time','<',$end_time)
->whereBetween('lie_msg_log.expect_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%")->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')
// ->where('lie_msg_log.expect_send_time',$search_sendtime) ->whereBetween('lie_msg_log.expect_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%")->get();
} }
...@@ -364,29 +377,40 @@ class MessageController extends Controller ...@@ -364,29 +377,40 @@ class MessageController extends Controller
$search_status = 0; $search_status = 0;
}else }else
{ {
//时间为查询选择的当天
if(!empty($search_sendtime))
{
$start_time = strtotime($search_sendtime);
$end_time = strtotime($search_sendtime)+86400;
}else//否则为极限时间
{
$start_time = 31507200;
$end_time = 2524579200;
}
//select option是否为0,为0则不查 //select option是否为0,为0则不查
if($search_channel==0 && $search_status!=0) if($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%")
->where('expect_send_time',$search_sendtime) ->whereBetween('expect_send_time',[$start_time,$end_time])
->where('status',$search_status)->paginate(20); ->where('status',$search_status)->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%")
->where('expect_send_time',$search_sendtime)->where('channel_type',$search_channel) ->whereBetween('expect_send_time',[$start_time,$end_time])->where('channel_type',$search_channel)
->paginate(20); ->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%")
->where('expect_send_time',$search_sendtime)->paginate(20); ->whereBetween('expect_send_time',[$start_time,$end_time])->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%")
->where('expect_send_time',$search_sendtime)->where('channel_type',$search_channel) ->whereBetween('expect_send_time',[$start_time,$end_time])->where('channel_type',$search_channel)
->where('status',$search_status)->paginate(20); ->where('status',$search_status)->paginate(20);
} }
} }
......
...@@ -5,8 +5,8 @@ layui.use('laydate', function(){ ...@@ -5,8 +5,8 @@ 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'
}); });
}); });
......
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