9d2abcd702
Co-authored-by: Copilot <copilot@github.com>
34 lines
783 B
Go
34 lines
783 B
Go
package enums
|
|
|
|
// ExternalSource 外部身份来源。
|
|
//
|
|
// 与 ExternalID 组合即可唯一标识某渠道下的访客身份。
|
|
type ExternalSource string
|
|
|
|
const (
|
|
ExternalSourceGuest ExternalSource = "guest"
|
|
ExternalSourceWxWorkKF ExternalSource = "wxwork_kf"
|
|
)
|
|
|
|
var externalSourceLabelMap = map[ExternalSource]string{
|
|
ExternalSourceGuest: "访客",
|
|
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 ExternalSourceGuest:
|
|
return true
|
|
default:
|
|
return false
|
|
}
|
|
}
|