modify dictory

test-errcode
wangchuxiao 2 years ago
parent 120477c092
commit 77b2d4aad0

@ -223,7 +223,6 @@ func (s *friendServer) IsFriend(ctx context.Context, req *pbfriend.IsFriendReq)
// ok
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 {
return nil, err
}
@ -231,6 +230,7 @@ func (s *friendServer) GetPaginationFriends(ctx context.Context, req *pbfriend.G
if err != nil {
return nil, err
}
resp = &pbfriend.GetPaginationFriendsResp{}
resp.FriendsInfo, err = (*convert.NewDBFriend(nil, s.RegisterCenter)).DB2PB(ctx, friends)
if err != nil {
return nil, err
@ -238,3 +238,15 @@ func (s *friendServer) GetPaginationFriends(ctx context.Context, req *pbfriend.G
resp.Total = int32(total)
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)
// 获取某人指定好友的信息
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 {
@ -238,3 +239,7 @@ func (f *friendDatabase) FindFriendsWithError(ctx context.Context, ownerUserID s
}
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)
// 获取好友UserID列表
FindFriendUserIDs(ctx context.Context, ownerUserID string) (friendUserIDs []string, err error)
GetFriendIDs(ctx context.Context, ownerUserID string) (friendUserIDs []string, err error)
NewTx(tx any) FriendModelInterface
}

Loading…
Cancel
Save