fix: 统一分页请求的 offset 语义
This commit is contained in:
@@ -33,7 +33,7 @@ func (l *ListCommentsLogic) ListComments(req *types.ListCommentsReq) (resp *type
|
||||
req.Limit = 20
|
||||
}
|
||||
out, err := l.svcCtx.CommunityRpc.SearchComments(l.ctx, &communitypb.SearchCommentsReq{
|
||||
Page: req.Offset,
|
||||
Offset: req.Offset,
|
||||
Limit: req.Limit,
|
||||
PostId: req.Id,
|
||||
})
|
||||
@@ -45,7 +45,7 @@ func (l *ListCommentsLogic) ListComments(req *types.ListCommentsReq) (resp *type
|
||||
for _, c := range out.GetComments() {
|
||||
liked := false
|
||||
if uid > 0 {
|
||||
likes, e := l.svcCtx.CommunityRpc.SearchCommentLikes(l.ctx, &communitypb.SearchCommentLikesReq{Page: 0, Limit: 1, CommentId: c.Id, UserId: uid})
|
||||
likes, e := l.svcCtx.CommunityRpc.SearchCommentLikes(l.ctx, &communitypb.SearchCommentLikesReq{Offset: 0, Limit: 1, CommentId: c.Id, UserId: uid})
|
||||
liked = e == nil && len(likes.GetCommentLikes()) > 0
|
||||
}
|
||||
items = append(items, mapComment(l.ctx, l.svcCtx, c, liked))
|
||||
|
||||
Reference in New Issue
Block a user