[FIX]验证改在header
This commit is contained in:
parent
4acbcc8932
commit
228028f560
12
docs/docs.go
12
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
|
||||
},
|
||||
{
|
||||
|
|
|
@ -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
|
||||
},
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue