refactor: remove ExternalType from CustomerIdentity and related structures

This commit is contained in:
mlogclub
2026-04-27 18:40:25 +08:00
parent f8b44ab127
commit 73b78a817d
8 changed files with 23 additions and 58 deletions
+7 -8
View File
@@ -1,12 +1,11 @@
package response
type WidgetConfigResponse struct {
ChannelID string `json:"channelId"`
ChannelType string `json:"channelType"`
ExternalSource string `json:"externalSource"`
Title string `json:"title"`
Subtitle string `json:"subtitle"`
ThemeColor string `json:"themeColor"`
Position string `json:"position"`
Width string `json:"width"`
ChannelID string `json:"channelId"`
ChannelType string `json:"channelType"`
Title string `json:"title"`
Subtitle string `json:"subtitle"`
ThemeColor string `json:"themeColor"`
Position string `json:"position"`
Width string `json:"width"`
}
-20
View File
@@ -6,26 +6,6 @@ func GetCustomerSourceTypeLabel(sourceType ExternalSource) string {
return GetExternalSourceLabel(ExternalSource(sourceType))
}
// ExternalType 客户外部身份类型。
type ExternalType string
const (
ExternalTypeGuest ExternalType = "guest"
ExternalTypeUser ExternalType = "user"
)
var externalTypeLabelMap = map[ExternalType]string{
ExternalTypeGuest: "访客",
ExternalTypeUser: "用户",
}
func GetExternalTypeLabel(externalType ExternalType) string {
if s, ok := externalTypeLabelMap[externalType]; ok {
return s
}
return string(externalType)
}
// 联系方式类型
type ContactType string
+2 -2
View File
@@ -6,13 +6,13 @@ package enums
type ExternalSource string
const (
ExternalSourceWebChat ExternalSource = "web_chat"
ExternalSourceWebChat ExternalSource = "guest"
ExternalSourceWechatMP ExternalSource = "wechat_mp"
ExternalSourceWxWorkKF ExternalSource = "wxwork_kf"
)
var externalSourceLabelMap = map[ExternalSource]string{
ExternalSourceWebChat: "网页客服",
ExternalSourceWebChat: "访客",
ExternalSourceWechatMP: "微信公众号",
ExternalSourceWxWorkKF: "企业微信客服",
}
@@ -15,7 +15,6 @@ import (
// ExternalInfo 外部访客身份(IM 客户),与站内 AuthPrincipal 区分。
type ExternalInfo struct {
ExternalSource enums.ExternalSource `json:"externalSource"`
ExternalType enums.ExternalType `json:"externalType"`
ExternalID string `json:"externalId"`
ExternalName string `json:"externalName"`
}
@@ -36,7 +35,6 @@ func GetExternalInfo(ctx iris.Context) (*ExternalInfo, error) {
return &ExternalInfo{
ExternalSource: externalSource,
// TODO: 对接业务系统后,根据业务系统用户信息识别 user;未对接时统一按访客处理。
ExternalType: enums.ExternalTypeGuest,
ExternalID: externalID,
ExternalName: parseExternalName(ctx),
}, nil