diff --git a/app/users/api/internal/logic/verification_admin/getVerificationsLogic.go b/app/users/api/internal/logic/verification_admin/getVerificationsLogic.go index 5e35951..cd4285a 100644 --- a/app/users/api/internal/logic/verification_admin/getVerificationsLogic.go +++ b/app/users/api/internal/logic/verification_admin/getVerificationsLogic.go @@ -36,16 +36,16 @@ func (l *GetVerificationsLogic) GetVerifications(req *types.GetPendingListReq) ( if err != nil { return nil, err } - page := req.Page - if page < 1 { - page = 1 + offset := req.Offset + if offset < 0 { + offset = 0 } - limit := req.Size + limit := req.Limit if limit <= 0 { limit = 20 } verifications, err := l.svcCtx.UserVerificationsRpc.SearchUserVerifications(l.ctx, &pb.SearchUserVerificationsReq{ - Page: page - 1, + Page: offset / limit, Limit: limit, Role: req.Role, Status: req.Status, diff --git a/app/users/api/internal/types/types.go b/app/users/api/internal/types/types.go index b21d69b..ff07a52 100644 --- a/app/users/api/internal/types/types.go +++ b/app/users/api/internal/types/types.go @@ -20,8 +20,8 @@ type GetMyVerificationsResp struct { } type GetPendingListReq struct { - Page int64 `form:"page,default=1"` - Size int64 `form:"size,default=20"` + Offset int64 `form:"offset,default=0"` + Limit int64 `form:"limit,default=20"` Role string `form:"role,optional"` // 筛选角色 Status string `form:"status,optional"` // 筛选状态,默认 pending } diff --git a/desc/api/docs/users-api.json b/desc/api/docs/users-api.json index be905e5..cb39b0f 100644 --- a/desc/api/docs/users-api.json +++ b/desc/api/docs/users-api.json @@ -28,9 +28,9 @@ "parameters": [ { "type": "integer", - "default": 1, - "example": 1, - "name": "page", + "default": 0, + "example": 0, + "name": "offset", "in": "query", "required": true }, @@ -38,7 +38,7 @@ "type": "integer", "default": 20, "example": 20, - "name": "size", + "name": "limit", "in": "query", "required": true }, @@ -1073,4 +1073,4 @@ "x-github": "https://github.com/zeromicro/go-zero", "x-go-zero-doc": "https://go-zero.dev/", "x-goctl-version": "1.10.1" -} \ No newline at end of file +} diff --git a/desc/api/users.api b/desc/api/users.api index c3c2058..cadf9af 100644 --- a/desc/api/users.api +++ b/desc/api/users.api @@ -39,8 +39,8 @@ type ( } // 管理员:获取待审核列表请求 GetPendingListReq { - Page int64 `form:"page,default=1"` - Size int64 `form:"size,default=20"` + Offset int64 `form:"offset,default=0"` + Limit int64 `form:"limit,default=20"` Role string `form:"role,optional"` // 筛选角色 Status string `form:"status,optional"` // 筛选状态,默认 pending } @@ -260,4 +260,3 @@ service users-api { @handler RejectVerification post /verifications/:id/reject (RejectVerificationReq) returns (VerificationEmptyResp) } -