diff --git a/internal/api/msg.go b/internal/api/msg.go index b385cbf74..a9f09d932 100644 --- a/internal/api/msg.go +++ b/internal/api/msg.go @@ -192,18 +192,6 @@ func (m *Message) SendMessage(c *gin.Context) { apiresp.GinError(c, errs.ErrArgs.Wrap(err.Error())) return } - //switch params.SessionType { - //case constant.SingleChatType: - // if len(params.RecvID) == 0 { - // apiresp.GinError(c, errs.ErrData) - // return - // } - //case constant.GroupChatType, constant.SuperGroupChatType: - // if len(params.GroupID) == 0 { - // apiresp.GinError(c, errs.ErrData) - // return - // } - //} pbReq := m.newUserSendMsgReq(c, ¶ms) conn, err := m.c.GetConn(config.Config.RpcRegisterName.OpenImMsgName) if err != nil { diff --git a/internal/api/route.go b/internal/api/route.go index 89b6fa0e9..cc9f51788 100644 --- a/internal/api/route.go +++ b/internal/api/route.go @@ -1,8 +1,8 @@ package api import ( - "fmt" "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" @@ -166,19 +166,12 @@ func NewGinRouter(zk discoveryregistry.SvcDiscoveryRegistry, rdb redis.Universal func RequiredIf(fl validator.FieldLevel) bool { sessionType := fl.Parent().FieldByName("SessionType").Int() switch sessionType { - case 1, 4: - fmt.Println("1", sessionType) + case constant.SingleChatType, constant.NotificationChatType: if fl.FieldName() == "RecvID" { - fmt.Println("2", sessionType) - return fl.Field().String() != "" } - case 2, 3: - fmt.Println("3", sessionType) - + case constant.GroupChatType, constant.SuperGroupChatType: if fl.FieldName() == "GroupID" { - fmt.Println("4", sessionType) - return fl.Field().String() != "" } default: