|
|
@ -57,6 +57,10 @@ func (m MessageApi) newUserSendMsgReq(c *gin.Context, params *apistruct.SendMsg)
|
|
|
|
var newContent string
|
|
|
|
var newContent string
|
|
|
|
options := make(map[string]bool, 5)
|
|
|
|
options := make(map[string]bool, 5)
|
|
|
|
switch params.ContentType {
|
|
|
|
switch params.ContentType {
|
|
|
|
|
|
|
|
case constant.OANotification:
|
|
|
|
|
|
|
|
notification := sdkws.NotificationElem{}
|
|
|
|
|
|
|
|
notification.Detail = utils.StructToJsonString(params.Content)
|
|
|
|
|
|
|
|
newContent = utils.StructToJsonString(¬ification)
|
|
|
|
case constant.Text:
|
|
|
|
case constant.Text:
|
|
|
|
fallthrough
|
|
|
|
fallthrough
|
|
|
|
case constant.Picture:
|
|
|
|
case constant.Picture:
|
|
|
@ -69,10 +73,6 @@ func (m MessageApi) newUserSendMsgReq(c *gin.Context, params *apistruct.SendMsg)
|
|
|
|
fallthrough
|
|
|
|
fallthrough
|
|
|
|
case constant.File:
|
|
|
|
case constant.File:
|
|
|
|
fallthrough
|
|
|
|
fallthrough
|
|
|
|
case constant.CustomNotTriggerConversation:
|
|
|
|
|
|
|
|
fallthrough
|
|
|
|
|
|
|
|
case constant.CustomOnlineOnly:
|
|
|
|
|
|
|
|
fallthrough
|
|
|
|
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
newContent = utils.StructToJsonString(params.Content)
|
|
|
|
newContent = utils.StructToJsonString(params.Content)
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -82,11 +82,6 @@ func (m MessageApi) newUserSendMsgReq(c *gin.Context, params *apistruct.SendMsg)
|
|
|
|
if params.NotOfflinePush {
|
|
|
|
if params.NotOfflinePush {
|
|
|
|
utils.SetSwitchFromOptions(options, constant.IsOfflinePush, false)
|
|
|
|
utils.SetSwitchFromOptions(options, constant.IsOfflinePush, false)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if params.ContentType == constant.CustomOnlineOnly {
|
|
|
|
|
|
|
|
m.SetOptions(options, false)
|
|
|
|
|
|
|
|
} else if params.ContentType == constant.CustomNotTriggerConversation {
|
|
|
|
|
|
|
|
utils.SetSwitchFromOptions(options, constant.IsConversationUpdate, false)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
pbData := msg.SendMsgReq{
|
|
|
|
pbData := msg.SendMsgReq{
|
|
|
|
MsgData: &sdkws.MsgData{
|
|
|
|
MsgData: &sdkws.MsgData{
|
|
|
|
SendID: params.SendID,
|
|
|
|
SendID: params.SendID,
|
|
|
@ -105,14 +100,6 @@ func (m MessageApi) newUserSendMsgReq(c *gin.Context, params *apistruct.SendMsg)
|
|
|
|
OfflinePushInfo: params.OfflinePushInfo,
|
|
|
|
OfflinePushInfo: params.OfflinePushInfo,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//if params.ContentType == constant.OANotification {
|
|
|
|
|
|
|
|
// var tips sdkws.TipsComm
|
|
|
|
|
|
|
|
// tips.JsonDetail = utils.StructToJsonString(params.Content)
|
|
|
|
|
|
|
|
// pbData.MsgData.Content, err = proto.Marshal(&tips)
|
|
|
|
|
|
|
|
// if err != nil {
|
|
|
|
|
|
|
|
// log.ZError(c, "Marshal failed ", err, "tips", tips.String())
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
return &pbData
|
|
|
|
return &pbData
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -185,6 +172,9 @@ func (m *MessageApi) getSendMsgReq(c *gin.Context, req apistruct.SendMsg) (sendM
|
|
|
|
case constant.OANotification:
|
|
|
|
case constant.OANotification:
|
|
|
|
data = apistruct.OANotificationElem{}
|
|
|
|
data = apistruct.OANotificationElem{}
|
|
|
|
req.SessionType = constant.NotificationChatType
|
|
|
|
req.SessionType = constant.NotificationChatType
|
|
|
|
|
|
|
|
if !authverify.IsManagerUserID(req.SendID) {
|
|
|
|
|
|
|
|
return nil, errs.ErrNoPermission.Wrap("only app manager can send message")
|
|
|
|
|
|
|
|
}
|
|
|
|
case constant.CustomNotTriggerConversation:
|
|
|
|
case constant.CustomNotTriggerConversation:
|
|
|
|
data = apistruct.CustomElem{}
|
|
|
|
data = apistruct.CustomElem{}
|
|
|
|
case constant.CustomOnlineOnly:
|
|
|
|
case constant.CustomOnlineOnly:
|
|
|
@ -212,7 +202,6 @@ func (m *MessageApi) SendMessage(c *gin.Context) {
|
|
|
|
apiresp.GinError(c, errs.ErrNoPermission.Wrap("only app manager can send message"))
|
|
|
|
apiresp.GinError(c, errs.ErrNoPermission.Wrap("only app manager can send message"))
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
sendMsgReq, err := m.getSendMsgReq(c, req.SendMsg)
|
|
|
|
sendMsgReq, err := m.getSendMsgReq(c, req.SendMsg)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
log.ZError(c, "decodeData failed", err)
|
|
|
|
log.ZError(c, "decodeData failed", err)
|
|
|
|