commit
5d66ff951c
@ -1,15 +1,31 @@
|
|||||||
package check
|
package check
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"Open_IM/pkg/common/config"
|
||||||
discoveryRegistry "Open_IM/pkg/discoveryregistry"
|
discoveryRegistry "Open_IM/pkg/discoveryregistry"
|
||||||
|
"Open_IM/pkg/proto/conversation"
|
||||||
pbConversation "Open_IM/pkg/proto/conversation"
|
pbConversation "Open_IM/pkg/proto/conversation"
|
||||||
"context"
|
"context"
|
||||||
|
"google.golang.org/grpc"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ConversationChecker struct {
|
type ConversationChecker struct {
|
||||||
zk discoveryRegistry.SvcDiscoveryRegistry
|
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) {
|
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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *ConversationChecker) getConn() (*grpc.ClientConn, error) {
|
||||||
|
return c.zk.GetConn(config.Config.RpcRegisterName.OpenImConversationName)
|
||||||
|
}
|
||||||
|
@ -1,11 +1,36 @@
|
|||||||
package check
|
package check
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"Open_IM/pkg/common/config"
|
||||||
|
discoveryRegistry "Open_IM/pkg/discoveryregistry"
|
||||||
|
"Open_IM/pkg/proto/friend"
|
||||||
sdkws "Open_IM/pkg/proto/sdkws"
|
sdkws "Open_IM/pkg/proto/sdkws"
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"google.golang.org/grpc"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetFriendsInfo(ctx context.Context, ownerUserID, friendUserID string) (*sdkws.FriendInfo, error) {
|
type FriendChecker struct {
|
||||||
return nil, errors.New("TODO:GetUserInfo")
|
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