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())

@ -33,8 +33,9 @@ const (
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,6 +49,7 @@ 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 sendPbData.ContentType != constant.Typing && sendPbData.ContentType != constant.HasReadReceipt {
if isOfflinePush { if isOfflinePush {
for _, v := range wsResult { for _, v := range wsResult {
if v.ResultCode == 0 { if v.ResultCode == 0 {
@ -56,28 +59,30 @@ func MsgToUser(sendPbData *pbRelay.MsgToUserReq, OfflineInfo, Options string) {
for _, t := range pushTerminal { for _, t := range pushTerminal {
if v.RecvPlatFormID == t { if v.RecvPlatFormID == t {
//Use offline push messaging //Use offline push messaging
//var UIDList []string var UIDList []string
//UIDList = append(UIDList, sendPbData.RecvID) UIDList = append(UIDList, sendPbData.RecvID)
//customContent := EChatContent{ customContent := OpenIMContent{
// SessionType: int(sendPbData.SessionType), SessionType: int(sendPbData.SessionType),
// From: sendPbData.SendID, From: sendPbData.SendID,
// To: sendPbData.RecvID, To: sendPbData.RecvID,
// Seq: sendPbData.RecvSeq, Seq: sendPbData.RecvSeq,
//} }
//bCustomContent, _ := json.Marshal(customContent) bCustomContent, _ := json.Marshal(customContent)
//jsonCustomContent := string(bCustomContent) jsonCustomContent := string(bCustomContent)
//pushResult, err := push.JGAccountListPush(UIDList, jsonCustomContent, utils.PlatformIDToName(t)) pushResult, err := push.JGAccountListPush(UIDList, jsonCustomContent, utils.PlatformIDToName(t))
//if err != nil { if err != nil {
// log.NewError(sendPbData.OperationID, "offline push error", sendPbData.String(), err.Error(), t) log.NewError(sendPbData.OperationID, "offline push error", sendPbData.String(), err.Error(), t)
//} else { } else {
// log.NewDebug(sendPbData.OperationID, "offline push return result is ", string(pushResult), sendPbData, t) 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