commit
5d66ff951c
@ -1,15 +1,31 @@
|
||||
package check
|
||||
|
||||
import (
|
||||
"Open_IM/pkg/common/config"
|
||||
discoveryRegistry "Open_IM/pkg/discoveryregistry"
|
||||
"Open_IM/pkg/proto/conversation"
|
||||
pbConversation "Open_IM/pkg/proto/conversation"
|
||||
"context"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
type ConversationChecker struct {
|
||||
zk discoveryRegistry.SvcDiscoveryRegistry
|
||||
}
|
||||
|
||||
func NewConversationChecker(zk discoveryRegistry.SvcDiscoveryRegistry) *ConversationChecker {
|
||||
return &ConversationChecker{zk: zk}
|
||||
}
|
||||
|
||||
func (c *ConversationChecker) ModifyConversationField(ctx context.Context, req *pbConversation.ModifyConversationFieldReq) (resp *pbConversation.ModifyConversationFieldResp, err error) {
|
||||
cc, err := c.getConn()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resp, err = conversation.NewConversationClient(cc).ModifyConversationField(ctx, req)
|
||||
return
|
||||
}
|
||||
|
||||
func (c *ConversationChecker) getConn() (*grpc.ClientConn, error) {
|
||||
return c.zk.GetConn(config.Config.RpcRegisterName.OpenImConversationName)
|
||||
}
|
||||
|
@ -1,11 +1,36 @@
|
||||
package check
|
||||
|
||||
import (
|
||||
"Open_IM/pkg/common/config"
|
||||
discoveryRegistry "Open_IM/pkg/discoveryregistry"
|
||||
"Open_IM/pkg/proto/friend"
|
||||
sdkws "Open_IM/pkg/proto/sdkws"
|
||||
"context"
|
||||
"errors"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
func GetFriendsInfo(ctx context.Context, ownerUserID, friendUserID string) (*sdkws.FriendInfo, error) {
|
||||
return nil, errors.New("TODO:GetUserInfo")
|
||||
type FriendChecker struct {
|
||||
zk discoveryRegistry.SvcDiscoveryRegistry
|
||||
}
|
||||
|
||||
func NewFriendChecker(zk discoveryRegistry.SvcDiscoveryRegistry) *FriendChecker {
|
||||
return &FriendChecker{
|
||||
zk: zk,
|
||||
}
|
||||
}
|
||||
|
||||
func (f *FriendChecker) GetFriendsInfo(ctx context.Context, ownerUserID, friendUserID string) (resp *sdkws.FriendInfo, err error) {
|
||||
cc, err := f.getConn()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
r, err := friend.NewFriendClient(cc).GetPaginationFriends(ctx, &friend.GetPaginationFriendsReq{OwnerUserID: ownerUserID, FriendUserIDs: []string{friendUserID}})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resp = r.FriendsInfo[0]
|
||||
return
|
||||
}
|
||||
func (f *FriendChecker) getConn() (*grpc.ClientConn, error) {
|
||||
return f.zk.GetConn(config.Config.RpcRegisterName.OpenImFriendName)
|
||||
}
|
||||
|
Loading…
Reference in new issue