package achievement import ( "time" "gorm.io/gorm" ) type Theme struct { ID uint `gorm:"primaryKey" json:"id"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` DeletedAt gorm.DeletedAt `gorm:"index" json:"-"` Name string `gorm:"size:50;not null;comment:主题名称" json:"name"` Key string `gorm:"size:50;uniqueIndex;not null;comment:主题标识" json:"key"` Icon string `gorm:"size:255;comment:主题图标" json:"icon"` SortOrder int `gorm:"default:0;comment:排序" json:"sort_order"` IsActive bool `gorm:"default:true;comment:是否启用" json:"is_active"` Levels []Level `gorm:"foreignKey:ThemeID" json:"levels,omitempty"` } func (Theme) TableName() string { return "fa_achievement_theme" } type Level struct { ID uint `gorm:"primaryKey" json:"id"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` DeletedAt gorm.DeletedAt `gorm:"index" json:"-"` ThemeID uint `gorm:"index;not null;comment:主题ID" json:"theme_id"` Name string `gorm:"size:50;not null;comment:等级名称" json:"name"` Icon string `gorm:"size:255;comment:等级图标" json:"icon"` RequiredDays int `gorm:"not null;default:0;comment:所需打卡天数" json:"required_days"` SortOrder int `gorm:"default:0;comment:排序" json:"sort_order"` } func (Level) TableName() string { return "fa_achievement_level" }