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) { func MsgToUser(sendPbData *pbRelay.MsgToUserReq, OfflineInfo, Options string) {
var wsResult []*pbRelay.SingleMsgToUser var wsResult []*pbRelay.SingleMsgToUser
isShouldOfflinePush := true
MOptions := utils.JsonStringToMap(Options) //Control whether to push message to sender's other terminal MOptions := utils.JsonStringToMap(Options) //Control whether to push message to sender's other terminal
//isSenderSync := utils.GetSwitchFromOptions(MOptions, "senderSync") //isSenderSync := utils.GetSwitchFromOptions(MOptions, "senderSync")
isOfflinePush := utils.GetSwitchFromOptions(MOptions, "offlinePush") 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) log.InfoByKv("push_result", sendPbData.OperationID, "result", wsResult, "sendData", sendPbData)
if isOfflinePush { if isOfflinePush {
for _, v := range wsResult {
for _, t := range pushTerminal { if v.ResultCode == 0 {
for _, v := range wsResult { continue
if v.RecvPlatFormID == t && v.ResultCode == 0 {
isShouldOfflinePush = false
break
}
} }
if isShouldOfflinePush { //supported terminal
//Use offline push messaging for _, t := range pushTerminal {
var UIDList []string if v.RecvPlatFormID == t {
UIDList = append(UIDList, sendPbData.RecvID) //Use offline push messaging
customContent := EChatContent{ var UIDList []string
SessionType: int(sendPbData.SessionType), UIDList = append(UIDList, sendPbData.RecvID)
From: sendPbData.SendID, customContent := EChatContent{
To: sendPbData.RecvID, SessionType: int(sendPbData.SessionType),
Seq: sendPbData.RecvSeq, From: sendPbData.SendID,
} To: sendPbData.RecvID,
bCustomContent, _ := json.Marshal(customContent) 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) { func SendMsgByWS(m *pbChat.WSToMsgSvrChatMsg) {

Loading…
Cancel
Save