msg update

This commit is contained in:
Gordon
2023-03-21 19:05:02 +08:00
parent c036d27b36
commit b05e89cd67
9 changed files with 101 additions and 50 deletions
-18
View File
@@ -2,7 +2,6 @@ package api
import (
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/constant"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/log"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/mw"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/prome"
@@ -162,20 +161,3 @@ func NewGinRouter(zk discoveryregistry.SvcDiscoveryRegistry, rdb redis.Universal
}
return r
}
func RequiredIf(fl validator.FieldLevel) bool {
sessionType := fl.Parent().FieldByName("SessionType").Int()
switch sessionType {
case constant.SingleChatType, constant.NotificationChatType:
if fl.FieldName() == "RecvID" {
return fl.Field().String() != ""
}
case constant.GroupChatType, constant.SuperGroupChatType:
if fl.FieldName() == "GroupID" {
return fl.Field().String() != ""
}
default:
return true
}
return true
}