mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-04 00:55:59 +08:00
message send module changes
This commit is contained in:
@@ -33,6 +33,7 @@ func UserToken(c *gin.Context) {
|
||||
|
||||
params := paramsUserToken{}
|
||||
if err := c.BindJSON(¶ms); err != nil {
|
||||
log.Error("", "", params.UID, params.Platform, params.Secret)
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
@@ -31,7 +31,6 @@ func UserNewestSeq(c *gin.Context) {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err"})
|
||||
return
|
||||
}
|
||||
|
||||
pbData := pbMsg.GetNewSeqReq{}
|
||||
pbData.UserID = params.SendID
|
||||
pbData.OperationID = params.OperationID
|
||||
|
||||
@@ -16,7 +16,6 @@ type paramsUserPullMsg struct {
|
||||
ReqIdentifier *int `json:"reqIdentifier" binding:"required"`
|
||||
SendID string `json:"sendID" binding:"required"`
|
||||
OperationID string `json:"operationID" binding:"required"`
|
||||
MsgIncr *int `json:"msgIncr" binding:"required"`
|
||||
Data struct {
|
||||
SeqBegin *int64 `json:"seqBegin" binding:"required"`
|
||||
SeqEnd *int64 `json:"seqEnd" binding:"required"`
|
||||
@@ -35,7 +34,6 @@ func UserPullMsg(c *gin.Context) {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err"})
|
||||
return
|
||||
}
|
||||
|
||||
pbData := pbChat.PullMessageReq{}
|
||||
pbData.UserID = params.SendID
|
||||
pbData.OperationID = params.OperationID
|
||||
@@ -67,7 +65,6 @@ func UserPullMsg(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"errCode": reply.ErrCode,
|
||||
"errMsg": reply.ErrMsg,
|
||||
"msgIncr": *params.MsgIncr,
|
||||
"reqIdentifier": *params.ReqIdentifier,
|
||||
"data": msg,
|
||||
})
|
||||
|
||||
+24
-23
@@ -14,12 +14,13 @@ import (
|
||||
)
|
||||
|
||||
type paramsUserSendMsg struct {
|
||||
ReqIdentifier int32 `json:"reqIdentifier" binding:"required"`
|
||||
PlatformID int32 `json:"platformID" binding:"required"`
|
||||
SendID string `json:"sendID" binding:"required"`
|
||||
OperationID string `json:"operationID" binding:"required"`
|
||||
MsgIncr int32 `json:"msgIncr"`
|
||||
Data struct {
|
||||
ReqIdentifier int32 `json:"reqIdentifier" binding:"required"`
|
||||
PlatformID int32 `json:"platformID" binding:"required"`
|
||||
SendID string `json:"sendID" binding:"required"`
|
||||
SenderNickName string `json:"senderNickName" binding:"required"`
|
||||
SenderFaceURL string `json:"senderFaceUrl"`
|
||||
OperationID string `json:"operationID" binding:"required"`
|
||||
Data struct {
|
||||
SessionType int32 `json:"sessionType" binding:"required"`
|
||||
MsgFrom int32 `json:"msgFrom" binding:"required"`
|
||||
ContentType int32 `json:"contentType" binding:"required"`
|
||||
@@ -35,22 +36,23 @@ type paramsUserSendMsg struct {
|
||||
|
||||
func newUserSendMsgReq(token string, params *paramsUserSendMsg) *pbChat.UserSendMsgReq {
|
||||
pbData := pbChat.UserSendMsgReq{
|
||||
ReqIdentifier: params.ReqIdentifier,
|
||||
Token: token,
|
||||
SendID: params.SendID,
|
||||
OperationID: params.OperationID,
|
||||
MsgIncr: params.MsgIncr,
|
||||
PlatformID: params.PlatformID,
|
||||
SessionType: params.Data.SessionType,
|
||||
MsgFrom: params.Data.MsgFrom,
|
||||
ContentType: params.Data.ContentType,
|
||||
RecvID: params.Data.RecvID,
|
||||
ForceList: params.Data.ForceList,
|
||||
Content: params.Data.Content,
|
||||
Options: utils.MapToJsonString(params.Data.Options),
|
||||
ClientMsgID: params.Data.ClientMsgID,
|
||||
OffLineInfo: utils.MapToJsonString(params.Data.OffLineInfo),
|
||||
Ex: utils.MapToJsonString(params.Data.Ex),
|
||||
ReqIdentifier: params.ReqIdentifier,
|
||||
Token: token,
|
||||
SendID: params.SendID,
|
||||
SenderNickName: params.SenderNickName,
|
||||
SenderFaceURL: params.SenderFaceURL,
|
||||
OperationID: params.OperationID,
|
||||
PlatformID: params.PlatformID,
|
||||
SessionType: params.Data.SessionType,
|
||||
MsgFrom: params.Data.MsgFrom,
|
||||
ContentType: params.Data.ContentType,
|
||||
RecvID: params.Data.RecvID,
|
||||
ForceList: params.Data.ForceList,
|
||||
Content: params.Data.Content,
|
||||
Options: utils.MapToJsonString(params.Data.Options),
|
||||
ClientMsgID: params.Data.ClientMsgID,
|
||||
OffLineInfo: utils.MapToJsonString(params.Data.OffLineInfo),
|
||||
Ex: utils.MapToJsonString(params.Data.Ex),
|
||||
}
|
||||
return &pbData
|
||||
}
|
||||
@@ -85,7 +87,6 @@ func UserSendMsg(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"errCode": reply.ErrCode,
|
||||
"errMsg": reply.ErrMsg,
|
||||
"msgIncr": reply.MsgIncr,
|
||||
"reqIdentifier": reply.ReqIdentifier,
|
||||
"data": gin.H{
|
||||
"clientMsgID": reply.ClientMsgID,
|
||||
|
||||
Reference in New Issue
Block a user