shop/docs/docs.go

319 lines
9.6 KiB
Go

// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// This file was generated by swaggo/swag
package docs
import (
"bytes"
"encoding/json"
"strings"
"github.com/alecthomas/template"
"github.com/swaggo/swag"
)
var doc = `{
"schemes": {{ marshal .Schemes }},
"swagger": "2.0",
"info": {
"description": "{{.Description}}",
"title": "{{.Title}}",
"contact": {},
"license": {},
"version": "{{.Version}}"
},
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/admin/login": {
"get": {
"produces": [
"application/json"
],
"summary": "后台登录",
"parameters": [
{
"type": "string",
"description": "用户名",
"name": "username",
"in": "query",
"required": true
},
{
"type": "string",
"description": "密码",
"name": "password",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "{\"code\":200,\"data\":{},\"msg\":\"ok\"}",
"schema": {
"type": "string"
}
}
}
}
},
"/admin/v1/employees": {
"get": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"employees"
],
"summary": "获取员工列表",
"parameters": [
{
"type": "string",
"description": "auth by /admin/login",
"name": "Authorization",
"in": "header",
"required": true
},
{
"type": "string",
"description": "Department",
"name": "department",
"in": "query"
},
{
"type": "string",
"description": "Position",
"name": "position",
"in": "query"
},
{
"type": "integer",
"description": "State",
"name": "state",
"in": "query"
}
],
"responses": {
"200": {
"description": "{\"code\": 200, \"data\": {}, \"msg\":\"ok\"}",
"schema": {
"type": "string"
}
}
}
},
"post": {
"consumes": [
"multipart/form-data"
],
"produces": [
"application/json"
],
"tags": [
"employees"
],
"summary": "新增员工",
"parameters": [
{
"type": "string",
"description": "auth by /admin/login",
"name": "Authorization",
"in": "header",
"required": true
},
{
"type": "string",
"description": "员工用户名",
"name": "username",
"in": "formData",
"required": true
},
{
"type": "string",
"description": "员工密码",
"name": "password",
"in": "formData",
"required": true
},
{
"type": "string",
"description": "员工部门",
"name": "department",
"in": "formData",
"required": true
},
{
"type": "string",
"description": "员工职位",
"name": "position",
"in": "formData",
"required": true
}
],
"responses": {
"200": {
"description": "{\"code\": 200, \"data\":{}, \"msg\":\"ok\"}",
"schema": {
"type": "string"
}
}
}
}
},
"/admin/v1/employees/{id}": {
"get": {
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"employees"
],
"summary": "获取单个员工",
"parameters": [
{
"type": "string",
"description": "auth by /admin/login",
"name": "Authorization",
"in": "header",
"required": true
},
{
"type": "integer",
"description": "ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "{\"code\": 200, \"data\": {}, \"msg\": \"ok\"}",
"schema": {
"type": "string"
}
}
}
},
"put": {
"consumes": [
"multipart/form-data"
],
"produces": [
"application/json"
],
"tags": [
"employees"
],
"summary": "更新员工",
"parameters": [
{
"type": "string",
"description": "auth by /admin/login",
"name": "Authorization",
"in": "header",
"required": true
},
{
"type": "integer",
"description": "ID",
"name": "id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "员工用户名",
"name": "username",
"in": "formData"
},
{
"type": "string",
"description": "员工密码",
"name": "password",
"in": "formData"
},
{
"type": "string",
"description": "员工部门",
"name": "department",
"in": "formData"
},
{
"type": "string",
"description": "员工职位",
"name": "position",
"in": "formData"
},
{
"type": "string",
"description": "员工状态",
"name": "state",
"in": "formData"
}
],
"responses": {
"200": {
"description": "{\"code\": 200, \"data\":{}, \"msg\":\"ok\"}",
"schema": {
"type": "string"
}
}
}
}
}
}
}`
type swaggerInfo struct {
Version string
Host string
BasePath string
Schemes []string
Title string
Description string
}
// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = swaggerInfo{
Version: "",
Host: "",
BasePath: "",
Schemes: []string{},
Title: "",
Description: "",
}
type s struct{}
func (s *s) ReadDoc() string {
sInfo := SwaggerInfo
sInfo.Description = strings.Replace(sInfo.Description, "\n", "\\n", -1)
t, err := template.New("swagger_info").Funcs(template.FuncMap{
"marshal": func(v interface{}) string {
a, _ := json.Marshal(v)
return string(a)
},
}).Parse(doc)
if err != nil {
return doc
}
var tpl bytes.Buffer
if err := t.Execute(&tpl, sInfo); err != nil {
return doc
}
return tpl.String()
}
func init() {
swag.Register(swag.Name, &s{})
}