mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-25 11:06:43 +08:00
merge shichuang
This commit is contained in:
commit
af2baba1e3
@ -234,6 +234,8 @@ push:
|
|||||||
appKey: ""
|
appKey: ""
|
||||||
intent: ""
|
intent: ""
|
||||||
enable: false
|
enable: false
|
||||||
|
channelID: ""
|
||||||
|
channelName: ""
|
||||||
fcm: #firebase cloud message 消息推送
|
fcm: #firebase cloud message 消息推送
|
||||||
serviceAccount: "openim-5c6c0-firebase-adminsdk-ppwol-8765884a78.json" #帐号文件,此处需要改修配置,并且这个文件放在 config目录下
|
serviceAccount: "openim-5c6c0-firebase-adminsdk-ppwol-8765884a78.json" #帐号文件,此处需要改修配置,并且这个文件放在 config目录下
|
||||||
enable: false
|
enable: false
|
||||||
|
@ -90,6 +90,8 @@ type Android struct {
|
|||||||
type Notification struct {
|
type Notification struct {
|
||||||
Title string `json:"title"`
|
Title string `json:"title"`
|
||||||
Body string `json:"body"`
|
Body string `json:"body"`
|
||||||
|
ChannelID string `json:"channelID"`
|
||||||
|
ChannelName string `json:"ChannelName"`
|
||||||
ClickType string `json:"click_type"`
|
ClickType string `json:"click_type"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,6 +140,8 @@ func (g *Getui) Push(userIDList []string, title, detailContent, operationID stri
|
|||||||
Title: title,
|
Title: title,
|
||||||
Body: detailContent,
|
Body: detailContent,
|
||||||
ClickType: "startapp",
|
ClickType: "startapp",
|
||||||
|
ChannelID: config.Config.Push.Getui.ChannelID,
|
||||||
|
ChannelName: config.Config.Push.Getui.ChannelName,
|
||||||
}
|
}
|
||||||
pushReq.PushChannel.Ios.Aps.Sound = "default"
|
pushReq.PushChannel.Ios.Aps.Sound = "default"
|
||||||
pushReq.PushChannel.Ios.Aps.Alert = Alert{
|
pushReq.PushChannel.Ios.Aps.Alert = Alert{
|
||||||
|
@ -208,6 +208,8 @@ type config struct {
|
|||||||
Enable bool `yaml:"enable"`
|
Enable bool `yaml:"enable"`
|
||||||
Intent string `yaml:"intent"`
|
Intent string `yaml:"intent"`
|
||||||
MasterSecret string `yaml:"masterSecret"`
|
MasterSecret string `yaml:"masterSecret"`
|
||||||
|
ChannelID string `yaml:"channelID"`
|
||||||
|
ChannelName string `yaml:"channelName"`
|
||||||
}
|
}
|
||||||
Fcm struct {
|
Fcm struct {
|
||||||
ServiceAccount string `yaml:"serviceAccount"`
|
ServiceAccount string `yaml:"serviceAccount"`
|
||||||
|
@ -6,7 +6,6 @@ import (
|
|||||||
"Open_IM/pkg/utils"
|
"Open_IM/pkg/utils"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"go.etcd.io/etcd/api/v3/mvccpb"
|
"go.etcd.io/etcd/api/v3/mvccpb"
|
||||||
clientv3 "go.etcd.io/etcd/client/v3"
|
clientv3 "go.etcd.io/etcd/client/v3"
|
||||||
|
|
||||||
@ -271,8 +270,38 @@ func (r *Resolver) watch(prefix string, addrList []resolver.Address) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var Conn4UniqueList []*grpc.ClientConn
|
||||||
|
var Conn4UniqueListMtx sync.RWMutex
|
||||||
|
var IsUpdateStart bool
|
||||||
|
var IsUpdateStartMtx sync.RWMutex
|
||||||
|
|
||||||
func GetDefaultGatewayConn4Unique(schema, etcdaddr, operationID string) []*grpc.ClientConn {
|
func GetDefaultGatewayConn4Unique(schema, etcdaddr, operationID string) []*grpc.ClientConn {
|
||||||
grpcConns := getConn4Unique(schema, etcdaddr, config.Config.RpcRegisterName.OpenImRelayName)
|
IsUpdateStartMtx.Lock()
|
||||||
|
if IsUpdateStart == false {
|
||||||
|
Conn4UniqueList = getConn4Unique(schema, etcdaddr, config.Config.RpcRegisterName.OpenImRelayName)
|
||||||
|
go func() {
|
||||||
|
for {
|
||||||
|
select {
|
||||||
|
case <-time.After(time.Second * time.Duration(30)):
|
||||||
|
Conn4UniqueListMtx.Lock()
|
||||||
|
Conn4UniqueList = getConn4Unique(schema, etcdaddr, config.Config.RpcRegisterName.OpenImRelayName)
|
||||||
|
Conn4UniqueListMtx.Unlock()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
IsUpdateStart = true
|
||||||
|
IsUpdateStartMtx.Unlock()
|
||||||
|
|
||||||
|
Conn4UniqueListMtx.Lock()
|
||||||
|
var clientConnList []*grpc.ClientConn
|
||||||
|
for _, v := range Conn4UniqueList {
|
||||||
|
clientConnList = append(clientConnList, v)
|
||||||
|
}
|
||||||
|
Conn4UniqueListMtx.Unlock()
|
||||||
|
|
||||||
|
//grpcConns := getConn4Unique(schema, etcdaddr, config.Config.RpcRegisterName.OpenImRelayName)
|
||||||
|
grpcConns := clientConnList
|
||||||
if len(grpcConns) > 0 {
|
if len(grpcConns) > 0 {
|
||||||
return grpcConns
|
return grpcConns
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user