| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- <?php
- if (!defined('IN_ONLINE')) {
- exit('Access Denied');
- }
- /**
- * Description of operation_log
- *
- * @author Administrator
- */
- class operation_log{
- private static $_operation_log;
- function __construct() {
-
- }
- public static function getInstance() {
- global $memory_limit;
- $memory_limit = ini_get("memory_limit");
- ini_set("memory_limit", '2048M');
- if (!self::$_operation_log) {
- $c = __CLASS__;
- self::$_operation_log = new $c;
- }
- return self::$_operation_log;
- }
- public function operation_log() {
- $operate = utils::_get('operate');
- $operate = strtolower($operate);
- /*
- * index page
- */
- if (empty($operate)) {
- $column = column::getInstance()->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();
- }
- }
- /*
- * 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'";
- $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')." 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,
- 'rc' => $rc,
- 'ps' => $ps,
- 'cp' => $cp,
- 'tp' => $tp);
- } else {
- $arrTmp = array('searchData' => array());
- }
- common::echo_json_encode(200,$arrTmp);
- exit();
- }
- }
- ?>
|