refactor: remove welcomeText field from WebChannelConfig and related components

This commit is contained in:
mlogclub
2026-04-24 22:27:30 +08:00
parent ea94837db2
commit f5da8de49d
9 changed files with 33 additions and 59 deletions
@@ -24,13 +24,12 @@ func (c *ImWidgetController) AnyConfig() *web.JsonResult {
}
ret := response.WidgetConfigResponse{
ChannelID: channel.ChannelID,
Title: cfg.Title,
Subtitle: cfg.Subtitle,
WelcomeText: cfg.WelcomeText,
ThemeColor: cfg.ThemeColor,
Position: cfg.Position,
Width: cfg.Width,
ChannelID: channel.ChannelID,
Title: cfg.Title,
Subtitle: cfg.Subtitle,
ThemeColor: cfg.ThemeColor,
Position: cfg.Position,
Width: cfg.Width,
}
return web.JsonData(ret)
}
+5 -6
View File
@@ -17,10 +17,9 @@ type WxWorkKFChannelConfig struct {
}
type WebChannelConfig struct {
Title string `json:"title"`
Subtitle string `json:"subtitle"`
WelcomeText string `json:"welcomeText"`
ThemeColor string `json:"themeColor"`
Position string `json:"position"`
Width string `json:"width"`
Title string `json:"title"`
Subtitle string `json:"subtitle"`
ThemeColor string `json:"themeColor"`
Position string `json:"position"`
Width string `json:"width"`
}
+6 -7
View File
@@ -1,11 +1,10 @@
package response
type WidgetConfigResponse struct {
ChannelID string `json:"channelId"`
Title string `json:"title"`
Subtitle string `json:"subtitle"`
WelcomeText string `json:"welcomeText"`
ThemeColor string `json:"themeColor"`
Position string `json:"position"`
Width string `json:"width"`
ChannelID string `json:"channelId"`
Title string `json:"title"`
Subtitle string `json:"subtitle"`
ThemeColor string `json:"themeColor"`
Position string `json:"position"`
Width string `json:"width"`
}
+5 -7
View File
@@ -162,12 +162,11 @@ func (s *channelService) ParseWxWorkKFChannelConfig(raw string) (*dto.WxWorkKFCh
func (s *channelService) ParseWebChannelConfig(raw string) (*dto.WebChannelConfig, error) {
raw = strings.TrimSpace(raw)
cfg := &dto.WebChannelConfig{
Title: "在线客服",
Subtitle: "欢迎咨询",
WelcomeText: "",
ThemeColor: "#2563eb",
Position: "right",
Width: "380px",
Title: "在线客服",
Subtitle: "欢迎咨询",
ThemeColor: "#2563eb",
Position: "right",
Width: "380px",
}
if raw != "" {
if err := json.Unmarshal([]byte(raw), cfg); err != nil {
@@ -179,7 +178,6 @@ func (s *channelService) ParseWebChannelConfig(raw string) (*dto.WebChannelConfi
cfg.Title = "在线客服"
}
cfg.Subtitle = strings.TrimSpace(cfg.Subtitle)
cfg.WelcomeText = strings.TrimSpace(cfg.WelcomeText)
cfg.ThemeColor = strings.TrimSpace(cfg.ThemeColor)
if cfg.ThemeColor == "" {
cfg.ThemeColor = "#2563eb"