test-errcode
Gordon 2 years ago
parent adfd117926
commit c92e48dfa3

@ -192,18 +192,6 @@ func (m *Message) SendMessage(c *gin.Context) {
apiresp.GinError(c, errs.ErrArgs.Wrap(err.Error())) apiresp.GinError(c, errs.ErrArgs.Wrap(err.Error()))
return 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, &params) pbReq := m.newUserSendMsgReq(c, &params)
conn, err := m.c.GetConn(config.Config.RpcRegisterName.OpenImMsgName) conn, err := m.c.GetConn(config.Config.RpcRegisterName.OpenImMsgName)
if err != nil { if err != nil {

@ -1,8 +1,8 @@
package api package api
import ( import (
"fmt"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config" "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/log"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/mw" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/mw"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/prome" "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 { func RequiredIf(fl validator.FieldLevel) bool {
sessionType := fl.Parent().FieldByName("SessionType").Int() sessionType := fl.Parent().FieldByName("SessionType").Int()
switch sessionType { switch sessionType {
case 1, 4: case constant.SingleChatType, constant.NotificationChatType:
fmt.Println("1", sessionType)
if fl.FieldName() == "RecvID" { if fl.FieldName() == "RecvID" {
fmt.Println("2", sessionType)
return fl.Field().String() != "" return fl.Field().String() != ""
} }
case 2, 3: case constant.GroupChatType, constant.SuperGroupChatType:
fmt.Println("3", sessionType)
if fl.FieldName() == "GroupID" { if fl.FieldName() == "GroupID" {
fmt.Println("4", sessionType)
return fl.Field().String() != "" return fl.Field().String() != ""
} }
default: default:

Loading…
Cancel
Save