This commit is contained in:
2026-07-09 14:15:50 +08:00
parent 4e3a6ddb12
commit 21a03b9bc9
2 changed files with 11 additions and 3 deletions
-3
View File
@@ -14,7 +14,6 @@ type FieldDef struct {
Type string `json:"type"`
Options []string `json:"options"`
Required bool `json:"required"`
Multi bool `json:"multi" dc:"是否允许多选"`
}
// ContentTypeFields 每种内容类型的字段配置
@@ -33,8 +32,6 @@ var ContentTypeFields = map[string][]FieldDef{
TypeAdVideo: {
{Key: "广告类型", Label: "广告类型", Type: "select", Options: AdTypes, Required: true},
{Key: "产品行业", Label: "产品行业", Type: "select", Options: AdIndustries, Required: true},
{Key: "情感基调", Label: "情感基调", Type: "select", Options: AdEmotions, Required: true},
{Key: "口播类型", Label: "口播类型", Type: "select", Options: AdNarrationTypes, Required: true},
},
}
+11
View File
@@ -28,6 +28,8 @@ func init() {
video_query_url TEXT NOT NULL DEFAULT '',
max_single_duration INTEGER NOT NULL DEFAULT 15,
min_single_duration INTEGER NOT NULL DEFAULT 5,
chat_schema TEXT NOT NULL DEFAULT '',
video_schema TEXT NOT NULL DEFAULT '',
created_at DATETIME,
updated_at DATETIME
)`); err != nil {
@@ -47,6 +49,15 @@ func init() {
g.Log().Debugf(ctx, "删除孤儿列 %s 失败(可能已删除): %v", col, err)
}
}
// 迁移:补充新字段
for _, col := range []string{
"chat_schema",
"video_schema",
} {
if _, err := g.DB().Exec(ctx, `ALTER TABLE `+public.TableNameModelConfig+` ADD COLUMN `+col+` TEXT NOT NULL DEFAULT ''`); err != nil {
g.Log().Debugf(ctx, "添加列 %s 失败(可能已存在): %v", col, err)
}
}
}
// GetFirst 获取第一条配置行