refactor: clean code

This commit is contained in:
Fu Diwei
2025-01-17 18:01:47 +08:00
parent dab6ad917c
commit 0869eaafdd
12 changed files with 50 additions and 57 deletions

View File

@@ -70,11 +70,11 @@ func buildExpireSoonNotification(certificates []*domain.Certificate) *struct {
message := defaultExpireMessage
// 查询模板信息
settingRepo := repository.NewSettingsRepository()
setting, err := settingRepo.GetByName(context.Background(), "notifyTemplates")
settingsRepo := repository.NewSettingsRepository()
settings, err := settingsRepo.GetByName(context.Background(), "notifyTemplates")
if err == nil {
var templates *domain.NotifyTemplatesSettingsContent
json.Unmarshal([]byte(setting.Content), &templates)
json.Unmarshal([]byte(settings.Content), &templates)
if templates != nil && len(templates.NotifyTemplates) > 0 {
subject = templates.NotifyTemplates[0].Subject