test-errcode
wangchuxiao 2 years ago
parent 2f8c65f930
commit 19f5354721

@ -178,7 +178,8 @@ func (s *friendServer) GetPaginationFriendsApplyTo(ctx context.Context, req *pbf
if err := s.userCheck.Access(ctx, req.UserID); err != nil {
return nil, err
}
friendRequests, total, err := s.FriendDatabase.PageFriendRequestToMe(ctx, req.UserID, req.Pagination.PageNumber, req.Pagination.ShowNumber)
pageNumber, showNumber := utils.GetPage(req.Pagination)
friendRequests, total, err := s.FriendDatabase.PageFriendRequestToMe(ctx, req.UserID, pageNumber, showNumber)
if err != nil {
return nil, err
}
@ -196,11 +197,7 @@ func (s *friendServer) GetPaginationFriendsApplyFrom(ctx context.Context, req *p
if err := s.userCheck.Access(ctx, req.UserID); err != nil {
return nil, err
}
var pageNumber, showNumber int32
if req.Pagination != nil {
pageNumber = req.Pagination.PageNumber
showNumber = req.Pagination.ShowNumber
}
pageNumber, showNumber := utils.GetPage(req.Pagination)
friendRequests, total, err := s.FriendDatabase.PageFriendRequestFromMe(ctx, req.UserID, pageNumber, showNumber)
if err != nil {
return nil, err
@ -228,7 +225,8 @@ func (s *friendServer) GetPaginationFriends(ctx context.Context, req *pbfriend.G
if err := s.userCheck.Access(ctx, req.UserID); err != nil {
return nil, err
}
friends, total, err := s.FriendDatabase.PageOwnerFriends(ctx, req.UserID, req.Pagination.PageNumber, req.Pagination.ShowNumber)
pageNumber, showNumber := utils.GetPage(req.Pagination)
friends, total, err := s.FriendDatabase.PageOwnerFriends(ctx, req.UserID, pageNumber, showNumber)
if err != nil {
return nil, err
}

@ -0,0 +1,10 @@
package utils
import "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/sdkws"
func GetPage(pagination *sdkws.RequestPagination) (pageNumber, showNumber int32) {
if pagination != nil {
return pagination.PageNumber, pagination.ShowNumber
}
return
}
Loading…
Cancel
Save