63 lines
4.2 KiB
Go
63 lines
4.2 KiB
Go
package model
|
||
|
||
import "gorm.io/plugin/soft_delete"
|
||
|
||
// Theme 主题模板表:全站换肤模板
|
||
type Theme struct {
|
||
ID int `gorm:"primaryKey" json:"id"` // 主题ID
|
||
Code string `gorm:"size:32;uniqueIndex" json:"code"` // 主题编码(body 挂 theme-编码 class)
|
||
Name string `gorm:"size:32" json:"name"` // 主题名称
|
||
Description string `gorm:"size:255" json:"description"` // 风格描述
|
||
CSSVars string `gorm:"column:css_vars" json:"css_vars"` // CSS 变量 JSON(写入 :root 生效)
|
||
PreviewColors string `gorm:"size:64" json:"preview_colors"` // 预览色块(逗号分隔)
|
||
Sort int `gorm:"default:0" json:"sort"` // 排序权重
|
||
Status int `gorm:"default:1" json:"status"` // 状态:1可用 2停用
|
||
CreatedAt int64 `gorm:"autoCreateTime" json:"created_at"` // 创建时间(int 时间戳)
|
||
UpdatedAt int64 `gorm:"autoUpdateTime" json:"updated_at"` // 更新时间(int 时间戳)
|
||
DeletedAt soft_delete.DeletedAt `gorm:"default:0" json:"-"` // 软删除(0=未删除)
|
||
}
|
||
|
||
// TableName 指定表名
|
||
func (Theme) TableName() string { return "themes" }
|
||
|
||
// SiteConfig 站点配置表:键值对形式的全站配置
|
||
type SiteConfig struct {
|
||
ID int `gorm:"primaryKey" json:"id"` // 配置ID
|
||
ConfigKey string `gorm:"size:64;uniqueIndex" json:"config_key"` // 配置键
|
||
ConfigValue string `gorm:"size:500" json:"config_value"` // 配置值(字符串,自行转换)
|
||
Remark string `gorm:"size:255" json:"remark"` // 配置说明
|
||
CreatedAt int64 `gorm:"autoCreateTime" json:"created_at"` // 创建时间(int 时间戳)
|
||
UpdatedAt int64 `gorm:"autoUpdateTime" json:"updated_at"` // 更新时间(int 时间戳)
|
||
}
|
||
|
||
// TableName 指定表名
|
||
func (SiteConfig) TableName() string { return "site_configs" }
|
||
|
||
// 站点配置键名常量(与 sql/init.sql 中的种子数据对应)
|
||
const (
|
||
ConfKeySiteName = "site_name" // 站点名称
|
||
ConfKeyActiveTheme = "active_theme" // 当前启用主题编码
|
||
ConfKeyAnnouncement = "announcement" // 站点公告
|
||
ConfKeySignBasePoints = "signin_base_points" // 签到基础积分
|
||
ConfKeySignStreakStep = "signin_streak_step" // 连签递增积分
|
||
ConfKeySignStreakCap = "signin_streak_cap" // 连签封顶天数
|
||
ConfKeyRegisterGift = "register_gift_points" // 注册赠送积分
|
||
ConfKeyBattleWinPoints = "battle_win_points" // 对战获胜奖励积分
|
||
// 大厅游戏轮播(参与轮播的游戏在 games.carousel 上配置)
|
||
ConfKeyCarouselStyle = "carousel_style" // 轮播效果:slide横滑/fade淡入淡出/coverflow封面流/cards卡片堆叠
|
||
ConfKeyCarouselInterval = "carousel_interval" // 自动轮播间隔(秒)
|
||
// AI 大模型接入配置(后台可改,非空时覆盖 config.yaml 中的同名项)
|
||
ConfKeyAIProvider = "ai_provider" // 全站统一的对战AI提供方:rule/spark/deepseek(前台只选难度)
|
||
ConfKeyAISparkKey = "ai_spark_key" // 讯飞星火 APIPassword
|
||
ConfKeyAISparkBase = "ai_spark_base" // 讯飞星火接口地址
|
||
ConfKeyAISparkModel = "ai_spark_model" // 讯飞星火模型名
|
||
ConfKeyAIDeepSeekKey = "ai_deepseek_key" // DeepSeek API Key
|
||
ConfKeyAIDeepSeekBase = "ai_deepseek_base" // DeepSeek 接口地址
|
||
ConfKeyAIDeepSeekModel = "ai_deepseek_model" // DeepSeek 模型名
|
||
// 桌面端版本升级配置(后台可改,桌面端启动时与菜单「检查更新…」会拉取)
|
||
ConfKeyAppVersion = "app_version" // 桌面端最新版本号(语义化,如 1.0.1)
|
||
ConfKeyAppDownloadURL = "app_download_url" // 最新安装包下载地址(https://...)
|
||
ConfKeyAppReleaseNotes = "app_release_notes" // 更新说明(一行简短文案,桌面端弹窗展示)
|
||
ConfKeyAppForceUpdate = "app_force_update" // 是否强制更新:1=强制 0=不强制(强制时桌面端不允许跳过)
|
||
)
|