ws and push update

pull/455/head
Gordon 3 years ago committed by Xinwei Xiong(cubxxw-openim)
parent 9594f6a2df
commit c41fd248cc

@ -134,103 +134,104 @@ func MsgToUser(pushMsg *pbPush.PushMsgReq) {
} }
} }
//func MsgToSuperGroupUser(pushMsg *pbPush.PushMsgReq) { func MsgToSuperGroupUser(pushMsg *pbPush.PushMsgReq) {
// var wsResult []*pbRelay.SingelMsgToUserResultList return
// isOfflinePush := utils.GetSwitchFromOptions(pushMsg.MsgData.Options, constant.IsOfflinePush) //var wsResult []*pbRelay.SingelMsgToUserResultList
// log.Debug(pushMsg.OperationID, "Get msg from msg_transfer And push msg", pushMsg.String()) //isOfflinePush := utils.GetSwitchFromOptions(pushMsg.MsgData.Options, constant.IsOfflinePush)
// if len(grpcCons) == 0 { //log.Debug(pushMsg.OperationID, "Get msg from msg_transfer And push msg", pushMsg.String())
// log.NewWarn(pushMsg.OperationID, "first GetConn4Unique ") //if len(grpcCons) == 0 {
// grpcCons = getcdv3.GetConn4Unique(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOnlineMessageRelayName) // log.NewWarn(pushMsg.OperationID, "first GetConn4Unique ")
// } // grpcCons = getcdv3.GetConn4Unique(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOnlineMessageRelayName)
// //Online push message //}
// log.Debug("test", pushMsg.OperationID, "len grpc", len(grpcCons), "data", pushMsg.String()) ////Online push message
// for _, v := range grpcCons { //log.Debug("test", pushMsg.OperationID, "len grpc", len(grpcCons), "data", pushMsg.String())
// msgClient := pbRelay.NewOnlineMessageRelayServiceClient(v) //for _, v := range grpcCons {
// reply, err := msgClient.OnlineBatchPushOneMsg(context.Background(), &pbRelay.OnlineBatchPushOneMsgReq{OperationID: pushMsg.OperationID, MsgData: pushMsg.MsgData, PushToUserIDList: pushMsg.PushToUserID}) // msgClient := pbRelay.NewOnlineMessageRelayServiceClient(v)
// if err != nil { // reply, err := msgClient.OnlineBatchPushOneMsg(context.Background(), &pbRelay.OnlineBatchPushOneMsgReq{OperationID: pushMsg.OperationID, MsgData: pushMsg.MsgData, PushToUserIDList: pushMsg.PushToUserID})
// log.NewError("push data to client rpc err", pushMsg.OperationID, "err", err) // if err != nil {
// continue // log.NewError("push data to client rpc err", pushMsg.OperationID, "err", err)
// } // continue
// if reply != nil && reply.SinglePushResult != nil { // }
// wsResult = append(wsResult, reply.SinglePushResult...) // if reply != nil && reply.SinglePushResult != nil {
// } // wsResult = append(wsResult, reply.SinglePushResult...)
// } // }
// log.NewInfo(pushMsg.OperationID, "push_result", wsResult, "sendData", pushMsg.MsgData) //}
// successCount++ //log.NewInfo(pushMsg.OperationID, "push_result", wsResult, "sendData", pushMsg.MsgData)
// if isOfflinePush && pushMsg.PushToUserID != pushMsg.MsgData.SendID { //successCount++
// for _, v := range wsResult { //if isOfflinePush && pushMsg.PushToUserID != pushMsg.MsgData.SendID {
// if v.ResultCode == 0 { // for _, v := range wsResult {
// if utils.IsContainInt32(v.RecvPlatFormID, pushTerminal) { // if v.ResultCode == 0 {
// break // if utils.IsContainInt32(v.RecvPlatFormID, pushTerminal) {
// } // break
// continue // }
// } // continue
// if utils.IsContainInt32(v.RecvPlatFormID, pushTerminal) { // }
// //Use offline push messaging // if utils.IsContainInt32(v.RecvPlatFormID, pushTerminal) {
// var UIDList []string // //Use offline push messaging
// UIDList = append(UIDList, v.RecvID) // var UIDList []string
// customContent := OpenIMContent{ // UIDList = append(UIDList, v.RecvID)
// SessionType: int(pushMsg.MsgData.SessionType), // customContent := OpenIMContent{
// From: pushMsg.MsgData.SendID, // SessionType: int(pushMsg.MsgData.SessionType),
// To: pushMsg.MsgData.RecvID, // From: pushMsg.MsgData.SendID,
// Seq: pushMsg.MsgData.Seq, // To: pushMsg.MsgData.RecvID,
// } // Seq: pushMsg.MsgData.Seq,
// bCustomContent, _ := json.Marshal(customContent) // }
// jsonCustomContent := string(bCustomContent) // bCustomContent, _ := json.Marshal(customContent)
// var content string // jsonCustomContent := string(bCustomContent)
// if pushMsg.MsgData.OfflinePushInfo != nil { // var content string
// content = pushMsg.MsgData.OfflinePushInfo.Title // if pushMsg.MsgData.OfflinePushInfo != nil {
// // content = pushMsg.MsgData.OfflinePushInfo.Title
// } else { //
// switch pushMsg.MsgData.ContentType { // } else {
// case constant.Text: // switch pushMsg.MsgData.ContentType {
// content = constant.ContentType2PushContent[constant.Text] // case constant.Text:
// case constant.Picture: // content = constant.ContentType2PushContent[constant.Text]
// content = constant.ContentType2PushContent[constant.Picture] // case constant.Picture:
// case constant.Voice: // content = constant.ContentType2PushContent[constant.Picture]
// content = constant.ContentType2PushContent[constant.Voice] // case constant.Voice:
// case constant.Video: // content = constant.ContentType2PushContent[constant.Voice]
// content = constant.ContentType2PushContent[constant.Video] // case constant.Video:
// case constant.File: // content = constant.ContentType2PushContent[constant.Video]
// content = constant.ContentType2PushContent[constant.File] // case constant.File:
// case constant.AtText: // content = constant.ContentType2PushContent[constant.File]
// a := AtContent{} // case constant.AtText:
// _ = utils.JsonStringToStruct(string(pushMsg.MsgData.Content), &a) // a := AtContent{}
// if utils.IsContain(v.RecvID, a.AtUserList) { // _ = utils.JsonStringToStruct(string(pushMsg.MsgData.Content), &a)
// content = constant.ContentType2PushContent[constant.AtText] + constant.ContentType2PushContent[constant.Common] // if utils.IsContain(v.RecvID, a.AtUserList) {
// } else { // content = constant.ContentType2PushContent[constant.AtText] + constant.ContentType2PushContent[constant.Common]
// content = constant.ContentType2PushContent[constant.GroupMsg] // } else {
// } // content = constant.ContentType2PushContent[constant.GroupMsg]
// default: // }
// content = constant.ContentType2PushContent[constant.Common] // default:
// } // content = constant.ContentType2PushContent[constant.Common]
// } // }
// callbackResp := callbackOfflinePush(pushMsg.OperationID, UIDList[0], pushMsg.MsgData.OfflinePushInfo, v.RecvPlatFormID) // }
// log.NewDebug(pushMsg.OperationID, utils.GetSelfFuncName(), "offline callback Resp") // callbackResp := callbackOfflinePush(pushMsg.OperationID, UIDList[0], pushMsg.MsgData.OfflinePushInfo, v.RecvPlatFormID)
// if callbackResp.ErrCode != 0 { // log.NewDebug(pushMsg.OperationID, utils.GetSelfFuncName(), "offline callback Resp")
// log.NewError(pushMsg.OperationID, utils.GetSelfFuncName(), "callbackOfflinePush result: ", callbackResp) // if callbackResp.ErrCode != 0 {
// } // log.NewError(pushMsg.OperationID, utils.GetSelfFuncName(), "callbackOfflinePush result: ", callbackResp)
// if callbackResp.ActionCode != constant.ActionAllow { // }
// log.NewDebug(pushMsg.OperationID, utils.GetSelfFuncName(), "offlinePush stop") // if callbackResp.ActionCode != constant.ActionAllow {
// break // log.NewDebug(pushMsg.OperationID, utils.GetSelfFuncName(), "offlinePush stop")
// } // break
// // }
// if offlinePusher == nil { //
// offlinePusher = jpush.JPushClient // if offlinePusher == nil {
// } // offlinePusher = jpush.JPushClient
// pushResult, err := offlinePusher.Push(UIDList, content, jsonCustomContent, pushMsg.OperationID) // }
// if err != nil { // pushResult, err := offlinePusher.Push(UIDList, content, jsonCustomContent, pushMsg.OperationID)
// log.NewError(pushMsg.OperationID, "offline push error", pushMsg.String(), err.Error()) // if err != nil {
// } else { // log.NewError(pushMsg.OperationID, "offline push error", pushMsg.String(), err.Error())
// log.NewDebug(pushMsg.OperationID, "offline push return result is ", pushResult, pushMsg.MsgData) // } else {
// } // log.NewDebug(pushMsg.OperationID, "offline push return result is ", pushResult, pushMsg.MsgData)
// break // }
// } // break
// // }
// } //
// // }
// } //
//} //}
}
//func SendMsgByWS(m *pbChat.WSToMsgSvrChatMsg) { //func SendMsgByWS(m *pbChat.WSToMsgSvrChatMsg) {
// m.MsgID = rpcChat.GetMsgID(m.SendID) // m.MsgID = rpcChat.GetMsgID(m.SendID)

Loading…
Cancel
Save