isPost()){ $time = input("param.time/s"); $key = input("param.key/s"); $type = input("param.type/s"); if($time == 'week'){ //前一周 $start = time()-604800; } if($time == 'oneMonth'){ //前一个月 $start = time()-2592000; } if($time == 'threeMonth'){ //前三个月 $start = time()-7776000; } if(!empty($start_time)){ $start = strtotime($start_time); } if(!empty($end_time)){ $end = strtotime($end_time . ' 23:59:59'); } $where = array(); if(!empty($type)){ $type_id = db('messagetype')->where('name', $type)->find(); if(!empty($type)){ $where['type_id'] = $type_id['id']; } } } if(!empty($key)){ $message = db('accountsmessage')->whereBetween('add_time', [$start, $end])->where($where)->whereLike('content','%'.$key.'%')->where('if_public', 1)->select(); }else{ $message = db('accountsmessage')->whereBetween('add_time', [$start, $end])->where($where)->where('if_public', 1)->select(); } $type = db('messagetype')->select(); foreach($message as $key=>$vo){ for($i=0;$i1, 'msg'=>'成功', 'data'=>$message ]; return json_encode($data,JSON_UNESCAPED_UNICODE); } // 留言类型 public function type() { $type = db('messagetype')->select(); $data = [ 'status'=>1, 'msg'=>'成功', 'data'=>$type ]; return json_encode($data,JSON_UNESCAPED_UNICODE); } }