This commit is contained in:
wangchuxiao
2023-05-08 12:39:45 +08:00
parent b34d1e7ee7
commit b95496df73
36 changed files with 969 additions and 981 deletions
+1 -1
View File
@@ -18,7 +18,7 @@ func NewBlackClient(zk discoveryRegistry.SvcDiscoveryRegistry) *BlackClient {
// possibleBlackUserID是否被userID拉黑,也就是是否在userID的黑名单中
func (b *BlackClient) IsBlocked(ctx context.Context, possibleBlackUserID, userID string) (bool, error) {
cc, err := b.getConn()
cc, err := b.getConn(ctx)
if err != nil {
return false, err
}
+6 -6
View File
@@ -18,7 +18,7 @@ func NewConversationClient(zk discoveryRegistry.SvcDiscoveryRegistry) *Conversat
}
func (c *ConversationClient) ModifyConversationField(ctx context.Context, req *pbConversation.ModifyConversationFieldReq) error {
cc, err := c.getConn()
cc, err := c.getConn(ctx)
if err != nil {
return err
}
@@ -27,7 +27,7 @@ func (c *ConversationClient) ModifyConversationField(ctx context.Context, req *p
}
func (c *ConversationClient) GetSingleConversationRecvMsgOpt(ctx context.Context, userID, conversationID string) (int32, error) {
cc, err := c.getConn()
cc, err := c.getConn(ctx)
if err != nil {
return 0, err
}
@@ -42,7 +42,7 @@ func (c *ConversationClient) GetSingleConversationRecvMsgOpt(ctx context.Context
}
func (c *ConversationClient) SingleChatFirstCreateConversation(ctx context.Context, recvID, sendID string) error {
cc, err := c.getConn()
cc, err := c.getConn(ctx)
if err != nil {
return err
}
@@ -51,7 +51,7 @@ func (c *ConversationClient) SingleChatFirstCreateConversation(ctx context.Conte
}
func (c *ConversationClient) GroupChatFirstCreateConversation(ctx context.Context, groupID string, userIDs []string) error {
cc, err := c.getConn()
cc, err := c.getConn(ctx)
if err != nil {
return err
}
@@ -60,7 +60,7 @@ func (c *ConversationClient) GroupChatFirstCreateConversation(ctx context.Contex
}
func (c *ConversationClient) DelGroupChatConversations(ctx context.Context, ownerUserIDs []string, groupID string, maxSeq int64) error {
cc, err := c.getConn()
cc, err := c.getConn(ctx)
if err != nil {
return err
}
@@ -69,7 +69,7 @@ func (c *ConversationClient) DelGroupChatConversations(ctx context.Context, owne
}
func (c *ConversationClient) GetConversationIDs(ctx context.Context, ownerUserID string) ([]string, error) {
cc, err := c.getConn()
cc, err := c.getConn(ctx)
if err != nil {
return nil, err
}
+3 -3
View File
@@ -18,7 +18,7 @@ func NewFriendClient(zk discoveryRegistry.SvcDiscoveryRegistry) *FriendClient {
}
func (f *FriendClient) GetFriendsInfo(ctx context.Context, ownerUserID, friendUserID string) (resp *sdkws.FriendInfo, err error) {
cc, err := f.getConn()
cc, err := f.getConn(ctx)
if err != nil {
return nil, err
}
@@ -32,7 +32,7 @@ func (f *FriendClient) GetFriendsInfo(ctx context.Context, ownerUserID, friendUs
// possibleFriendUserID是否在userID的好友中
func (f *FriendClient) IsFriend(ctx context.Context, possibleFriendUserID, userID string) (bool, error) {
cc, err := f.getConn()
cc, err := f.getConn(ctx)
if err != nil {
return false, err
}
@@ -45,7 +45,7 @@ func (f *FriendClient) IsFriend(ctx context.Context, possibleFriendUserID, userI
}
func (f *FriendClient) GetFriendIDs(ctx context.Context, ownerUserID string) (friendIDs []string, err error) {
cc, err := f.getConn()
cc, err := f.getConn(ctx)
if err != nil {
return nil, err
}
+5 -5
View File
@@ -27,7 +27,7 @@ func NewGroupClient(client discoveryregistry.SvcDiscoveryRegistry) *GroupClient
}
func (g *GroupClient) GetGroupInfos(ctx context.Context, groupIDs []string, complete bool) ([]*sdkws.GroupInfo, error) {
cc, err := g.getConn()
cc, err := g.getConn(ctx)
if err != nil {
return nil, err
}
@@ -66,7 +66,7 @@ func (g *GroupClient) GetGroupInfoMap(ctx context.Context, groupIDs []string, co
}
func (g *GroupClient) GetGroupMemberInfos(ctx context.Context, groupID string, userIDs []string, complete bool) ([]*sdkws.GroupMemberFullInfo, error) {
cc, err := g.getConn()
cc, err := g.getConn(ctx)
if err != nil {
return nil, err
}
@@ -106,7 +106,7 @@ func (g *GroupClient) GetGroupMemberInfoMap(ctx context.Context, groupID string,
}
func (g *GroupClient) GetOwnerAndAdminInfos(ctx context.Context, groupID string) ([]*sdkws.GroupMemberFullInfo, error) {
cc, err := g.getConn()
cc, err := g.getConn(ctx)
if err != nil {
return nil, err
}
@@ -118,7 +118,7 @@ func (g *GroupClient) GetOwnerAndAdminInfos(ctx context.Context, groupID string)
}
func (g *GroupClient) GetOwnerInfo(ctx context.Context, groupID string) (*sdkws.GroupMemberFullInfo, error) {
cc, err := g.getConn()
cc, err := g.getConn(ctx)
if err != nil {
return nil, err
}
@@ -130,7 +130,7 @@ func (g *GroupClient) GetOwnerInfo(ctx context.Context, groupID string) (*sdkws.
}
func (g *GroupClient) GetGroupMemberIDs(ctx context.Context, groupID string) ([]string, error) {
cc, err := g.getConn()
cc, err := g.getConn(ctx)
if err != nil {
return nil, err
}
+2 -2
View File
@@ -74,8 +74,8 @@ func (m *MetaClient) getFaceURLAndName(userID string) (faceURL, nickname string,
return users[0].GetFaceURL(), users[0].GetNickname(), nil
}
func (m *MetaClient) getConn() (*grpc.ClientConn, error) {
return m.client.GetConn(m.rpcRegisterName)
func (m *MetaClient) getConn(ctx context.Context) (*grpc.ClientConn, error) {
return m.client.GetConn(ctx, m.rpcRegisterName)
}
type CommonUser interface {
+3 -3
View File
@@ -108,7 +108,7 @@ func NewMsgClient(zk discoveryregistry.SvcDiscoveryRegistry) *MsgClient {
}
func (m *MsgClient) SendMsg(ctx context.Context, req *msg.SendMsgReq) (*msg.SendMsgResp, error) {
cc, err := m.getConn()
cc, err := m.getConn(ctx)
if err != nil {
return nil, err
}
@@ -117,7 +117,7 @@ func (m *MsgClient) SendMsg(ctx context.Context, req *msg.SendMsgReq) (*msg.Send
}
func (m *MsgClient) GetMaxSeq(ctx context.Context, req *sdkws.GetMaxSeqReq) (*sdkws.GetMaxSeqResp, error) {
cc, err := m.getConn()
cc, err := m.getConn(ctx)
if err != nil {
return nil, err
}
@@ -126,7 +126,7 @@ func (m *MsgClient) GetMaxSeq(ctx context.Context, req *sdkws.GetMaxSeqReq) (*sd
}
func (m *MsgClient) PullMessageBySeqList(ctx context.Context, req *sdkws.PullMessageBySeqsReq) (*sdkws.PullMessageBySeqsResp, error) {
cc, err := m.getConn()
cc, err := m.getConn(ctx)
if err != nil {
return nil, err
}
+2 -2
View File
@@ -27,7 +27,7 @@ func NewUserClient(client discoveryregistry.SvcDiscoveryRegistry) *UserClient {
}
func (u *UserClient) GetUsersInfo(ctx context.Context, userIDs []string) ([]*sdkws.UserInfo, error) {
cc, err := u.getConn()
cc, err := u.getConn(ctx)
if err != nil {
return nil, err
}
@@ -97,7 +97,7 @@ func (u *UserClient) GetPublicUserInfoMap(ctx context.Context, userIDs []string,
}
func (u *UserClient) GetUserGlobalMsgRecvOpt(ctx context.Context, userID string) (int32, error) {
cc, err := u.getConn()
cc, err := u.getConn(ctx)
if err != nil {
return 0, err
}