notification

This commit is contained in:
withchao
2023-05-04 12:11:29 +08:00
parent 0935f1d57b
commit 3e1f97e300
26 changed files with 948 additions and 195 deletions
+2 -2
View File
@@ -20,10 +20,10 @@ var Terminal = []int{constant.IOSPlatformID, constant.AndroidPlatformID, constan
type Fcm struct {
fcmMsgCli *messaging.Client
cache cache.Model
cache cache.MsgModel
}
func NewClient(cache cache.Model) *Fcm {
func NewClient(cache cache.MsgModel) *Fcm {
opt := option.WithCredentialsFile(filepath.Join(config.Root, "config", config.Config.Push.Fcm.ServiceAccount))
fcmApp, err := firebase.NewApp(context.Background(), nil, opt)
if err != nil {
+1 -1
View File
@@ -9,7 +9,7 @@ import (
)
func Test_Push(t *testing.T) {
var redis cache.Model
var redis cache.MsgModel
offlinePusher := NewClient(redis)
err := offlinePusher.Push(context.Background(), []string{"userID1"}, "test", "test", &offlinepush.Opts{})
assert.Nil(t, err)
+2 -2
View File
@@ -38,12 +38,12 @@ const (
)
type Client struct {
cache cache.Model
cache cache.MsgModel
tokenExpireTime int64
taskIDTTL int64
}
func NewClient(cache cache.Model) *Client {
func NewClient(cache cache.MsgModel) *Client {
return &Client{cache: cache, tokenExpireTime: tokenExpireTime, taskIDTTL: taskIDTTL}
}
+1 -1
View File
@@ -21,7 +21,7 @@ func Start(client discoveryregistry.SvcDiscoveryRegistry, server *grpc.Server) e
if err != nil {
return err
}
cacheModel := cache.NewCacheModel(rdb)
cacheModel := cache.NewMsgCacheModel(rdb)
offlinePusher := NewOfflinePusher(cacheModel)
database := controller.NewPushDatabase(cacheModel)
pusher := NewPusher(client, offlinePusher, database, localcache.NewGroupLocalCache(client), localcache.NewConversationLocalCache(client))
+1 -1
View File
@@ -44,7 +44,7 @@ func NewPusher(client discoveryregistry.SvcDiscoveryRegistry, offlinePusher offl
}
}
func NewOfflinePusher(cache cache.Model) offlinepush.OfflinePusher {
func NewOfflinePusher(cache cache.MsgModel) offlinepush.OfflinePusher {
var offlinePusher offlinepush.OfflinePusher
if config.Config.Push.Getui.Enable {
offlinePusher = getui.NewClient(cache)