Merge branch 'v2.3.0release' of https://github.com/OpenIMSDK/Open-IM-Server into v2.3.0release

This commit is contained in:
wangchuxiao 2022-08-17 21:37:31 +08:00
commit 0ebaefb8be
3 changed files with 15 additions and 2 deletions

View File

@ -50,6 +50,8 @@ func newUserSendMsgReq(params *api.ManagementSendMsgReq) *pbChat.SendMsgReq {
case constant.Video: case constant.Video:
fallthrough fallthrough
case constant.File: case constant.File:
fallthrough
case constant.AdvancedRevoke:
newContent = utils.StructToJsonString(params.Content) newContent = utils.StructToJsonString(params.Content)
case constant.Revoke: case constant.Revoke:
newContent = params.Content["revokeMsgClientID"].(string) newContent = params.Content["revokeMsgClientID"].(string)
@ -145,6 +147,8 @@ func ManagementSendMsg(c *gin.Context) {
data = CustomElem{} data = CustomElem{}
case constant.Revoke: case constant.Revoke:
data = RevokeElem{} data = RevokeElem{}
case constant.AdvancedRevoke:
data = MessageRevoked{}
case constant.OANotification: case constant.OANotification:
data = OANotificationElem{} data = OANotificationElem{}
params.SessionType = constant.NotificationChatType params.SessionType = constant.NotificationChatType
@ -189,7 +193,7 @@ func ManagementSendMsg(c *gin.Context) {
c.JSON(http.StatusBadRequest, gin.H{"errCode": 405, "errMsg": "recvID is a null string", "sendTime": 0, "MsgID": ""}) c.JSON(http.StatusBadRequest, gin.H{"errCode": 405, "errMsg": "recvID is a null string", "sendTime": 0, "MsgID": ""})
return return
} }
case constant.GroupChatType: case constant.GroupChatType, constant.SuperGroupChatType:
if len(params.GroupID) == 0 { if len(params.GroupID) == 0 {
log.NewError(params.OperationID, "groupID is a null string") log.NewError(params.OperationID, "groupID is a null string")
c.JSON(http.StatusBadRequest, gin.H{"errCode": 405, "errMsg": "groupID is a null string", "sendTime": 0, "MsgID": ""}) c.JSON(http.StatusBadRequest, gin.H{"errCode": 405, "errMsg": "groupID is a null string", "sendTime": 0, "MsgID": ""})
@ -473,3 +477,10 @@ type OANotificationElem struct {
FileElem FileElem `mapstructure:"fileElem" json:"fileElem"` FileElem FileElem `mapstructure:"fileElem" json:"fileElem"`
Ex string `mapstructure:"ex" json:"ex"` Ex string `mapstructure:"ex" json:"ex"`
} }
type MessageRevoked struct {
RevokerID string `mapstructure:"notificationName" json:"revokerID" validate:"required"`
RevokerRole int32 `mapstructure:"notificationName" json:"revokerRole" validate:"required"`
ClientMsgID string `mapstructure:"notificationName" json:"clientMsgID" validate:"required"`
RevokerNickname string `mapstructure:"notificationName" json:"revokerNickname"`
SessionType int32 `mapstructure:"notificationName" json:"sessionType" validate:"required"`
}

View File

@ -133,7 +133,7 @@ func (g *Getui) Push(userIDList []string, alert, detailContent, operationID stri
} }
pushReq.PushMessage.Notification = Notification{ pushReq.PushMessage.Notification = Notification{
Title: alert, Title: alert,
Body: alert, Body: detailContent,
ClickType: "startapp", ClickType: "startapp",
} }
pushReq.PushChannel.Ios.Aps.Sound = "default" pushReq.PushChannel.Ios.Aps.Sound = "default"

View File

@ -94,6 +94,7 @@ func MsgToUser(pushMsg *pbPush.PushMsgReq) {
var content string var content string
if pushMsg.MsgData.OfflinePushInfo != nil { if pushMsg.MsgData.OfflinePushInfo != nil {
content = pushMsg.MsgData.OfflinePushInfo.Title content = pushMsg.MsgData.OfflinePushInfo.Title
jsonCustomContent = pushMsg.MsgData.OfflinePushInfo.Desc
} else { } else {
switch pushMsg.MsgData.ContentType { switch pushMsg.MsgData.ContentType {
@ -225,6 +226,7 @@ func MsgToSuperGroupUser(pushMsg *pbPush.PushMsgReq) {
var content string var content string
if pushMsg.MsgData.OfflinePushInfo != nil { if pushMsg.MsgData.OfflinePushInfo != nil {
content = pushMsg.MsgData.OfflinePushInfo.Title content = pushMsg.MsgData.OfflinePushInfo.Title
jsonCustomContent = pushMsg.MsgData.OfflinePushInfo.Desc
} else { } else {
switch pushMsg.MsgData.ContentType { switch pushMsg.MsgData.ContentType {