mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-12-11 23:47:32 +08:00
feat: Updated internal/api/msg.go
This commit is contained in:
parent
8e6430625c
commit
b33234130f
@ -54,27 +54,27 @@ 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{}
|
||||||
options := make(map[string]bool, 5)
|
options := make(map[string]bool, 5)
|
||||||
switch params.ContentType {
|
switch params.ContentType {
|
||||||
case constant.Text:
|
case constant.Text:
|
||||||
fallthrough
|
newContent = params.Content.(string)
|
||||||
case constant.Picture:
|
case constant.Picture:
|
||||||
fallthrough
|
newContent = params.Content.(map[string]interface{})
|
||||||
case constant.Custom:
|
case constant.Custom:
|
||||||
fallthrough
|
newContent = params.Content.(map[string]interface{})
|
||||||
case constant.Voice:
|
case constant.Voice:
|
||||||
fallthrough
|
newContent = params.Content.(map[string]interface{})
|
||||||
case constant.Video:
|
case constant.Video:
|
||||||
fallthrough
|
newContent = params.Content.(map[string]interface{})
|
||||||
case constant.File:
|
case constant.File:
|
||||||
fallthrough
|
newContent = params.Content.(map[string]interface{})
|
||||||
case constant.CustomNotTriggerConversation:
|
case constant.CustomNotTriggerConversation:
|
||||||
fallthrough
|
newContent = params.Content.(map[string]interface{})
|
||||||
case constant.CustomOnlineOnly:
|
case constant.CustomOnlineOnly:
|
||||||
fallthrough
|
newContent = params.Content.(map[string]interface{})
|
||||||
default:
|
default:
|
||||||
newContent = utils.StructToJsonString(params.Content)
|
newContent = params.Content
|
||||||
}
|
}
|
||||||
if params.IsOnlineOnly {
|
if params.IsOnlineOnly {
|
||||||
m.SetOptions(options, false)
|
m.SetOptions(options, false)
|
||||||
@ -98,14 +98,15 @@ func (m MessageApi) newUserSendMsgReq(c *gin.Context, params *apistruct.SendMsg)
|
|||||||
SessionType: params.SessionType,
|
SessionType: params.SessionType,
|
||||||
MsgFrom: constant.SysMsgType,
|
MsgFrom: constant.SysMsgType,
|
||||||
ContentType: params.ContentType,
|
ContentType: params.ContentType,
|
||||||
Content: []byte(newContent),
|
Content: []byte(utils.StructToJsonString(newContent)),
|
||||||
CreateTime: utils.GetCurrentTimestampByMill(),
|
CreateTime: utils.GetCurrentTimestampByMill(),
|
||||||
SendTime: params.SendTime,
|
SendTime: params.SendTime,
|
||||||
Options: options,
|
Options: options,
|
||||||
OfflinePushInfo: params.OfflinePushInfo,
|
OfflinePushInfo: params.OfflinePushInfo,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
//if params.ContentType == constant.OANotification {
|
return &pbData
|
||||||
|
}
|
||||||
// var tips sdkws.TipsComm
|
// var tips sdkws.TipsComm
|
||||||
// tips.JsonDetail = utils.StructToJsonString(params.Content)
|
// tips.JsonDetail = utils.StructToJsonString(params.Content)
|
||||||
// pbData.MsgData.Content, err = proto.Marshal(&tips)
|
// pbData.MsgData.Content, err = proto.Marshal(&tips)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user