push modify

pull/103/head
Gordon 3 years ago
parent 4b4dce80cf
commit 817d2b11a5

@ -67,7 +67,7 @@ func UserSendMsg(c *gin.Context) {
token := c.Request.Header.Get("token") token := c.Request.Header.Get("token")
log.InfoByKv("Ws call success to sendMsgReq", params.OperationID, "Parameters", params) log.InfoByKv("api call success to sendMsgReq", params.OperationID, "Parameters", params)
pbData := newUserSendMsgReq(token, &params) pbData := newUserSendMsgReq(token, &params)
log.Info("", "", "api UserSendMsg call start..., [data: %s]", pbData.String()) log.Info("", "", "api UserSendMsg call start..., [data: %s]", pbData.String())

@ -26,15 +26,16 @@ const (
///ContentType ///ContentType
//UserRelated //UserRelated
Text = 101 Text = 101
Picture = 102 Picture = 102
Voice = 103 Voice = 103
Video = 104 Video = 104
File = 105 File = 105
AtText = 106 AtText = 106
Custom = 110 Custom = 110
HasReadReceipt = 112
Typing = 113
SyncSenderMsg = 108
//SysRelated //SysRelated
AcceptFriendApplicationTip = 201 AcceptFriendApplicationTip = 201
AddFriendTip = 202 AddFriendTip = 202

@ -14,13 +14,15 @@ import (
pbChat "Open_IM/src/proto/chat" pbChat "Open_IM/src/proto/chat"
pbGroup "Open_IM/src/proto/group" pbGroup "Open_IM/src/proto/group"
pbRelay "Open_IM/src/proto/relay" pbRelay "Open_IM/src/proto/relay"
push "Open_IM/src/push/jpush"
rpcChat "Open_IM/src/rpc/chat/chat" rpcChat "Open_IM/src/rpc/chat/chat"
"Open_IM/src/utils" "Open_IM/src/utils"
"context" "context"
"encoding/json"
"strings" "strings"
) )
type EChatContent struct { type OpenIMContent struct {
SessionType int `json:"chatType"` SessionType int `json:"chatType"`
From string `json:"from"` From string `json:"from"`
To string `json:"to"` To string `json:"to"`
@ -47,37 +49,40 @@ func MsgToUser(sendPbData *pbRelay.MsgToUserReq, OfflineInfo, Options string) {
} }
} }
log.InfoByKv("push_result", sendPbData.OperationID, "result", wsResult, "sendData", sendPbData) log.InfoByKv("push_result", sendPbData.OperationID, "result", wsResult, "sendData", sendPbData)
if isOfflinePush { if sendPbData.ContentType != constant.Typing && sendPbData.ContentType != constant.HasReadReceipt {
for _, v := range wsResult { if isOfflinePush {
if v.ResultCode == 0 { for _, v := range wsResult {
continue if v.ResultCode == 0 {
} continue
//supported terminal }
for _, t := range pushTerminal { //supported terminal
if v.RecvPlatFormID == t { for _, t := range pushTerminal {
//Use offline push messaging if v.RecvPlatFormID == t {
//var UIDList []string //Use offline push messaging
//UIDList = append(UIDList, sendPbData.RecvID) var UIDList []string
//customContent := EChatContent{ UIDList = append(UIDList, sendPbData.RecvID)
// SessionType: int(sendPbData.SessionType), customContent := OpenIMContent{
// From: sendPbData.SendID, SessionType: int(sendPbData.SessionType),
// To: sendPbData.RecvID, From: sendPbData.SendID,
// Seq: sendPbData.RecvSeq, To: sendPbData.RecvID,
//} Seq: sendPbData.RecvSeq,
//bCustomContent, _ := json.Marshal(customContent) }
//jsonCustomContent := string(bCustomContent) bCustomContent, _ := json.Marshal(customContent)
//pushResult, err := push.JGAccountListPush(UIDList, jsonCustomContent, utils.PlatformIDToName(t)) jsonCustomContent := string(bCustomContent)
//if err != nil { pushResult, err := push.JGAccountListPush(UIDList, jsonCustomContent, utils.PlatformIDToName(t))
// log.NewError(sendPbData.OperationID, "offline push error", sendPbData.String(), err.Error(), t) if err != nil {
//} else { log.NewError(sendPbData.OperationID, "offline push error", sendPbData.String(), err.Error(), t)
// log.NewDebug(sendPbData.OperationID, "offline push return result is ", string(pushResult), sendPbData, t) } else {
//} log.NewDebug(sendPbData.OperationID, "offline push return result is ", string(pushResult), sendPbData, t)
}
}
} }
} }
}
}
} }
} }
func SendMsgByWS(m *pbChat.WSToMsgSvrChatMsg) { func SendMsgByWS(m *pbChat.WSToMsgSvrChatMsg) {

Loading…
Cancel
Save