feat(nginx-log): curd 生成 raw/position 后台并改只读

- NginxAccessLog + NginxLogPosition Scheme 加 #[Component] 注解
- Scheme Table name 补 ul_ 前缀(curd 严格校验要求)
- curd 生成 nginx 模块完整后台(controller/model/view/js)
- Base/App 双层只读控制器(参照 TimerLogBase 范式)
  - AccessLogBase: add/edit/delete/modify 全部 error
  - LogPositionBase: 同上
- 视图改造:
  - access_log 裁剪到 8 列核心字段(time_local/method/uri/status/remote_addr/request_time/body_bytes_sent/http_user_agent)
  - status/request_time 自定义 badge 渲染
  - toolbar 清空 + operat 仅保留详情(B 类只读页面)
  - log_position 全字段 + 只读化
- HTTP 验证:index 200 OK + add/edit/delete/modify 全部返回错误
This commit is contained in:
augushong
2026-07-28 06:21:13 +08:00
parent 7987001cd2
commit d5329cdd45
26 changed files with 1203 additions and 34 deletions

View File

@@ -5,9 +5,10 @@ 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\Component;
use app\common\scheme\attribute\Index;
#[Table(name: 'nginx_access_log', comment: 'nginx 访问日志明细(解析入库)')]
#[Table(name: 'ul_nginx_access_log', comment: 'nginx 访问日志明细(解析入库)')]
#[Index(columns: ['time_local'], name: 'idx_time_local', type: 'NORMAL')]
#[Index(columns: ['remote_addr'], name: 'idx_remote_addr', type: 'NORMAL')]
#[Index(columns: ['status'], name: 'idx_status', type: 'NORMAL')]
@@ -19,59 +20,78 @@ class NginxAccessLog extends BaseScheme
public $id;
#[Field(type: 'varchar', length: 500, nullable: false, comment: '来源日志文件路径')]
#[Component(type: 'text', options: [])]
public $file_path;
#[Field(type: 'varchar', length: 45, nullable: false, comment: '客户端 IP含 IPv6')]
#[Component(type: 'text', options: [])]
public $remote_addr;
#[Field(type: 'varchar', length: 100, nullable: true, comment: 'HTTP 认证用户名')]
#[Component(type: 'text', options: [])]
public $remote_user;
#[Field(type: 'int', length: 11, nullable: false, unsigned: true, comment: '请求时间戳(业务时区)')]
#[Component(type: 'date', options: [])]
public $time_local;
#[Field(type: 'varchar', length: 10, nullable: true, comment: 'HTTP 方法')]
#[Component(type: 'text', options: [])]
public $method;
#[Field(type: 'varchar', length: 255, nullable: false, comment: '请求 URI超 255 截断)')]
#[Component(type: 'text', options: [])]
public $uri;
#[Field(type: 'varchar', length: 500, nullable: false, default: '', comment: '查询字符串')]
#[Component(type: 'text', options: [])]
public $query_string;
#[Field(type: 'varchar', length: 10, nullable: true, comment: 'HTTP 协议版本')]
#[Component(type: 'text', options: [])]
public $http_version;
#[Field(type: 'int', length: 11, default: '0', comment: 'HTTP 状态码')]
#[Component(type: 'text', options: [])]
public $status;
#[Field(type: 'bigint', default: '0', comment: '响应体字节数')]
#[Component(type: 'text', options: [])]
public $body_bytes_sent;
#[Field(type: 'varchar', length: 500, nullable: false, default: '', comment: 'Referer')]
#[Component(type: 'text', options: [])]
public $http_referer;
#[Field(type: 'varchar', length: 500, nullable: false, default: '', comment: 'User-Agent超 500 截断)')]
#[Component(type: 'textarea', options: [])]
public $http_user_agent;
#[Field(type: 'decimal', precision: 10, scale: 3, default: '0.000', comment: 'nginx 请求总耗时(秒)')]
#[Component(type: 'text', options: [])]
public $request_time;
#[Field(type: 'decimal', precision: 10, scale: 3, default: '0.000', comment: 'upstream 响应时间(秒)')]
#[Component(type: 'text', options: [])]
public $upstream_response_time;
#[Field(type: 'bigint', default: '0', comment: '总发送字节数(含 header')]
#[Component(type: 'text', options: [])]
public $bytes_sent;
#[Field(type: 'varchar', length: 50, nullable: true, comment: '国家GeoIP 预留)')]
#[Component(type: 'text', options: [])]
public $country;
#[Field(type: 'varchar', length: 50, nullable: true, comment: '省份GeoIP 预留)')]
#[Component(type: 'text', options: [])]
public $province;
#[Field(type: 'varchar', length: 50, nullable: true, comment: '城市GeoIP 预留)')]
#[Component(type: 'text', options: [])]
public $city;
#[Field(type: 'int', length: 11, unsigned: true, comment: '入库时间戳')]
#[Component(type: 'date', options: [])]
public $create_time;
}