init: EZOps AIOps 智能运维平台
- 前端: React 18 + TypeScript + Vite + Tailwind CSS + shadcn/ui - 后端: Go + Gin + GORM + JWT (golang-jwt/jwt/v5) - 功能: 服务器管理、K8s集群、监控告警、CI/CD、自动化运维、审批流程、审计日志 - 文档: 设计文档(ROADMAP/PDD/架构/模块)
This commit is contained in:
commit
7d6674bddd
156 files changed
+45704
No files matched your search
@@ -0,0 +1,68 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// AuditLog 审计日志模型
|
||||
type AuditLog struct {
|
||||
ID uint `gorm:"primarykey" json:"id"`
|
||||
UserID *uint `json:"user_id"`
|
||||
Username string `gorm:"size:64" json:"username"`
|
||||
IP string `gorm:"size:64" json:"ip"`
|
||||
UserAgent string `gorm:"size:500" json:"user_agent"`
|
||||
Module string `gorm:"size:64" json:"module"`
|
||||
Action string `gorm:"size:64" json:"action"`
|
||||
Resource string `gorm:"size:128" json:"resource"`
|
||||
ResourceID string `gorm:"size:64" json:"resource_id"`
|
||||
Request string `gorm:"type:text" json:"request"`
|
||||
Response string `gorm:"type:text" json:"response"`
|
||||
Status int `json:"status"`
|
||||
Duration int `json:"duration"` // ms
|
||||
Error string `gorm:"type:text" json:"error"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
}
|
||||
|
||||
// TableName 表名
|
||||
func (AuditLog) TableName() string {
|
||||
return "audit_logs"
|
||||
}
|
||||
|
||||
// AuditLogQuery 审计日志查询
|
||||
type AuditLogQuery struct {
|
||||
UserID *uint `form:"user_id"`
|
||||
Username string `form:"username"`
|
||||
Module string `form:"module"`
|
||||
Action string `form:"action"`
|
||||
StartTime string `form:"start_time"`
|
||||
EndTime string `form:"end_time"`
|
||||
Page int `form:"page,default=1"`
|
||||
PageSize int `form:"page_size,default=20"`
|
||||
}
|
||||
|
||||
// AuditLogListResponse 审计日志列表响应
|
||||
type AuditLogListResponse struct {
|
||||
List []AuditLog `json:"list"`
|
||||
Total int64 `json:"total"`
|
||||
}
|
||||
|
||||
// AuditStats 审计统计
|
||||
type AuditStats struct {
|
||||
TodayCount int64 `json:"today_count"`
|
||||
WeekCount int64 `json:"week_count"`
|
||||
MonthCount int64 `json:"month_count"`
|
||||
TopModules []ModuleStat `json:"top_modules"`
|
||||
TopUsers []UserStat `json:"top_users"`
|
||||
}
|
||||
|
||||
// ModuleStat 模块统计
|
||||
type ModuleStat struct {
|
||||
Module string `json:"module"`
|
||||
Count int64 `json:"count"`
|
||||
}
|
||||
|
||||
// UserStat 用户统计
|
||||
type UserStat struct {
|
||||
Username string `json:"username"`
|
||||
Count int64 `json:"count"`
|
||||
}
|
||||
Reference in new issue
Block a user