fix: 统一所有 RPC 分页校验为 max=100 并补齐默认值
This commit is contained in:
@@ -28,9 +28,14 @@ func NewSearchUserVerificationsLogic(ctx context.Context, svcCtx *svc.ServiceCon
|
||||
}
|
||||
|
||||
func (l *SearchUserVerificationsLogic) SearchUserVerifications(in *pb.SearchUserVerificationsReq) (*pb.SearchUserVerificationsResp, error) {
|
||||
if in.Limit > 1000 {
|
||||
logx.Errorf("Limit exceeds max limit: %d", in.Limit)
|
||||
return nil, errors.New("limit exceeds max limit")
|
||||
if in.Limit <= 0 {
|
||||
in.Limit = 20
|
||||
}
|
||||
if in.Limit > 100 {
|
||||
return nil, errors.New("limit too large")
|
||||
}
|
||||
if in.Offset < 0 {
|
||||
in.Offset = 0
|
||||
}
|
||||
predicates := make([]predicate.UserVerifications, 0, 3)
|
||||
if in.UserId != 0 {
|
||||
|
||||
Reference in New Issue
Block a user