package model import "time" // AuditLog 操作日志模型 // Logan.Li type AuditLog struct { ID uint `json:"id" gorm:"primaryKey"` UserID uint `json:"user_id"` Username string `json:"username" gorm:"size:100"` Action string `json:"action" gorm:"size:50;not null"` // create / update / delete / activate / renew / revoke ... TargetType string `json:"target_type" gorm:"size:50"` // license / customer / product / order ... TargetID uint `json:"target_id"` TargetName string `json:"target_name" gorm:"size:200"` OldData string `json:"old_data" gorm:"type:text"` // JSON NewData string `json:"new_data" gorm:"type:text"` // JSON Detail string `json:"detail" gorm:"type:text"` Result string `json:"result" gorm:"size:20"` // success / fail ErrorMessage string `json:"error_message" gorm:"type:text"` IP string `json:"ip" gorm:"size:50"` CreatedAt time.Time `json:"created_at"` } // TableName 指定表名 // Logan.Li func (AuditLog) TableName() string { return "audit_logs" } // LicenseTemplate License 模板(用于快速创建) // Logan.Li type LicenseTemplate struct { ID uint `json:"id" gorm:"primaryKey"` Name string `json:"name" gorm:"size:100;not null"` Duration int `json:"duration" gorm:"default:365"` // 天数,0 表示永久 MaxActivations int `json:"max_activations" gorm:"default:1"` Description string `json:"description" gorm:"type:text"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` } // TableName 指定表名 // Logan.Li func (LicenseTemplate) TableName() string { return "license_templates" }