审计封禁
parent
a6df534356
commit
be0cb7f93a
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin;
|
||||
|
||||
use App\Controllers\AdminController;
|
||||
use Ozdemir\Datatables\Datatables;
|
||||
use App\Utils\DatatablesHelper;
|
||||
|
||||
class DetectBanLogController extends AdminController
|
||||
{
|
||||
public function index($request, $response, $args)
|
||||
{
|
||||
$table_config['total_column'] = array("id" => "ID", "user_id" => "用户ID",
|
||||
"user_name" => "用户名", "email" => "用户邮箱",
|
||||
"detect_number" => "违规次数", "ban_time" => "封禁时长(分钟)",
|
||||
"start_time" => "统计开始时间", "end_time" => "统计结束以及封禁开始时间",
|
||||
"ban_end_time" => "封禁结束时间", "all_detect_number" => "累计违规次数");
|
||||
$table_config['default_show_column'] = array();
|
||||
foreach ($table_config['total_column'] as $column => $value) {
|
||||
array_push($table_config['default_show_column'], $column);
|
||||
}
|
||||
$table_config['ajax_url'] = 'ban/ajax';
|
||||
return $this->view()->assign('table_config', $table_config)->display('admin/detect/ban.tpl');
|
||||
}
|
||||
|
||||
public function ajax_log($request, $response, $args)
|
||||
{
|
||||
$datatables = new Datatables(new DatatablesHelper());
|
||||
$datatables->query('Select detect_ban_log.id,detect_ban_log.user_id,detect_ban_log.user_name,detect_ban_log.email,detect_ban_log.detect_number,detect_ban_log.ban_time,detect_ban_log.start_time,detect_ban_log.end_time,detect_ban_log.all_detect_number,detect_ban_log.end_time as ban_end_time from detect_ban_log');
|
||||
$datatables->edit('start_time', function ($data) {
|
||||
return date('Y-m-d H:i:s', $data['start_time']);
|
||||
});
|
||||
$datatables->edit('end_time', function ($data) {
|
||||
return date('Y-m-d H:i:s', $data['end_time']);
|
||||
});
|
||||
$datatables->edit('ban_end_time', function ($data) {
|
||||
return date('Y-m-d H:i:s', $data['ban_end_time']+$data['ban_time']*60);
|
||||
});
|
||||
|
||||
$body = $response->getBody();
|
||||
$body->write($datatables->generate());
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
class DetectBanLog extends Model
|
||||
{
|
||||
protected $connection = "default";
|
||||
protected $table = "detect_ban_log";
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
{include file='admin/main.tpl'}
|
||||
|
||||
|
||||
<main class="content">
|
||||
<div class="content-header ui-content-header">
|
||||
<div class="container">
|
||||
<h1 class="content-heading">审计封禁记录</h1>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container">
|
||||
<div class="col-lg-12 col-md-12">
|
||||
<section class="content-inner margin-top-no">
|
||||
|
||||
<div class="card">
|
||||
<div class="card-main">
|
||||
<div class="card-inner">
|
||||
<p>系统中所有审计封禁记录。</p>
|
||||
<p>显示表项:
|
||||
{include file='table/checkbox.tpl'}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="table-responsive">
|
||||
{include file='table/table.tpl'}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
|
||||
{include file='admin/footer.tpl'}
|
||||
|
||||
<script>
|
||||
{include file='table/js_1.tpl'}
|
||||
|
||||
$(document).ready(function(){
|
||||
{include file='table/js_2.tpl'}
|
||||
});
|
||||
</script>
|
||||
@ -0,0 +1,20 @@
|
||||
--
|
||||
-- 审计封禁日志
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `detect_ban_log` (
|
||||
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`user_name` varchar(128) NOT NULL COMMENT '用户名',
|
||||
`user_id` int(11) NOT NULL COMMENT '用户 ID',
|
||||
`email` varchar(32) NOT NULL COMMENT '用户邮箱',
|
||||
`detect_number` int(11) NOT NULL COMMENT '本次违规次数',
|
||||
`ban_time` int(11) NOT NULL COMMENT '本次封禁时长',
|
||||
`start_time` bigint(20) NOT NULL COMMENT '统计开始时间',
|
||||
`end_time` bigint(20) NOT NULL COMMENT '统计结束时间',
|
||||
`all_detect_number` int(11) NOT NULL COMMENT '累计违规次数',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='审计封禁日志';
|
||||
|
||||
|
||||
ALTER TABLE `user` ADD `detect_ban` int(2) NOT NULL DEFAULT '0' AFTER `enable`;
|
||||
ALTER TABLE `user` ADD `last_detect_ban_time` datetime DEFAULT '1989-06-04 00:05:00' AFTER `detect_ban`;
|
||||
ALTER TABLE `user` ADD `all_detect_number` int(11) NOT NULL DEFAULT '0' AFTER `last_detect_ban_time`;
|
||||
Loading…
Reference in New Issue