fbabb174d2
- Updated output path for generated enums to reflect new structure. - Enhanced ChannelController to handle WeChat MP OAuth authorization and callback. - Introduced WechatMPChannelConfig DTO for WeChat MP specific configurations. - Modified WidgetConfigResponse to include channel type and external source. - Added enums for WeChat MP channel type and external source. - Implemented OAuth flow for WeChat MP, including state signing and verification. - Updated frontend forms to accommodate WeChat MP configurations. - Enhanced API interactions to support WeChat MP external ID and source. - Updated generated enums to include WeChat MP external source.
36 lines
915 B
Go
36 lines
915 B
Go
package enums
|
|
|
|
// ExternalSource 外部身份来源。
|
|
//
|
|
// 与 ExternalID 组合即可唯一标识某渠道下的访客身份。
|
|
type ExternalSource string
|
|
|
|
const (
|
|
ExternalSourceWebChat ExternalSource = "web_chat"
|
|
ExternalSourceWechatMP ExternalSource = "wechat_mp"
|
|
ExternalSourceWxWorkKF ExternalSource = "wxwork_kf"
|
|
)
|
|
|
|
var externalSourceLabelMap = map[ExternalSource]string{
|
|
ExternalSourceWebChat: "网页客服",
|
|
ExternalSourceWechatMP: "微信公众号",
|
|
ExternalSourceWxWorkKF: "企业微信客服",
|
|
}
|
|
|
|
func GetExternalSourceLabel(v ExternalSource) string {
|
|
if s, ok := externalSourceLabelMap[v]; ok {
|
|
return s
|
|
}
|
|
return string(v)
|
|
}
|
|
|
|
// IsAllowedOpenImExternalSource 开放 IM 入口允许的外部来源(闭集校验)。
|
|
func IsAllowedOpenImExternalSource(s ExternalSource) bool {
|
|
switch s {
|
|
case ExternalSourceWebChat, ExternalSourceWechatMP:
|
|
return true
|
|
default:
|
|
return false
|
|
}
|
|
}
|