mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-12-17 03:27:02 +08:00
Modified newUserSendMsgReq to handle different content types
This commit is contained in:
parent
03906a89cd
commit
7e428b919d
@ -55,28 +55,28 @@ func (MessageApi) SetOptions(options map[string]bool, value bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m MessageApi) newUserSendMsgReq(c *gin.Context, params *apistruct.SendMsg) *msg.SendMsgReq {
|
func (m MessageApi) newUserSendMsgReq(c *gin.Context, params *apistruct.SendMsg) *msg.SendMsgReq {
|
||||||
var newContent string
|
var newContent interface{}
|
||||||
var err error
|
var err error
|
||||||
options := make(map[string]bool, 5)
|
options := make(map[string]bool, 5)
|
||||||
switch params.ContentType {
|
switch params.ContentType {
|
||||||
case constant.Text:
|
case constant.Text:
|
||||||
newContent = params.Content["text"].(string)
|
newContent = params.Content["text"].(string)
|
||||||
case constant.Picture:
|
case constant.Picture:
|
||||||
fallthrough
|
newContent = params.Content["picture"].(map[string]interface{})
|
||||||
case constant.Custom:
|
case constant.Custom:
|
||||||
fallthrough
|
newContent = params.Content["custom"].(map[string]interface{})
|
||||||
case constant.Voice:
|
case constant.Voice:
|
||||||
fallthrough
|
newContent = params.Content["voice"].(map[string]interface{})
|
||||||
case constant.Video:
|
case constant.Video:
|
||||||
fallthrough
|
newContent = params.Content["video"].(map[string]interface{})
|
||||||
case constant.File:
|
case constant.File:
|
||||||
fallthrough
|
newContent = params.Content["file"].(map[string]interface{})
|
||||||
case constant.CustomNotTriggerConversation:
|
case constant.CustomNotTriggerConversation:
|
||||||
fallthrough
|
newContent = params.Content["customNotTriggerConversation"].(map[string]interface{})
|
||||||
case constant.CustomOnlineOnly:
|
case constant.CustomOnlineOnly:
|
||||||
fallthrough
|
newContent = params.Content["customOnlineOnly"].(map[string]interface{})
|
||||||
default:
|
default:
|
||||||
newContent = utils.StructToJsonString(params.Content)
|
newContent = utils.StructToJsonString(params.Content)
|
||||||
}
|
}
|
||||||
if params.IsOnlineOnly {
|
if params.IsOnlineOnly {
|
||||||
m.SetOptions(options, false)
|
m.SetOptions(options, false)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user