mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-09-04 23:13:26 +08:00
feat(nginx-log): 新增 6 张表 phinx migration + Scheme + model
This commit is contained in:
24
database/migrations/20260726100005_nginx_stat_referer.php
Normal file
24
database/migrations/20260726100005_nginx_stat_referer.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Migrator;
|
||||
|
||||
/**
|
||||
* nginx 日志分析 - 按 Referer 来源域名聚合统计表
|
||||
*
|
||||
* 每个统计日 + 来源域名一行,记录 PV/UV,用于外链来源排行。
|
||||
*/
|
||||
class NginxStatReferer extends Migrator
|
||||
{
|
||||
public function change()
|
||||
{
|
||||
$table = $this->table('nginx_stat_referer')
|
||||
->setComment('nginx 按 Referer 来源域名聚合统计')
|
||||
->addColumn('stat_date', 'integer', ['limit' => 11, 'null' => false, 'comment' => '统计日期(YYYYMMDD)', 'signed' => false])
|
||||
->addColumn('referer_domain', 'string', ['limit' => 255, 'null' => false, 'comment' => 'Referer 来源域名(direct/unknown)'])
|
||||
->addColumn('pv', 'integer', ['limit' => 11, 'default' => 0, 'comment' => '页面浏览量'])
|
||||
->addColumn('uv', 'integer', ['limit' => 11, 'default' => 0, 'comment' => '独立访客数'])
|
||||
->addIndex(['stat_date', 'referer_domain'], ['unique' => true, 'name' => 'uniq_date_referer'])
|
||||
->addIndex(['stat_date'], ['name' => 'idx_stat_date'])
|
||||
->create();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user