push update

This commit is contained in:
Gordon 2022-05-25 15:48:48 +08:00
parent e9a515ac34
commit ce554fc442
2 changed files with 15 additions and 15 deletions

View File

@ -7,6 +7,9 @@
package logic
import (
pusher "Open_IM/internal/push"
"Open_IM/internal/push/getui"
jpush "Open_IM/internal/push/jpush"
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/constant"
"Open_IM/pkg/common/kafka"
@ -15,11 +18,12 @@ import (
)
var (
rpcServer RPCServer
pushCh PushConsumerHandler
pushTerminal []int32
producer *kafka.Producer
successCount uint64
rpcServer RPCServer
pushCh PushConsumerHandler
pushTerminal []int32
producer *kafka.Producer
offlinePusher pusher.OfflinePusher
successCount uint64
)
func Init(rpcPort int) {
@ -31,6 +35,12 @@ func Init(rpcPort int) {
func init() {
producer = kafka.NewKafkaProducer(config.Config.Kafka.Ws2mschat.Addr, config.Config.Kafka.Ws2mschat.Topic)
statistics.NewStatistics(&successCount, config.Config.ModuleName.PushName, fmt.Sprintf("%d second push to msg_gateway count", constant.StatisticsTimeInterval), constant.StatisticsTimeInterval)
if config.Config.Push.Getui.Enable {
offlinePusher = getui.GetuiClient
}
if config.Config.Push.Jpns.Enable {
offlinePusher = jpush.JPushClient
}
}
func Run() {

View File

@ -7,8 +7,6 @@
package logic
import (
pusher "Open_IM/internal/push"
"Open_IM/internal/push/getui"
jpush "Open_IM/internal/push/jpush"
"Open_IM/pkg/common/config"
"Open_IM/pkg/common/constant"
@ -102,14 +100,6 @@ func MsgToUser(pushMsg *pbPush.PushMsgReq) {
content = constant.ContentType2PushContent[constant.Common]
}
}
var offlinePusher pusher.OfflinePusher
if config.Config.Push.Getui.Enable {
log.NewInfo(pushMsg.OperationID, utils.GetSelfFuncName(), config.Config.Push.Getui)
offlinePusher = getui.GetuiClient
}
if config.Config.Push.Jpns.Enable {
offlinePusher = jpush.JPushClient
}
if offlinePusher == nil {
offlinePusher = jpush.JPushClient
}