322 lines
10 KiB
JSON
322 lines
10 KiB
JSON
{
|
|
"swagger": "2.0",
|
|
"info": {
|
|
"description": "This is a potato use golang",
|
|
"title": "Potato Api",
|
|
"contact": {},
|
|
"version": "1.0"
|
|
},
|
|
"basePath": "/api",
|
|
"paths": {
|
|
"/v1/auth": {
|
|
"post": {
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"summary": "用户验证",
|
|
"parameters": [
|
|
{
|
|
"description": "用户名,密码",
|
|
"name": "data",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/v1.AuthRequest"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "{\"code\" : 200, \"data\" : {\"token\" : \"\"}, \"msg\" : \"ok\"}",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/v1/register": {
|
|
"post": {
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"summary": "注册用户",
|
|
"parameters": [
|
|
{
|
|
"description": "用户名",
|
|
"name": "data",
|
|
"in": "body",
|
|
"required": true,
|
|
"schema": {
|
|
"$ref": "#/definitions/v1.RegisterRequest"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "{\"success\":true,\"data\":{},\"msg\":\"创建成功\"}",
|
|
"schema": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/v1/vendors": {
|
|
"get": {
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"vendors"
|
|
],
|
|
"summary": "系统厂商列表",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "auth by /auth",
|
|
"name": "Authorization",
|
|
"in": "header",
|
|
"required": true
|
|
},
|
|
{
|
|
"maxLength": 100,
|
|
"type": "string",
|
|
"description": "名称",
|
|
"name": "name",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "页码",
|
|
"name": "page",
|
|
"in": "query"
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "每页数量",
|
|
"name": "page_size",
|
|
"in": "query"
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "请求成功",
|
|
"schema": {
|
|
"$ref": "#/definitions/errcode.Error"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "请求错误",
|
|
"schema": {
|
|
"$ref": "#/definitions/errcode.Error"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "内部错误",
|
|
"schema": {
|
|
"$ref": "#/definitions/errcode.Error"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"post": {
|
|
"consumes": [
|
|
"multipart/form-data"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"vendors"
|
|
],
|
|
"summary": "新增系统厂商",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "auth by /auth",
|
|
"name": "Authorization",
|
|
"in": "header",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "请求成功",
|
|
"schema": {
|
|
"$ref": "#/definitions/errcode.Error"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "请求错误",
|
|
"schema": {
|
|
"$ref": "#/definitions/errcode.Error"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "内部错误",
|
|
"schema": {
|
|
"$ref": "#/definitions/errcode.Error"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/v1/vendors/{id}": {
|
|
"delete": {
|
|
"consumes": [
|
|
"application/json"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"vendors"
|
|
],
|
|
"summary": "删除系统厂商",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "auth by /auth",
|
|
"name": "Authorization",
|
|
"in": "header",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "系统厂商 ID",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "请求成功",
|
|
"schema": {
|
|
"$ref": "#/definitions/errcode.Error"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "请求错误",
|
|
"schema": {
|
|
"$ref": "#/definitions/errcode.Error"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "内部错误",
|
|
"schema": {
|
|
"$ref": "#/definitions/errcode.Error"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"patch": {
|
|
"consumes": [
|
|
"multipart/form-data"
|
|
],
|
|
"produces": [
|
|
"application/json"
|
|
],
|
|
"tags": [
|
|
"vendors"
|
|
],
|
|
"summary": "修改系统厂商",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "auth by /auth",
|
|
"name": "Authorization",
|
|
"in": "header",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "integer",
|
|
"description": "系统厂商 ID",
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "请求成功",
|
|
"schema": {
|
|
"$ref": "#/definitions/errcode.Error"
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "请求错误",
|
|
"schema": {
|
|
"$ref": "#/definitions/errcode.Error"
|
|
}
|
|
},
|
|
"500": {
|
|
"description": "内部错误",
|
|
"schema": {
|
|
"$ref": "#/definitions/errcode.Error"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"definitions": {
|
|
"errcode.Error": {
|
|
"type": "object",
|
|
"properties": {
|
|
"code": {
|
|
"type": "integer"
|
|
},
|
|
"data": {
|
|
"type": "object"
|
|
},
|
|
"msg": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"v1.AuthRequest": {
|
|
"type": "object",
|
|
"required": [
|
|
"password",
|
|
"username"
|
|
],
|
|
"properties": {
|
|
"password": {
|
|
"type": "string"
|
|
},
|
|
"username": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"v1.RegisterRequest": {
|
|
"type": "object",
|
|
"required": [
|
|
"password",
|
|
"username"
|
|
],
|
|
"properties": {
|
|
"nickname": {
|
|
"type": "string"
|
|
},
|
|
"password": {
|
|
"type": "string"
|
|
},
|
|
"username": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |