feat: add message tmplate #76

This commit is contained in:
duorameng
2026-04-07 21:34:36 +08:00
parent 691dda1bae
commit a85e253b45
9 changed files with 443 additions and 24 deletions
+11
View File
@@ -87,6 +87,17 @@ func (s *SettingsService) InitSettings() error {
}
}
// 从 constant.DefaultSettings 初始化所有缺少的通知模板
if notifyDefaults, ok := constant.DefaultSettings[constant.SectionNotify]; ok {
for k, v := range notifyDefaults {
var count int64
database.DB.Model(&models.Setting{}).Where(&models.Setting{Section: constant.SectionNotify, Key: k}).Count(&count)
if count == 0 {
s.Set(constant.SectionNotify, k, v)
}
}
}
// 初始化或获取 JWT Secret 密码
var secCount int64
database.DB.Model(&models.Setting{}).Where(&models.Setting{Section: constant.SectionSecurity, Key: constant.KeySecret}).Count(&secCount)