feat: add customer service IM bindings
This commit is contained in:
@@ -302,19 +302,27 @@ type CustomerServiceEditInp struct {
|
||||
AvatarUrl string `json:"avatarUrl" v:"max-length:1000#头像地址不能超过1000个字符"`
|
||||
WorkTime string `json:"workTime" v:"required|max-length:200#工作时间不能为空|工作时间不能超过200个字符"`
|
||||
OnlineStatus int `json:"onlineStatus" v:"required|in:1,2#在线状态不能为空|在线状态不合法"`
|
||||
ServiceUrl string `json:"serviceUrl" v:"required|max-length:1000#客服链接不能为空|客服链接不能超过1000个字符"`
|
||||
ServiceUrl string `json:"serviceUrl" v:"max-length:1000#客服链接不能超过1000个字符"`
|
||||
BackupContact string `json:"backupContact" v:"required|max-length:500#备用联系方式不能为空|备用联系方式不能超过500个字符"`
|
||||
SessionMapping *gjson.Json `json:"sessionMapping"`
|
||||
ImTenantCode string `json:"imTenantCode" v:"required|max-length:64#IM租户代码不能为空|IM租户代码不能超过64个字符"`
|
||||
ImUserId string `json:"imUserId" v:"max-length:64#IM用户ID不能超过64个字符"`
|
||||
ImUsername string `json:"imUsername" v:"max-length:64#IM登录名不能超过64个字符"`
|
||||
Status int `json:"status" d:"1" v:"required|in:1,2#状态不能为空|状态不合法"`
|
||||
Sort int `json:"sort"`
|
||||
Remark string `json:"remark" v:"max-length:500#备注不能超过500个字符"`
|
||||
}
|
||||
|
||||
func (in *CustomerServiceEditInp) Filter(ctx context.Context) error {
|
||||
u, err := url.Parse(in.ServiceUrl)
|
||||
if err != nil || !strings.EqualFold(u.Scheme, "https") || u.Host == "" {
|
||||
return gerror.New("客服链接必须是有效的 HTTPS 地址")
|
||||
if strings.TrimSpace(in.ServiceUrl) != "" {
|
||||
u, err := url.Parse(in.ServiceUrl)
|
||||
if err != nil || !strings.EqualFold(u.Scheme, "https") || u.Host == "" {
|
||||
return gerror.New("客服链接必须是有效的 HTTPS 地址")
|
||||
}
|
||||
}
|
||||
in.ImTenantCode = strings.ToLower(strings.TrimSpace(in.ImTenantCode))
|
||||
in.ImUserId = strings.TrimSpace(in.ImUserId)
|
||||
in.ImUsername = strings.ToLower(strings.TrimSpace(in.ImUsername))
|
||||
if in.OnlineStatus != consts.CustomerServiceOnline && in.OnlineStatus != consts.CustomerServiceOffline {
|
||||
return gerror.New("客服在线状态不合法")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user