This commit is contained in:
你的名字
2025-07-14 10:22:40 +08:00
commit 0483b4b364
1388 changed files with 219353 additions and 0 deletions

View File

@ -0,0 +1,94 @@
<?php
// +----------------------------------------------------------------------
// | ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://demo.thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 代码仓库3https://gitee.com/zoujingli/ThinkAdmin
// | github 代码仓库3https://github.com/zoujingli/ThinkAdmin
// +----------------------------------------------------------------------
namespace app\akszadmin\controller;
use library\Controller;
use think\Db;
/**
* 系统日志管理
* Class Oplog
* @package app\akszadmin\controller
*/
class Oplog extends Controller
{
/**
* 指定当前数据表
* @var string
*/
public $table = 'SystemLog';
/**
* 系统操作日志
* @auth true
* @menu true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function index()
{
$this->title = '系统操作日志';
$query = $this->_query($this->table)->like('action,node,content,username,geoip');
$query->dateBetween('create_at')->order('id desc')->page();
}
/**
* 列表数据处理
* @auth true
* @param array $data
* @throws \Exception
*/
protected function _index_page_filter(&$data)
{
$ip = new \Ip2Region();
foreach ($data as &$vo) {
$result = $ip->btreeSearch($vo['geoip']);
$vo['isp'] = isset($result['region']) ? $result['region'] : '';
$vo['isp'] = str_replace(['内网IP', '0', '|'], '', $vo['isp']);
}
}
/**
* 清理系统日志
* @auth true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function clear()
{
if (Db::name($this->table)->whereRaw('1=1')->delete() !== false) {
$this->success('日志清理成功!');
} else {
$this->error('日志清理失败,请稍候再试!');
}
}
/**
* 删除系统日志
* @auth true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function remove()
{
$this->applyCsrfToken();
$this->_delete($this->table);
}
}