fix: 统一所有 RPC 分页校验为 max=100 并补齐默认值
This commit is contained in:
@@ -2,6 +2,7 @@ package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"strings"
|
||||
|
||||
"juwan-backend/app/community/rpc/internal/svc"
|
||||
@@ -29,6 +30,9 @@ func (l *SearchCommentsLogic) SearchComments(in *pb.SearchCommentsReq) (*pb.Sear
|
||||
if limit <= 0 {
|
||||
limit = 20
|
||||
}
|
||||
if limit > 100 {
|
||||
return nil, errors.New("limit too large")
|
||||
}
|
||||
offset := in.GetOffset()
|
||||
if offset < 0 {
|
||||
offset = 0
|
||||
|
||||
Reference in New Issue
Block a user