Files
spacestation/agent/admin/controllers/api/system/OperationRecord.php
T
2025-07-27 12:21:34 +08:00

100 lines
3.6 KiB
PHP

<?php
defined('BASEPATH') OR exit('No direct script access allowed');
require_once APPPATH . 'controllers/api/BaseController.php';
/**
* Notes:操作日志
* Created on: 2022/9/15 17:15
* Created by: dengbw
*/
class operationRecord extends BaseController
{
public function __construct()
{
parent::__construct();
$this->load->model('agent/admin/Market_sys_operation_record_model', 'mdSysOperationRecord');
}
/**
* Notes:操作日志列表
* Created on: 2022/9/15 16:28
* Created by: dengbw
*/
public function page_get()
{
$page = $this->input_param('page');
$limit = $this->input_param('limit');
$sort = $this->input_param('sort');
$order = $this->input_param('order');
$username = $this->input_param('username');
$module = $this->input_param('module');
$createTimeStart = $this->input_param('createTimeStart');
$createTimeEnd = $this->input_param('createTimeEnd');
!$page && $page = 1;
!$limit && $limit = 10;
$where = $list = [];
$createTimeStart && $where['createTime>='] = $createTimeStart;
$createTimeEnd && $where['createTime<='] = $createTimeEnd;
$username && $where['username'] = $username;
$module && $where['module'] = $module;
$sort_order = 'createTime desc';
if ($sort && $order) {
$sort_order = $sort . ' ' . $order;
}
$count = $this->mdSysOperationRecord->count($where);
if ($count) {
$list = $this->mdSysOperationRecord->select($where, $sort_order, $page, $limit);
foreach ($list as $k => $v) {
$list[$k]['params'] = json_decode($v['params'], true);
$list[$k]['result'] = json_decode($v['result'], true);
$list[$k]['error'] = json_decode($v['error'], true);
$list[$k]['status'] = intval($v['status']);
}
}
$date = ['list' => $list, 'count' => $count];
$this->return_response_list($date);
}
private function dataSelect($params)
{
$page = $params['page'];
$limit = $params['limit'];
$limit = $this->input_param('limit');
$sort = $this->input_param('sort');
$order = $this->input_param('order');
$username = $this->input_param('username');
$module = $this->input_param('module');
$createTimeStart = $this->input_param('createTimeStart');
$createTimeEnd = $this->input_param('createTimeEnd');
!$page && $page = 1;
!$limit && $limit = 10;
$where = $list = [];
$createTimeStart && $where['createTime>='] = $createTimeStart;
$createTimeEnd && $where['createTime<='] = $createTimeEnd;
$username && $where['username'] = $username;
$module && $where['module'] = $module;
$sort_order = 'createTime desc';
if ($sort && $order) {
$sort_order = $sort . ' ' . $order;
}
$count = $this->mdSysOperationRecord->count($where);
if ($count) {
$list = $this->mdSysOperationRecord->select($where, $sort_order, $page, $limit);
foreach ($list as $k => $v) {
$list[$k]['params'] = json_decode($v['params'], true);
$list[$k]['result'] = json_decode($v['result'], true);
$list[$k]['error'] = json_decode($v['error'], true);
$list[$k]['status'] = intval($v['status']);
}
}
}
public function index_get()
{
$date = [];
$this->return_response_list($date);
}
}