diff --git a/docs/docs.go b/docs/docs.go index 4dc8bcd..15daedc 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -66,9 +66,9 @@ var doc = `{ "parameters": [ { "type": "string", - "description": "Token", - "name": "token", - "in": "query", + "description": "auth by /auth", + "name": "Authorization", + "in": "header", "required": true }, { @@ -109,9 +109,9 @@ var doc = `{ "parameters": [ { "type": "string", - "description": "Token", - "name": "token", - "in": "query", + "description": "auth by /auth", + "name": "Authorization", + "in": "header", "required": true }, { diff --git a/docs/swagger.json b/docs/swagger.json index c640c79..39fe2a7 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -46,9 +46,9 @@ "parameters": [ { "type": "string", - "description": "Token", - "name": "token", - "in": "query", + "description": "auth by /auth", + "name": "Authorization", + "in": "header", "required": true }, { @@ -89,9 +89,9 @@ "parameters": [ { "type": "string", - "description": "Token", - "name": "token", - "in": "query", + "description": "auth by /auth", + "name": "Authorization", + "in": "header", "required": true }, { diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 6bdf787..a4b0e45 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -26,9 +26,9 @@ paths: /admin/v1/employees: get: parameters: - - description: Token - in: query - name: token + - description: auth by /auth + in: header + name: Authorization required: true type: string - description: Department @@ -54,9 +54,9 @@ paths: /admin/v1/employees/{id}: get: parameters: - - description: Token - in: query - name: token + - description: auth by /auth + in: header + name: Authorization required: true type: string - description: ID diff --git a/middleware/jwt/jwt.go b/middleware/jwt/jwt.go index f98deed..d624d5f 100644 --- a/middleware/jwt/jwt.go +++ b/middleware/jwt/jwt.go @@ -13,7 +13,7 @@ func JWT() gin.HandlerFunc { var code int var data interface{} code = e.SUCCESS - token := c.Query("token") + token := c.Request.Header.Get("Authorization") if token == "" { code = e.InvalidParams } else { diff --git a/routers/admin/v1/employee.go b/routers/admin/v1/employee.go index 7628394..bd18125 100644 --- a/routers/admin/v1/employee.go +++ b/routers/admin/v1/employee.go @@ -14,7 +14,7 @@ import ( // @Summary 获取单个员工 // @Produce json -// @Param token query string true "Token" +// @Param Authorization header string true "auth by /auth" // @Param id path int true "ID" // @Success 200 {string} json "{"code": 200, "data": {}, "msg": "ok"}" // @Router /admin/v1/employees/{id} [GET] @@ -48,7 +48,7 @@ func GetEmployee(c *gin.Context) { // @Summary 获取员工列表 // @Produce json -// @Param token query string true "Token" +// @Param Authorization header string true "auth by /auth" // @Param department query string false "Department" // @Param position query string false "Position" // @Param state query int false "State"