This commit is contained in:
wangchuxiao
2023-06-20 22:12:01 +08:00
parent 5e634ac91f
commit ee8ee48418
31 changed files with 401 additions and 565 deletions
+3 -3
View File
@@ -25,7 +25,7 @@ import (
type friendServer struct {
friendDatabase controller.FriendDatabase
blackDatabase controller.BlackDatabase
userRpcClient *rpcclient.UserClient
userRpcClient *rpcclient.UserRpcClient
notificationSender *notification.FriendNotificationSender
RegisterCenter registry.SvcDiscoveryRegistry
}
@@ -44,12 +44,12 @@ func Start(client registry.SvcDiscoveryRegistry, server *grpc.Server) error {
}
blackDB := relation.NewBlackGorm(db)
friendDB := relation.NewFriendGorm(db)
userRpcClient := rpcclient.NewUserClient(client)
userRpcClient := rpcclient.NewUserRpcClient(client)
notificationSender := notification.NewFriendNotificationSender(client, notification.WithRpcFunc(userRpcClient.GetUsersInfo))
pbfriend.RegisterFriendServer(server, &friendServer{
friendDatabase: controller.NewFriendDatabase(friendDB, relation.NewFriendRequestGorm(db), cache.NewFriendCacheRedis(rdb, friendDB, cache.GetDefaultOpt()), tx.NewGorm(db)),
blackDatabase: controller.NewBlackDatabase(blackDB, cache.NewBlackCacheRedis(rdb, blackDB, cache.GetDefaultOpt())),
userRpcClient: userRpcClient,
userRpcClient: &userRpcClient,
notificationSender: notificationSender,
RegisterCenter: client,
})