12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- <?php
- namespace app\admin\controller;
- use library\Controller;
- use think\Db;
- class Oplog extends Controller
- {
-
- public $table = 'SystemLog';
-
- public function index()
- {
- $this->title = '系统操作日志';
- $query = $this->_query($this->table)->like('action,node,content,username,geoip');
- $query->dateBetween('create_at')->order('id desc')->page();
- }
-
- 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']);
- }
- }
-
- public function clear()
- {
- if (Db::name($this->table)->whereRaw('1=1')->delete() !== false) {
- $this->success('日志清理成功!');
- } else {
- $this->error('日志清理失败,请稍候再试!');
- }
- }
-
- public function remove()
- {
- $this->applyCsrfToken();
- $this->_delete($this->table);
- }
- }
|