title = '系统操作日志'; $query = $this->_query($this->table)->like('action,node,content,username,geoip'); $query->dateBetween('create_at')->order('id desc')->page(); } /** * 列表数据处理 * @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']); } } /** * 清理系统日志 * @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('日志清理失败,请稍候再试!'); } } /** * 删除系统日志 */ public function del() { $this->applyCsrfToken(); $this->_delete($this->table); } }