mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-05-04 01:01:09 +08:00
modify dictory
This commit is contained in:
parent
120477c092
commit
77b2d4aad0
@ -223,7 +223,6 @@ func (s *friendServer) IsFriend(ctx context.Context, req *pbfriend.IsFriendReq)
|
|||||||
|
|
||||||
// ok
|
// ok
|
||||||
func (s *friendServer) GetPaginationFriends(ctx context.Context, req *pbfriend.GetPaginationFriendsReq) (resp *pbfriend.GetPaginationFriendsResp, err error) {
|
func (s *friendServer) GetPaginationFriends(ctx context.Context, req *pbfriend.GetPaginationFriendsReq) (resp *pbfriend.GetPaginationFriendsResp, err error) {
|
||||||
resp = &pbfriend.GetPaginationFriendsResp{}
|
|
||||||
if err := s.userCheck.Access(ctx, req.UserID); err != nil {
|
if err := s.userCheck.Access(ctx, req.UserID); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -231,6 +230,7 @@ func (s *friendServer) GetPaginationFriends(ctx context.Context, req *pbfriend.G
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
resp = &pbfriend.GetPaginationFriendsResp{}
|
||||||
resp.FriendsInfo, err = (*convert.NewDBFriend(nil, s.RegisterCenter)).DB2PB(ctx, friends)
|
resp.FriendsInfo, err = (*convert.NewDBFriend(nil, s.RegisterCenter)).DB2PB(ctx, friends)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -238,3 +238,15 @@ func (s *friendServer) GetPaginationFriends(ctx context.Context, req *pbfriend.G
|
|||||||
resp.Total = int32(total)
|
resp.Total = int32(total)
|
||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *friendServer) GetFriendIDs(ctx context.Context, req *pbfriend.GetFriendIDsReq) (resp *pbfriend.GetFriendIDsResp, err error) {
|
||||||
|
if err := s.userCheck.Access(ctx, req.UserID); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
resp = &pbfriend.GetFriendIDsResp{}
|
||||||
|
resp.FriendIDs, err = s.FriendDatabase.GetFriendIDs(ctx, req.UserID)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return resp, nil
|
||||||
|
}
|
||||||
|
@ -35,6 +35,7 @@ type FriendDatabase interface {
|
|||||||
PageFriendRequestToMe(ctx context.Context, userID string, pageNumber, showNumber int32) (friends []*relation.FriendRequestModel, total int64, err error)
|
PageFriendRequestToMe(ctx context.Context, userID string, pageNumber, showNumber int32) (friends []*relation.FriendRequestModel, total int64, err error)
|
||||||
// 获取某人指定好友的信息
|
// 获取某人指定好友的信息
|
||||||
FindFriendsWithError(ctx context.Context, ownerUserID string, friendUserIDs []string) (friends []*relation.FriendModel, err error)
|
FindFriendsWithError(ctx context.Context, ownerUserID string, friendUserIDs []string) (friends []*relation.FriendModel, err error)
|
||||||
|
GetFriendIDs(ctx context.Context, ownerUserID string) (friendUserIDs []string, err error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type friendDatabase struct {
|
type friendDatabase struct {
|
||||||
@ -238,3 +239,7 @@ func (f *friendDatabase) FindFriendsWithError(ctx context.Context, ownerUserID s
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (f *friendDatabase) GetFriendIDs(ctx context.Context, ownerUserID string) (friendUserIDs []string, err error) {
|
||||||
|
return f.friend.FindFriendUserIDs(ctx, ownerUserID)
|
||||||
|
}
|
||||||
|
@ -48,6 +48,6 @@ type FriendModelInterface interface {
|
|||||||
FindInWhoseFriends(ctx context.Context, friendUserID string, pageNumber, showNumber int32) (friends []*FriendModel, total int64, err error)
|
FindInWhoseFriends(ctx context.Context, friendUserID string, pageNumber, showNumber int32) (friends []*FriendModel, total int64, err error)
|
||||||
// 获取好友UserID列表
|
// 获取好友UserID列表
|
||||||
FindFriendUserIDs(ctx context.Context, ownerUserID string) (friendUserIDs []string, err error)
|
FindFriendUserIDs(ctx context.Context, ownerUserID string) (friendUserIDs []string, err error)
|
||||||
|
GetFriendIDs(ctx context.Context, ownerUserID string) (friendUserIDs []string, err error)
|
||||||
NewTx(tx any) FriendModelInterface
|
NewTx(tx any) FriendModelInterface
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user