| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 | 
							- <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
 
- include_once(FCPATH . 'application/controllers/Base_Controller.php');
 
- class Syslog extends Base_Controller {
 
- 	public function __construct() {
 
-         parent::__construct();
 
-         $this->load->model('Syslog_model');
 
-     }
 
-     // 获取用户日志列表
 
-     public function get_list(){
 
-     	$keyword = $this->input->post('keyword',true);
 
-     	$type = $this->input->post('type',true);
 
-     	$page = $this->input->post('page',true);
 
-     	$count = $this->input->post('count',true);
 
-         $language = $this->session->userdata('version');
 
-         $role = $this->get_user_info('role');
 
-         $print = $this->input->post('print',true);
 
-     	$filter = array();
 
-     	if (!empty($keyword)) $filter['keyword'] = $keyword;
 
-     	if (!empty($type)) $filter['optype'] = $type;
 
-         $filter['language'] = empty($language) ? 0 : 1;
 
-         $download = $this->input->post('download',true);
 
-         if ($role == COMPANY_ADMIN) {
 
-             $filter['companyid'] = $this->get_user_info('companyid');
 
-         }elseif ($role == COMPANY_CUSTOMER) {
 
-             $filter['userid'] = $this->get_user_info('id');
 
-         }
 
-     	$page = !isset($page) ? 1 : $page;
 
-     	$count = empty($count) ? 20 : $count;
 
-     	$field = "S.id,
 
-     			  S.time,
 
-     			  S.optype as type,
 
-     			  S.userid,
 
-     			  U.username,
 
-     			  S.content,
 
-                   S.is_read";
 
-     	if (empty($download)) {
 
-             if (isset($print) && !empty($print)) {
 
-                 $data = $this->Syslog_model->getList($filter,$page,$count,$field,1);
 
-             }else{
 
-                 $data = $this->Syslog_model->getList($filter,$page,$count,$field);
 
-             }
 
-             
 
-             $data = empty($data) ? array() : $data;
 
-             $total = $this->Syslog_model->getTotal($filter);
 
-             foreach ($data as &$v) {
 
-                 $v['username'] = empty($v['username']) ? '' : $v['username'];
 
-                 $v['content'] = empty($v['content']) ? '' : $v['content'];
 
-                 $v['userid'] = empty($v['userid']) ? '' : $v['userid'];
 
-                 $v['type'] = empty($v['type']) ? '' : $v['type'];
 
-                 $v['time'] = empty($v['time']) ? '' : $v['time'];
 
-             }
 
-             exit(json_result('0000',$this->response['0000'],array('total'=>ceil($total/$count),'list'=>$data)));
 
-         }else{
 
-             $data = $this->Syslog_model->getList($filter,($page-1)*$count,3000,$field);
 
-             $data = empty($data) ? array() : $data;
 
-             // 导出到Excel
 
-             $version = $this->session->userdata('version');
 
-             if (empty($version)) {
 
-                 $title = array(
 
-                     array('编号','操作时间','操作类型','操作用户id','操作用户名','操作内容'),
 
-                 );
 
-             }else{
 
-                 $title = array(
 
-                     array('Index','Operation time','Operation type','User ID','Username','Behavior'),
 
-                 );
 
-             }
 
-             $temp = array();
 
-             $i = ($page-1)*$count + 1;
 
-             foreach ($data as $k=>$v) {
 
-                 $temp[$k][] = $i;
 
-                 $temp[$k][] = $v['time'];
 
-                 $temp[$k][] = $v['type'];
 
-                 $temp[$k][] = $v['username'];
 
-                 $temp[$k][] = $v['realname'];
 
-                 $temp[$k][] = $v['content'];
 
-                 $i ++;
 
-             }
 
-             $data = array_merge($title,$temp);
 
-             $path = push_excel($data,'syslogExcel_'.date('Ymd'));
 
-             exit(json_result('0000',$this->response['0000'],array('path'=>$path)));
 
-         }
 
-     }
 
- }
 
- ?>
 
 
  |