getDisplayColumn('Operation_Search'); $OperationTableColumns = column::getInstance()->tableColumns('Operation_Search',$column); $data['OperationTableColumns'] = $OperationTableColumns; common::echo_json_encode(200,$data); exit(); } /* * operation_search search */ if ($operate == "search") { $this->_operation_search(); } if ($operate == "excel") { $sql = common::deCode($_POST ['tmp_search'], 'D'); $sql = substr($sql, 0, strripos($sql, " limit")); if(!empty($sql)){ $rss = common::excuteListSql($sql); } foreach($rss as $key =>$val){ $rss[$key]['Operation Time'] = $rss[$key]['_operation_time']; } common::echo_json_encode(200,array("msg"=>"success","Data" => $rss)); exit; } } /* * operation_search search */ private function _operation_search() { $cp = common::check_input($_POST ['cp']); //current_page $ps = common::check_input($_POST ['ps']); //ps if (empty($ps)) $ps = 10; $sqlWhere = ' where 1=1'; $user_name = common::check_input($_POST ['user_name']); $user_type = common::check_input($_POST ['user_type']); $page = common::check_input($_POST ['page']); $operation = common::check_input($_POST ['operation']); if (!empty($user_name)){ $sqlWhere .= " and user_name ilike '%" . $user_name . "%'"; } if (!empty($user_type)){ $sqlWhere .= " and lower(user_type) = '".strtolower($user_type)."'"; } if (!empty($page)){ $sqlWhere .= " and lower(page) = '".strtolower($page)."'"; } if (!empty($operation)){ $sqlWhere .= " and lower(operation) = '".strtolower($operation)."'"; } if (isset($_POST['operation_date_start']) && !empty($_POST['operation_date_start'])) $sqlWhere .= " and operation_time >= '" . common::usDate2sqlDate($_POST['operation_date_start']) . " 00:00:00'"; if (isset($_POST['operation_date_end']) && !empty($_POST['operation_date_end'])) $sqlWhere .= " and operation_time <= '" . common::usDate2sqlDate($_POST['operation_date_end']) . " 23:59:59'"; // $allLogColumns = array(); // $allLogColumns[] = array("title" =>"User Type","field" =>"user_type","formatter" =>"normal","type" =>"normal"); // $allLogColumns[] = array("title" =>"User Name","field" =>"user_name","formatter" =>"normal","type" =>"normal"); // $allLogColumns[] = array("title" =>"Page","field" =>"page","formatter" =>"normal","type" =>"normal"); // $allLogColumns[] = array("title" =>"Operation","field" =>"operation","formatter" =>"normal","type" =>"normal"); // $allLogColumns[] = array("title" =>"Operation Details","field" =>"operation_detail","formatter" =>"normal","type" =>"normal"); // $allLogColumns[] = array("title" =>"Operation Time","field" =>"operation_time","formatter" =>"normal","type" =>"normal"); $rc = $_POST ['rc']; if ($rc == - 1) { $sql = "SELECT count(1) from public.customer_service_operation_log" . $sqlWhere; error_log($sql); $rc = common::excuteOneSql($sql); } $tp = ceil($rc / $ps); $order_by = " id desc"; if ($rc > 0) { $sql = "SELECT ".column::getInstance()->getSearchSqlForDisplay('Operation_Search').", to_char(operation_time, 'YYYY/MM/DD HH24:MI:SS') as _operation_time from public.customer_service_operation_log " . $sqlWhere . " order by $order_by limit " . $ps . " offset " . ($cp - 1) * $ps; $rs = common::excuteListSql($sql); //处理operation_detail 可以放在保存的时候做(待定) foreach($rs as $key => $val){ $json = $val['operation_detail']; if(!empty($json)){ $_text = ''; $data = json_decode($json,true); foreach ($data as $jk => $jv) { $_text .= $jk.":".$jv."; "; } $rs[$key]["operation_detail"] = $_text; } } $arrTmp = array('searchData' => $rs, 'tmp_search' => common::deCode($sql, 'E'), 'rc' => $rc, 'ps' => $ps, 'cp' => $cp, 'tp' => $tp); } else { $arrTmp = array('searchData' => array(), 'tmp_search' => common::deCode($sql, 'E'), 'rc' => $rc, 'ps' => $ps, 'cp' => $cp, 'tp' => $tp); } common::echo_json_encode(200,$arrTmp); exit(); } } ?>