用户订阅日志
parent
52a26e797c
commit
2f69f5c405
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin;
|
||||
|
||||
use App\Controllers\AdminController;
|
||||
use App\Utils\QQWry;
|
||||
|
||||
use Ozdemir\Datatables\Datatables;
|
||||
use App\Utils\DatatablesHelper;
|
||||
|
||||
class SubscribeLogController extends AdminController
|
||||
{
|
||||
public function index($request, $response, $args)
|
||||
{
|
||||
$table_config['total_column'] = array('id' => 'ID', 'user_name' => '用户名',
|
||||
'user_id' => '用户ID', 'email' => '用户邮箱', 'subscribe_type' => '类型',
|
||||
'request_ip' => 'IP', 'location' => '归属地', 'request_time' => '时间',
|
||||
'request_user_agent' => '归属地');
|
||||
$table_config['default_show_column'] = array();
|
||||
foreach ($table_config['total_column'] as $column => $value) {
|
||||
$table_config['default_show_column'][] = $column;
|
||||
}
|
||||
$table_config['ajax_url'] = 'subscribe/ajax';
|
||||
return $this->view()->assign('table_config', $table_config)->display('admin/subscribe.tpl');
|
||||
}
|
||||
|
||||
public function ajax_subscribe_log($request, $response, $args)
|
||||
{
|
||||
$datatables = new Datatables(new DatatablesHelper());
|
||||
$datatables->query('Select user_subscribe_log.id,user_subscribe_log.user_name,user_subscribe_log.user_id,user_subscribe_log.email,user_subscribe_log.subscribe_type,user_subscribe_log.request_ip,user_subscribe_log.request_ip as location,user_subscribe_log.request_time,user_subscribe_log.request_user_agent from user_subscribe_log');
|
||||
|
||||
$iplocation = new QQWry();
|
||||
$datatables->edit('location', static function ($data) use ($iplocation) {
|
||||
$location = $iplocation->getlocation($data['location']);
|
||||
return iconv('gbk', 'utf-8//IGNORE', $location['country'] . $location['area']);
|
||||
});
|
||||
|
||||
$body = $response->getBody();
|
||||
$body->write($datatables->generate());
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
class UserSubscribeLog extends Model
|
||||
{
|
||||
protected $connection = 'default';
|
||||
protected $table = 'user_subscribe_log';
|
||||
}
|
||||
@ -0,0 +1,41 @@
|
||||
{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-sm-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'}
|
||||
|
||||
window.addEventListener('load', () => {
|
||||
{include file='table/js_2.tpl'}
|
||||
});
|
||||
</script>
|
||||
@ -0,0 +1,11 @@
|
||||
CREATE TABLE IF NOT EXISTS `user_subscribe_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 '用户邮箱',
|
||||
`subscribe_type` varchar(20) DEFAULT NULL COMMENT '获取的订阅类型',
|
||||
`request_ip` varchar(20) DEFAULT NULL COMMENT '请求 IP',
|
||||
`request_time` datetime DEFAULT NULL COMMENT '请求时间',
|
||||
`request_user_agent` text COMMENT '请求 UA 信息',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='用户订阅日志';
|
||||
Loading…
Reference in New Issue