40 lines
1.7 KiB
Go
40 lines
1.7 KiB
Go
package domain
|
||
|
||
import "time"
|
||
|
||
// ThemeConfig 主题配置
|
||
type ThemeConfig struct {
|
||
ID int64 `gorm:"primaryKey;autoIncrement" json:"id"`
|
||
Name string `gorm:"type:varchar(50);uniqueIndex;not null" json:"name"` // 主题名称
|
||
IsDefault bool `gorm:"default:false" json:"is_default"` // 是否默认主题
|
||
LogoURL string `gorm:"type:varchar(500)" json:"logo_url"` // Logo URL
|
||
FaviconURL string `gorm:"type:varchar(500)" json:"favicon_url"` // Favicon URL
|
||
PrimaryColor string `gorm:"type:varchar(20)" json:"primary_color"` // 主色调(如 #1890ff)
|
||
SecondaryColor string `gorm:"type:varchar(20)" json:"secondary_color"` // 辅助色
|
||
BackgroundColor string `gorm:"type:varchar(20)" json:"background_color"` // 背景色
|
||
TextColor string `gorm:"type:varchar(20)" json:"text_color"` // 文字颜色
|
||
CustomCSS string `gorm:"type:text" json:"custom_css"` // 自定义CSS
|
||
CustomJS string `gorm:"type:text" json:"custom_js"` // 自定义JS
|
||
Enabled bool `gorm:"default:true" json:"enabled"` // 是否启用
|
||
CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"`
|
||
UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"`
|
||
}
|
||
|
||
// TableName 指定表名
|
||
func (ThemeConfig) TableName() string {
|
||
return "theme_configs"
|
||
}
|
||
|
||
// DefaultThemeConfig 返回默认主题配置
|
||
func DefaultThemeConfig() *ThemeConfig {
|
||
return &ThemeConfig{
|
||
Name: "default",
|
||
IsDefault: true,
|
||
PrimaryColor: "#1890ff",
|
||
SecondaryColor: "#52c41a",
|
||
BackgroundColor: "#ffffff",
|
||
TextColor: "#333333",
|
||
Enabled: true,
|
||
}
|
||
}
|