[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": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "Token",
|
"description": "auth by /auth",
|
||||||
"name": "token",
|
"name": "Authorization",
|
||||||
"in": "query",
|
"in": "header",
|
||||||
"required": true
|
"required": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -109,9 +109,9 @@ var doc = `{
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "Token",
|
"description": "auth by /auth",
|
||||||
"name": "token",
|
"name": "Authorization",
|
||||||
"in": "query",
|
"in": "header",
|
||||||
"required": true
|
"required": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -46,9 +46,9 @@
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "Token",
|
"description": "auth by /auth",
|
||||||
"name": "token",
|
"name": "Authorization",
|
||||||
"in": "query",
|
"in": "header",
|
||||||
"required": true
|
"required": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -89,9 +89,9 @@
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "Token",
|
"description": "auth by /auth",
|
||||||
"name": "token",
|
"name": "Authorization",
|
||||||
"in": "query",
|
"in": "header",
|
||||||
"required": true
|
"required": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,9 +26,9 @@ paths:
|
||||||
/admin/v1/employees:
|
/admin/v1/employees:
|
||||||
get:
|
get:
|
||||||
parameters:
|
parameters:
|
||||||
- description: Token
|
- description: auth by /auth
|
||||||
in: query
|
in: header
|
||||||
name: token
|
name: Authorization
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
- description: Department
|
- description: Department
|
||||||
|
@ -54,9 +54,9 @@ paths:
|
||||||
/admin/v1/employees/{id}:
|
/admin/v1/employees/{id}:
|
||||||
get:
|
get:
|
||||||
parameters:
|
parameters:
|
||||||
- description: Token
|
- description: auth by /auth
|
||||||
in: query
|
in: header
|
||||||
name: token
|
name: Authorization
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
- description: ID
|
- description: ID
|
||||||
|
|
|
@ -13,7 +13,7 @@ func JWT() gin.HandlerFunc {
|
||||||
var code int
|
var code int
|
||||||
var data interface{}
|
var data interface{}
|
||||||
code = e.SUCCESS
|
code = e.SUCCESS
|
||||||
token := c.Query("token")
|
token := c.Request.Header.Get("Authorization")
|
||||||
if token == "" {
|
if token == "" {
|
||||||
code = e.InvalidParams
|
code = e.InvalidParams
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -14,7 +14,7 @@ import (
|
||||||
|
|
||||||
// @Summary 获取单个员工
|
// @Summary 获取单个员工
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Param token query string true "Token"
|
// @Param Authorization header string true "auth by /auth"
|
||||||
// @Param id path int true "ID"
|
// @Param id path int true "ID"
|
||||||
// @Success 200 {string} json "{"code": 200, "data": {}, "msg": "ok"}"
|
// @Success 200 {string} json "{"code": 200, "data": {}, "msg": "ok"}"
|
||||||
// @Router /admin/v1/employees/{id} [GET]
|
// @Router /admin/v1/employees/{id} [GET]
|
||||||
|
@ -48,7 +48,7 @@ func GetEmployee(c *gin.Context) {
|
||||||
|
|
||||||
// @Summary 获取员工列表
|
// @Summary 获取员工列表
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Param token query string true "Token"
|
// @Param Authorization header string true "auth by /auth"
|
||||||
// @Param department query string false "Department"
|
// @Param department query string false "Department"
|
||||||
// @Param position query string false "Position"
|
// @Param position query string false "Position"
|
||||||
// @Param state query int false "State"
|
// @Param state query int false "State"
|
||||||
|
|
Loading…
Reference in New Issue