yintai2/scripts/ddl_yt_admin_operate_log.sql

27 lines
1.7 KiB
SQL
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

CREATE TABLE IF NOT EXISTS `yt_admin_operate_log` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
`account` varchar(64) NOT NULL DEFAULT '' COMMENT '登录名,登录失败时取请求里的账号',
`user_id` bigint NOT NULL DEFAULT 0 COMMENT '用户ID,未能识别时为0',
`role_id` bigint NOT NULL DEFAULT 0 COMMENT '角色ID',
`create_time` bigint NOT NULL DEFAULT 0 COMMENT '操作时间,unix秒',
`cost_ms` int NOT NULL DEFAULT 0 COMMENT '耗时,毫秒',
`ip` varchar(64) NOT NULL DEFAULT '' COMMENT '客户端IP',
`forwarded_for` varchar(512) NOT NULL DEFAULT '' COMMENT '原始X-Forwarded-For',
`method` varchar(16) NOT NULL DEFAULT '' COMMENT '请求方法',
`path` varchar(255) NOT NULL DEFAULT '' COMMENT '请求路径',
`query` varchar(1024) NOT NULL DEFAULT '' COMMENT 'URL查询参数',
`request` text NOT NULL COMMENT '请求体,密码明文,token已打码,超长截断',
`action` varchar(64) NOT NULL DEFAULT '' COMMENT '动作名称',
`code` int NOT NULL DEFAULT 0 COMMENT '业务码,0表示成功',
`message` varchar(512) NOT NULL DEFAULT '' COMMENT '返回文案',
`response` text NOT NULL COMMENT '响应体,token已打码,验证码图片不保存,超长截断',
`success` tinyint NOT NULL DEFAULT 0 COMMENT '1成功 0失败',
`header` text NOT NULL COMMENT '请求头,token和cookie已打码',
PRIMARY KEY (`id`),
KEY `idx_account_time` (`account`, `create_time`),
KEY `idx_create_time` (`create_time`),
KEY `idx_path_time` (`path`, `create_time`),
KEY `idx_ip_time` (`ip`, `create_time`),
KEY `idx_success_time` (`success`, `create_time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='管理员操作日志';