pull/103/head
Gordon 3 years ago
parent 082de2b6b7
commit a87c16de0d

@ -31,7 +31,6 @@ type EChatContent struct {
func MsgToUser(sendPbData *pbRelay.MsgToUserReq, OfflineInfo, Options string) {
var wsResult []*pbRelay.SingleMsgToUser
isShouldOfflinePush := true
MOptions := utils.JsonStringToMap(Options) //Control whether to push message to sender's other terminal
//isSenderSync := utils.GetSwitchFromOptions(MOptions, "senderSync")
isOfflinePush := utils.GetSwitchFromOptions(MOptions, "offlinePush")
@ -51,50 +50,31 @@ func MsgToUser(sendPbData *pbRelay.MsgToUserReq, OfflineInfo, Options string) {
}
log.InfoByKv("push_result", sendPbData.OperationID, "result", wsResult, "sendData", sendPbData)
if isOfflinePush {
for _, t := range pushTerminal {
for _, v := range wsResult {
if v.RecvPlatFormID == t && v.ResultCode == 0 {
isShouldOfflinePush = false
break
}
for _, v := range wsResult {
if v.ResultCode == 0 {
continue
}
if isShouldOfflinePush {
//Use offline push messaging
var UIDList []string
UIDList = append(UIDList, sendPbData.RecvID)
customContent := EChatContent{
SessionType: int(sendPbData.SessionType),
From: sendPbData.SendID,
To: sendPbData.RecvID,
Seq: sendPbData.RecvSeq,
}
bCustomContent, _ := json.Marshal(customContent)
//supported terminal
for _, t := range pushTerminal {
if v.RecvPlatFormID == t {
//Use offline push messaging
var UIDList []string
UIDList = append(UIDList, sendPbData.RecvID)
customContent := EChatContent{
SessionType: int(sendPbData.SessionType),
From: sendPbData.SendID,
To: sendPbData.RecvID,
Seq: sendPbData.RecvSeq,
}
bCustomContent, _ := json.Marshal(customContent)
jsonCustomContent := string(bCustomContent)
push.JGAccountListPush(UIDList, jsonCustomContent, utils.PlatformIDToName(t))
jsonCustomContent := string(bCustomContent)
//switch sendPbData.ContentType {
//case constant.Text:
// IOSAccountListPush(UIDList, sendPbData.SenderNickName, sendPbData.Content, jsonCustomContent)
//case constant.Picture:
// IOSAccountListPush(UIDList, sendPbData.SenderNickName, constant.ContentType2PushContent[constant.Picture], jsonCustomContent)
//case constant.Voice:
// IOSAccountListPush(UIDList, sendPbData.SenderNickName, constant.ContentType2PushContent[constant.Voice], jsonCustomContent)
//case constant.Video:
// IOSAccountListPush(UIDList, sendPbData.SenderNickName, constant.ContentType2PushContent[constant.Video], jsonCustomContent)
//case constant.File:
// IOSAccountListPush(UIDList, sendPbData.SenderNickName, constant.ContentType2PushContent[constant.File], jsonCustomContent)
//default:
//
//}
push.JGAccountListPush(UIDList, jsonCustomContent, utils.PlatformIDToName(t))
} else {
isShouldOfflinePush = true
}
}
}
}
}
func SendMsgByWS(m *pbChat.WSToMsgSvrChatMsg) {

Loading…
Cancel
Save