mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-25 02:58:26 +08:00
push update
This commit is contained in:
parent
6449c4a53d
commit
4f8fcd2d3d
@ -8,6 +8,7 @@ package logic
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"Open_IM/pkg/common/config"
|
"Open_IM/pkg/common/config"
|
||||||
|
"Open_IM/pkg/common/constant"
|
||||||
"Open_IM/pkg/common/kafka"
|
"Open_IM/pkg/common/kafka"
|
||||||
"Open_IM/pkg/statistics"
|
"Open_IM/pkg/statistics"
|
||||||
"fmt"
|
"fmt"
|
||||||
@ -16,6 +17,7 @@ import (
|
|||||||
var (
|
var (
|
||||||
rpcServer RPCServer
|
rpcServer RPCServer
|
||||||
pushCh PushConsumerHandler
|
pushCh PushConsumerHandler
|
||||||
|
pushTerminal []int32
|
||||||
producer *kafka.Producer
|
producer *kafka.Producer
|
||||||
count uint64
|
count uint64
|
||||||
)
|
)
|
||||||
@ -24,7 +26,7 @@ func Init(rpcPort int) {
|
|||||||
|
|
||||||
rpcServer.Init(rpcPort)
|
rpcServer.Init(rpcPort)
|
||||||
pushCh.Init()
|
pushCh.Init()
|
||||||
|
pushTerminal = []int32{constant.IOSPlatformID, constant.AndroidPlatformID}
|
||||||
}
|
}
|
||||||
func init() {
|
func init() {
|
||||||
producer = kafka.NewKafkaProducer(config.Config.Kafka.Ws2mschat.Addr, config.Config.Kafka.Ws2mschat.Topic)
|
producer = kafka.NewKafkaProducer(config.Config.Kafka.Ws2mschat.Addr, config.Config.Kafka.Ws2mschat.Topic)
|
||||||
|
@ -59,6 +59,7 @@ func MsgToUser(pushMsg *pbPush.PushMsgReq) {
|
|||||||
if v.ResultCode == 0 {
|
if v.ResultCode == 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if utils.IsContainInt32(v.RecvPlatFormID, pushTerminal) {
|
||||||
//Use offline push messaging
|
//Use offline push messaging
|
||||||
var UIDList []string
|
var UIDList []string
|
||||||
UIDList = append(UIDList, v.RecvID)
|
UIDList = append(UIDList, v.RecvID)
|
||||||
@ -115,6 +116,7 @@ func MsgToUser(pushMsg *pbPush.PushMsgReq) {
|
|||||||
} else {
|
} else {
|
||||||
log.NewDebug(pushMsg.OperationID, "offline push return result is ", pushResult, pushMsg.MsgData)
|
log.NewDebug(pushMsg.OperationID, "offline push return result is ", pushResult, pushMsg.MsgData)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,6 +43,14 @@ func IsContain(target string, List []string) bool {
|
|||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
func IsContainInt32(target int32, List []int32) bool {
|
||||||
|
for _, element := range List {
|
||||||
|
if target == element {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
func InterfaceArrayToStringArray(data []interface{}) (i []string) {
|
func InterfaceArrayToStringArray(data []interface{}) (i []string) {
|
||||||
for _, param := range data {
|
for _, param := range data {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user