add page response and jwt auth
This commit is contained in:
parent
37027e40dc
commit
0751e57e46
@ -17,6 +17,7 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// AuthJWT creates a gin middleware for authorization
|
// AuthJWT creates a gin middleware for authorization
|
||||||
|
//goland:noinspection GoUnusedExportedFunction
|
||||||
func AuthJWT(tokenMaker token.Maker) gin.HandlerFunc {
|
func AuthJWT(tokenMaker token.Maker) gin.HandlerFunc {
|
||||||
return func(c *gin.Context) {
|
return func(c *gin.Context) {
|
||||||
authorizationHeader := c.GetHeader(authorizationHeaderKey)
|
authorizationHeader := c.GetHeader(authorizationHeaderKey)
|
||||||
|
|||||||
@ -25,6 +25,14 @@ type response struct {
|
|||||||
// Value string `json:"error"`
|
// 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
|
// NewResponse return response instance
|
||||||
func NewResponse() *response {
|
func NewResponse() *response {
|
||||||
return &response{
|
return &response{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user