add page response and jwt auth

This commit is contained in:
kenneth 2022-04-08 16:56:49 +08:00
parent 37027e40dc
commit 0751e57e46
2 changed files with 9 additions and 0 deletions

View File

@ -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)

View File

@ -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{