package model import "time" // AuditSettings 审计策略配置(单行) // Logan.Li type AuditSettings struct { ID uint `gorm:"primarykey" json:"id"` RetentionDays int `gorm:"default:180;not null" json:"retention_days"` RecordAll bool `gorm:"default:true" json:"record_all"` LastCleanupAt *time.Time `json:"last_cleanup_at,omitempty"` LastCleanupSummary string `gorm:"size:500" json:"last_cleanup_summary,omitempty"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` } func (AuditSettings) TableName() string { return "sys_audit_settings" } // AllowedAuditRetentionDays 允许的日志保留天数 // Logan.Li var AllowedAuditRetentionDays = []int{7, 15, 30, 90, 180, 365} // IsValidRetentionDays 校验保留天数 // Logan.Li func IsValidRetentionDays(days int) bool { for _, d := range AllowedAuditRetentionDays { if d == days { return true } } return false }