新增合作与反馈入口配置

This commit is contained in:
yml2213
2026-08-15 16:37:30 +08:00
parent 134d6fa05e
commit d9f552577a
14 changed files with 332 additions and 36 deletions
@@ -0,0 +1,43 @@
package systemconfig
import (
"encoding/json"
"strings"
)
const cooperationFeedbackConfigKey = "mobile.cooperation_feedback"
func defaultCooperationFeedback() CooperationFeedbackConfig {
return CooperationFeedbackConfig{
Title: "合作与反馈",
Subtitle: "点击查看联系方式",
ImageURL: "",
Enabled: true,
}
}
func defaultCooperationFeedbackConfigValue() string {
raw, err := json.Marshal(defaultCooperationFeedback())
if err != nil {
return `{"title":"合作与反馈","subtitle":"点击查看联系方式","image_url":"","enabled":true}`
}
return string(raw)
}
func normalizeCooperationFeedback(item CooperationFeedbackConfig) CooperationFeedbackConfig {
def := defaultCooperationFeedback()
title := strings.TrimSpace(item.Title)
if title == "" {
title = def.Title
}
subtitle := strings.TrimSpace(item.Subtitle)
if subtitle == "" {
subtitle = def.Subtitle
}
return CooperationFeedbackConfig{
Title: title,
Subtitle: subtitle,
ImageURL: strings.TrimSpace(item.ImageURL),
Enabled: item.Enabled,
}
}