feat: add web channel configuration support and update widget response structure

This commit is contained in:
mlogclub
2026-04-24 22:24:19 +08:00
parent a262a865a0
commit ea94837db2
9 changed files with 400 additions and 114 deletions
@@ -3,6 +3,7 @@ package open
import (
"cs-agent/internal/pkg/dto/response"
"cs-agent/internal/pkg/irisx"
"cs-agent/internal/services"
"github.com/kataras/iris/v12"
"github.com/mlogclub/simple/web"
@@ -17,9 +18,19 @@ func (c *ImWidgetController) AnyConfig() *web.JsonResult {
if channel == nil {
return web.JsonErrorMsg("接入渠道未初始化")
}
cfg, err := services.ChannelService.ParseWebChannelConfig(channel.ConfigJSON)
if err != nil {
return web.JsonErrorMsg("Web渠道配置不合法")
}
ret := response.WidgetConfigResponse{
ChannelID: channel.ChannelID,
ChannelID: channel.ChannelID,
Title: cfg.Title,
Subtitle: cfg.Subtitle,
WelcomeText: cfg.WelcomeText,
ThemeColor: cfg.ThemeColor,
Position: cfg.Position,
Width: cfg.Width,
}
return web.JsonData(ret)
}