From 0751e57e46c977a132b365b126f73831d493ff4b Mon Sep 17 00:00:00 2001 From: kenneth <1185230223@qq.com> Date: Fri, 8 Apr 2022 16:56:49 +0800 Subject: [PATCH] add page response and jwt auth --- pkg/gin/frame/auth_jwt.go | 1 + pkg/gin/frame/response.go | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/pkg/gin/frame/auth_jwt.go b/pkg/gin/frame/auth_jwt.go index 822732e..a653636 100644 --- a/pkg/gin/frame/auth_jwt.go +++ b/pkg/gin/frame/auth_jwt.go @@ -17,6 +17,7 @@ const ( ) // AuthJWT creates a gin middleware for authorization +//goland:noinspection GoUnusedExportedFunction func AuthJWT(tokenMaker token.Maker) gin.HandlerFunc { return func(c *gin.Context) { authorizationHeader := c.GetHeader(authorizationHeaderKey) diff --git a/pkg/gin/frame/response.go b/pkg/gin/frame/response.go index af962a4..fcbb89d 100644 --- a/pkg/gin/frame/response.go +++ b/pkg/gin/frame/response.go @@ -25,6 +25,14 @@ type response struct { // Value string `json:"error"` //} +// PageData 分页数据 +type PageData struct { + Total int `json:"total"` + PageNo int `json:"page_no"` + PageSize int `json:"page_size"` + Result interface{} `json:"result"` +} + // NewResponse return response instance func NewResponse() *response { return &response{