feat(nginx-log): 新增 6 张表 phinx migration + Scheme + model

This commit is contained in:
augushong
2026-07-28 00:03:49 +08:00
parent f48e0947cb
commit 0d19881a22
18 changed files with 590 additions and 0 deletions

View File

@@ -0,0 +1,50 @@
<?php
namespace app\admin\scheme;
use app\common\scheme\BaseScheme;
use app\common\scheme\attribute\Table;
use app\common\scheme\attribute\Field;
use app\common\scheme\attribute\Index;
#[Table(name: 'nginx_stat_hour', comment: 'nginx 按小时聚合统计')]
#[Index(columns: ['stat_date', 'stat_hour'], name: 'uniq_date_hour', type: 'UNIQUE')]
#[Index(columns: ['stat_date'], name: 'idx_stat_date', type: 'NORMAL')]
class NginxStatHour extends BaseScheme
{
#[Field(type: 'int', length: 11, nullable: false, unsigned: true, autoIncrement: true, primary: true)]
public $id;
#[Field(type: 'int', length: 11, nullable: false, unsigned: true, comment: '统计日期(YYYYMMDD)')]
public $stat_date;
#[Field(type: 'tinyint', length: 2, default: '0', unsigned: true, comment: '小时(0-23)')]
public $stat_hour;
#[Field(type: 'int', length: 11, default: '0', comment: '页面浏览量')]
public $pv;
#[Field(type: 'int', length: 11, default: '0', comment: '独立访客数')]
public $uv;
#[Field(type: 'bigint', default: '0', comment: '总流量(字节)')]
public $total_bytes;
#[Field(type: 'int', length: 11, default: '0', comment: '2xx 响应数')]
public $status_2xx;
#[Field(type: 'int', length: 11, default: '0', comment: '3xx 响应数')]
public $status_3xx;
#[Field(type: 'int', length: 11, default: '0', comment: '4xx 响应数')]
public $status_4xx;
#[Field(type: 'int', length: 11, default: '0', comment: '5xx 响应数')]
public $status_5xx;
#[Field(type: 'int', length: 11, default: '0', comment: '其他状态码响应数')]
public $status_other;
#[Field(type: 'decimal', precision: 10, scale: 3, default: '0.000', comment: '平均请求耗时(秒)')]
public $avg_request_time;
}