send msg file modify

This commit is contained in:
Gordon
2021-12-23 19:37:41 +08:00
parent d40e1e47fd
commit ba249d294e
6 changed files with 109 additions and 88 deletions
+9 -8
View File
@@ -6,6 +6,7 @@ import (
"Open_IM/pkg/common/token_verify"
"Open_IM/pkg/grpc-etcdv3/getcdv3"
"Open_IM/pkg/proto/chat"
"Open_IM/pkg/proto/sdk_ws"
"context"
"github.com/gin-gonic/gin"
"net/http"
@@ -22,7 +23,7 @@ type paramsUserPullMsg struct {
}
}
func UserPullMsg(c *gin.Context) {
func PullMsg(c *gin.Context) {
params := paramsUserPullMsg{}
if err := c.BindJSON(&params); err != nil {
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
@@ -34,7 +35,7 @@ func UserPullMsg(c *gin.Context) {
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err" + err.Error()})
return
}
pbData := pbChat.PullMessageReq{}
pbData := open_im_sdk.PullMessageReq{}
pbData.UserID = params.SendID
pbData.OperationID = params.OperationID
pbData.SeqBegin = *params.Data.SeqBegin
@@ -54,12 +55,12 @@ func UserPullMsg(c *gin.Context) {
if v := reply.GetSingleUserMsg(); v != nil {
msg["single"] = v
} else {
msg["single"] = []pbChat.GatherFormat{}
msg["single"] = []open_im_sdk.GatherFormat{}
}
if v := reply.GetGroupUserMsg(); v != nil {
msg["group"] = v
} else {
msg["group"] = []pbChat.GatherFormat{}
msg["group"] = []open_im_sdk.GatherFormat{}
}
msg["maxSeq"] = reply.GetMaxSeq()
msg["minSeq"] = reply.GetMinSeq()
@@ -79,7 +80,7 @@ type paramsUserPullMsgBySeqList struct {
SeqList []int64 `json:"seqList"`
}
func UserPullMsgBySeqList(c *gin.Context) {
func PullMsgBySeqList(c *gin.Context) {
params := paramsUserPullMsgBySeqList{}
if err := c.BindJSON(&params); err != nil {
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": err.Error()})
@@ -91,7 +92,7 @@ func UserPullMsgBySeqList(c *gin.Context) {
c.JSON(http.StatusBadRequest, gin.H{"errCode": 400, "errMsg": "token validate err" + err.Error()})
return
}
pbData := pbChat.PullMessageBySeqListReq{}
pbData := open_im_sdk.PullMessageBySeqListReq{}
pbData.UserID = params.SendID
pbData.OperationID = params.OperationID
pbData.SeqList = params.SeqList
@@ -110,12 +111,12 @@ func UserPullMsgBySeqList(c *gin.Context) {
if v := reply.GetSingleUserMsg(); v != nil {
msg["single"] = v
} else {
msg["single"] = []pbChat.GatherFormat{}
msg["single"] = []open_im_sdk.GatherFormat{}
}
if v := reply.GetGroupUserMsg(); v != nil {
msg["group"] = v
} else {
msg["group"] = []pbChat.GatherFormat{}
msg["group"] = []open_im_sdk.GatherFormat{}
}
msg["maxSeq"] = reply.GetMaxSeq()
msg["minSeq"] = reply.GetMinSeq()