test-errcode
wangchuxiao 2 years ago
parent 17e747049c
commit 9ea3e4c758

@ -2,11 +2,9 @@ package api
import ( import (
"context" "context"
"fmt"
"github.com/OpenIMSDK/Open-IM-Server/pkg/a2r" "github.com/OpenIMSDK/Open-IM-Server/pkg/a2r"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/log"
"github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry" "github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry"
"github.com/OpenIMSDK/Open-IM-Server/pkg/proto/group" "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/group"
@ -28,8 +26,6 @@ func (o *Group) client(ctx context.Context) (group.GroupClient, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
log.ZDebug(ctx, "get conn success", "conn", conn, "config", config.Config.RpcRegisterName.OpenImGroupName)
fmt.Println("conn", conn)
return group.NewGroupClient(conn), nil return group.NewGroupClient(conn), nil
} }

@ -48,19 +48,19 @@ func Start(client discoveryregistry.SvcDiscoveryRegistry, server *grpc.Server) e
if err != nil { if err != nil {
return err return err
} }
user := rpcclient.NewUserClient(client) // user := rpcclient.NewUserClient(client)
database := controller.InitGroupDatabase(db, rdb, mongo.GetDatabase()) database := controller.InitGroupDatabase(db, rdb, mongo.GetDatabase())
pbGroup.RegisterGroupServer(server, &groupServer{ pbGroup.RegisterGroupServer(server, &groupServer{
GroupDatabase: database, GroupDatabase: database,
User: user, // User: user,
Notification: notification.NewGroupNotificationSender(database, client, func(ctx context.Context, userIDs []string) ([]rpcclient.CommonUser, error) { // Notification: notification.NewGroupNotificationSender(database, client, func(ctx context.Context, userIDs []string) ([]rpcclient.CommonUser, error) {
users, err := user.GetUsersInfo(ctx, userIDs) // users, err := user.GetUsersInfo(ctx, userIDs)
if err != nil { // if err != nil {
return nil, err // return nil, err
} // }
return utils.Slice(users, func(e *sdkws.UserInfo) rpcclient.CommonUser { return e }), nil // return utils.Slice(users, func(e *sdkws.UserInfo) rpcclient.CommonUser { return e }), nil
}), // }),
conversationRpcClient: rpcclient.NewConversationClient(client), // conversationRpcClient: rpcclient.NewConversationClient(client),
}) })
return nil return nil
} }

@ -1,6 +1,8 @@
package cmd package cmd
import ( import (
"errors"
"github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry" "github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry"
"github.com/OpenIMSDK/Open-IM-Server/pkg/startrpc" "github.com/OpenIMSDK/Open-IM-Server/pkg/startrpc"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -25,5 +27,8 @@ func (a *RpcCmd) Exec() error {
} }
func (a *RpcCmd) StartSvr(name string, rpcFn func(client discoveryregistry.SvcDiscoveryRegistry, server *grpc.Server) error) error { func (a *RpcCmd) StartSvr(name string, rpcFn func(client discoveryregistry.SvcDiscoveryRegistry, server *grpc.Server) error) error {
if a.GetPortFlag() == 0 {
return errors.New("port is required")
}
return startrpc.Start(a.GetPortFlag(), name, a.GetPrometheusPortFlag(), rpcFn) return startrpc.Start(a.GetPortFlag(), name, a.GetPrometheusPortFlag(), rpcFn)
} }

Loading…
Cancel
Save