mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-06 10:05:58 +08:00
change send message by ws and optimization
This commit is contained in:
@@ -13,13 +13,22 @@ import (
|
||||
)
|
||||
|
||||
type Req struct {
|
||||
ReqIdentifier int32 `json:"reqIdentifier" validate:"required"`
|
||||
Token string `json:"token" validate:"required"`
|
||||
SendID string `json:"sendID" validate:"required"`
|
||||
OperationID string `json:"operationID" validate:"required"`
|
||||
MsgIncr int32 `json:"msgIncr" validate:"required"`
|
||||
Data map[string]interface{} `json:"data"`
|
||||
ReqIdentifier int32 `json:"reqIdentifier" validate:"required"`
|
||||
Token string `json:"token" validate:"required"`
|
||||
SendID string `json:"sendID" validate:"required"`
|
||||
OperationID string `json:"operationID" validate:"required"`
|
||||
MsgIncr string `json:"msgIncr" validate:"required"`
|
||||
Data interface{} `json:"data"`
|
||||
}
|
||||
type Resp struct {
|
||||
ReqIdentifier int32 `json:"reqIdentifier"`
|
||||
MsgIncr string `json:"msgIncr"`
|
||||
OperationID string `json:"operationID"`
|
||||
ErrCode int32 `json:"errCode"`
|
||||
ErrMsg string `json:"errMsg"`
|
||||
Data interface{} `json:"data"`
|
||||
}
|
||||
|
||||
type SeqData struct {
|
||||
SeqBegin int64 `mapstructure:"seqBegin" validate:"required"`
|
||||
SeqEnd int64 `mapstructure:"seqEnd" validate:"required"`
|
||||
@@ -30,13 +39,16 @@ type MsgData struct {
|
||||
MsgFrom int32 `mapstructure:"msgFrom" validate:"required"`
|
||||
ContentType int32 `mapstructure:"contentType" validate:"required"`
|
||||
RecvID string `mapstructure:"recvID" validate:"required"`
|
||||
ForceList []string `mapstructure:"forceList" validate:"required"`
|
||||
ForceList []string `mapstructure:"forceList"`
|
||||
Content string `mapstructure:"content" validate:"required"`
|
||||
Options map[string]interface{} `mapstructure:"options" validate:"required"`
|
||||
ClientMsgID string `mapstructure:"clientMsgID" validate:"required"`
|
||||
OfflineInfo map[string]interface{} `mapstructure:"offlineInfo" validate:"required"`
|
||||
Ext map[string]interface{} `mapstructure:"ext"`
|
||||
}
|
||||
type SeqListData struct {
|
||||
SeqList []int64 `mapstructure:"seqList" validate:"required"`
|
||||
}
|
||||
|
||||
func (ws *WServer) argsValidate(m *Req, r int32) (isPass bool, errCode int32, errMsg string, data interface{}) {
|
||||
switch r {
|
||||
@@ -44,6 +56,8 @@ func (ws *WServer) argsValidate(m *Req, r int32) (isPass bool, errCode int32, er
|
||||
data = SeqData{}
|
||||
case constant.WSSendMsg:
|
||||
data = MsgData{}
|
||||
case constant.WSPullMsgBySeqList:
|
||||
data = SeqListData{}
|
||||
default:
|
||||
}
|
||||
if err := mapstructure.WeakDecode(m.Data, &data); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user