739 lines
24 KiB
Go
739 lines
24 KiB
Go
// Package docs Code generated by swaggo/swag. DO NOT EDIT
|
||
package docs
|
||
|
||
import "github.com/swaggo/swag"
|
||
|
||
const docTemplate = `{
|
||
"schemes": {{ marshal .Schemes }},
|
||
"swagger": "2.0",
|
||
"info": {
|
||
"description": "{{escape .Description}}",
|
||
"title": "{{.Title}}",
|
||
"termsOfService": "http://swagger.io/terms/",
|
||
"contact": {
|
||
"name": "API Support",
|
||
"url": "http://www.swagger.io/support",
|
||
"email": "support@swagger.io"
|
||
},
|
||
"license": {
|
||
"name": "Apache 2.0",
|
||
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
|
||
},
|
||
"version": "{{.Version}}"
|
||
},
|
||
"host": "{{.Host}}",
|
||
"basePath": "{{.BasePath}}",
|
||
"paths": {
|
||
"/api/captcha/click/gen": {
|
||
"get": {
|
||
"description": "生成按次序点击验证码",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"captcha api"
|
||
],
|
||
"summary": "Captcha Click Generate",
|
||
"responses": {
|
||
"200": {
|
||
"description": "{\"key\": \"验证码标识符\",\"master\":\"主图(用户点击图)base64\",\"subimg\":\"子图(文字次序图)base64\"}",
|
||
"schema": {
|
||
"type": "object",
|
||
"additionalProperties": true
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "{\"msg\": \"错误信息\",\"code\":0}",
|
||
"schema": {
|
||
"type": "object",
|
||
"additionalProperties": true
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/captcha/click/{key}/submit": {
|
||
"post": {
|
||
"description": "校验按次序点击验证码",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"captcha api"
|
||
],
|
||
"summary": "Captcha Click Validate",
|
||
"parameters": [
|
||
{
|
||
"type": "string",
|
||
"description": "验证码标识符",
|
||
"name": "key",
|
||
"in": "path",
|
||
"required": true
|
||
},
|
||
{
|
||
"type": "string",
|
||
"description": "15,851;458,18;58,15;x,y; #用户点击的坐标集合",
|
||
"name": "key",
|
||
"in": "formData",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "{\"flag\": true|false}",
|
||
"schema": {
|
||
"type": "object",
|
||
"additionalProperties": true
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "{\"msg\": \"错误信息\",\"code\":0}",
|
||
"schema": {
|
||
"type": "object",
|
||
"additionalProperties": true
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/captcha/img/gen": {
|
||
"get": {
|
||
"description": "获取一张图片验证码的标识符",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"captcha api"
|
||
],
|
||
"summary": "Captcha Img Generate",
|
||
"responses": {
|
||
"200": {
|
||
"description": "{\"key\": \"ASDFGHJK\"}",
|
||
"schema": {
|
||
"type": "object",
|
||
"additionalProperties": true
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "{\"msg\": \"错误信息\",\"code\":0}",
|
||
"schema": {
|
||
"type": "object",
|
||
"additionalProperties": true
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/captcha/img/validate/{key}": {
|
||
"get": {
|
||
"description": "图片验证码校验(一般情况下后端校验)",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"captcha api"
|
||
],
|
||
"summary": "Captcha Img Validate",
|
||
"parameters": [
|
||
{
|
||
"type": "string",
|
||
"description": "验证码标识符",
|
||
"name": "key",
|
||
"in": "path",
|
||
"required": true
|
||
},
|
||
{
|
||
"type": "string",
|
||
"description": "验证码",
|
||
"name": "code",
|
||
"in": "query",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "{\"msg\": \"正确信息\",\"code\":0}",
|
||
"schema": {
|
||
"type": "object",
|
||
"additionalProperties": true
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "{\"msg\": \"错误信息\",\"code\":0}",
|
||
"schema": {
|
||
"type": "object",
|
||
"additionalProperties": true
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/captcha/img/{key}": {
|
||
"get": {
|
||
"description": "通过 key 获取验证码图片",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"image/png"
|
||
],
|
||
"tags": [
|
||
"captcha api"
|
||
],
|
||
"summary": "Captcha Img Get",
|
||
"parameters": [
|
||
{
|
||
"type": "string",
|
||
"description": "验证码标识符",
|
||
"name": "key",
|
||
"in": "path",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "IMG",
|
||
"schema": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "integer"
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "{\"msg\": \"错误信息\",\"code\":0}",
|
||
"schema": {
|
||
"type": "object",
|
||
"additionalProperties": true
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/file/upload/item-img": {
|
||
"put": {
|
||
"description": "上传商品图片",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"file api"
|
||
],
|
||
"summary": "上传商品图片",
|
||
"parameters": [
|
||
{
|
||
"type": "file",
|
||
"description": "图片文件",
|
||
"name": "file",
|
||
"in": "formData",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "{\"id\": 1,\"key\":\"图片唯一标识\"}",
|
||
"schema": {
|
||
"type": "object",
|
||
"additionalProperties": true
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "{\"msg\": \"错误信息\",\"code\":0}",
|
||
"schema": {
|
||
"type": "object",
|
||
"additionalProperties": true
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/item/list/{type}": {
|
||
"get": {
|
||
"description": "通过类型获取相关商品列表",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"item api"
|
||
],
|
||
"summary": "get item list api",
|
||
"parameters": [
|
||
{
|
||
"type": "string",
|
||
"description": "商品类型",
|
||
"name": "type",
|
||
"in": "path",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "{[\"id\":1],[\"id\":2]}",
|
||
"schema": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/definitions/model.ItemModel"
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "{\"msg\": \"错误信息\",\"code\":0}",
|
||
"schema": {
|
||
"type": "object",
|
||
"additionalProperties": true
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/item/oper/create": {
|
||
"post": {
|
||
"description": "创建商品接口",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"item api"
|
||
],
|
||
"summary": "创建商品",
|
||
"parameters": [
|
||
{
|
||
"description": "商品信息",
|
||
"name": "createItemParam",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/validate.CreateItemParam"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "{\"id\": 1}",
|
||
"schema": {
|
||
"$ref": "#/definitions/model.ItemModel"
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "{\"msg\": \"错误信息\",\"code\":0}",
|
||
"schema": {
|
||
"type": "object",
|
||
"additionalProperties": true
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/item/oper/delete": {
|
||
"delete": {
|
||
"description": "删除商品接口",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"item api"
|
||
],
|
||
"summary": "删除商品",
|
||
"parameters": [
|
||
{
|
||
"description": "商品信息",
|
||
"name": "deleteItemParam",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/validate.DeleteItemParam"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "{\"msg\": \"商品操作成功\"}",
|
||
"schema": {
|
||
"type": "object",
|
||
"additionalProperties": true
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "{\"msg\": \"错误信息\",\"code\":0}",
|
||
"schema": {
|
||
"type": "object",
|
||
"additionalProperties": true
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/item/types": {
|
||
"get": {
|
||
"description": "获取商品类型列表",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"item api"
|
||
],
|
||
"summary": "get item types api",
|
||
"responses": {
|
||
"200": {
|
||
"description": "[{id:1,name:类型1},{id:2,name:类型2}]",
|
||
"schema": {
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/definitions/model.TypeModel"
|
||
}
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "{\"msg\": \"错误信息\",\"code\":0}",
|
||
"schema": {
|
||
"type": "object",
|
||
"additionalProperties": true
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/item/{id}": {
|
||
"get": {
|
||
"description": "获取相关ID的商品信息",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"item api"
|
||
],
|
||
"summary": "get item api",
|
||
"parameters": [
|
||
{
|
||
"type": "integer",
|
||
"description": "商品ID",
|
||
"name": "id",
|
||
"in": "path",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "{\"id\":1}",
|
||
"schema": {
|
||
"$ref": "#/definitions/model.ItemModel"
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "{\"msg\": \"错误信息\",\"code\":0}",
|
||
"schema": {
|
||
"type": "object",
|
||
"additionalProperties": true
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/user/auth/login": {
|
||
"post": {
|
||
"description": "the 用户登录接口",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"auth api"
|
||
],
|
||
"summary": "login api",
|
||
"parameters": [
|
||
{
|
||
"description": "登录参数",
|
||
"name": "loginParam",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/validate.LoginParam"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "{\"jwt\": \"jwt.jwt.jwt\"}",
|
||
"schema": {
|
||
"type": "object",
|
||
"additionalProperties": true
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "{\"msg\": \"错误信息\",\"code\":0}",
|
||
"schema": {
|
||
"type": "object",
|
||
"additionalProperties": true
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"/api/user/auth/signup": {
|
||
"post": {
|
||
"description": "用户注册接口",
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/json"
|
||
],
|
||
"tags": [
|
||
"auth api"
|
||
],
|
||
"summary": "注册API",
|
||
"parameters": [
|
||
{
|
||
"description": "注册参数",
|
||
"name": "signupParam",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/validate.SignupParam"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "{\"msg\": \"注册成功\",\"code\":1}",
|
||
"schema": {
|
||
"type": "object",
|
||
"additionalProperties": true
|
||
}
|
||
},
|
||
"400": {
|
||
"description": "{\"msg\": \"错误信息\",\"code\":0}",
|
||
"schema": {
|
||
"type": "object",
|
||
"additionalProperties": true
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"definitions": {
|
||
"model.ItemModel": {
|
||
"type": "object",
|
||
"properties": {
|
||
"createdAt": {
|
||
"type": "string"
|
||
},
|
||
"desc": {
|
||
"type": "string"
|
||
},
|
||
"id": {
|
||
"type": "integer"
|
||
},
|
||
"img": {
|
||
"type": "string"
|
||
},
|
||
"itemname": {
|
||
"type": "string"
|
||
},
|
||
"price": {
|
||
"type": "integer"
|
||
},
|
||
"state": {
|
||
"type": "string"
|
||
},
|
||
"typeString": {
|
||
"type": "string"
|
||
},
|
||
"types": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "integer"
|
||
}
|
||
},
|
||
"uid": {
|
||
"type": "integer"
|
||
},
|
||
"updatedAt": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"model.TypeModel": {
|
||
"type": "object",
|
||
"properties": {
|
||
"createdAt": {
|
||
"type": "string"
|
||
},
|
||
"id": {
|
||
"type": "integer"
|
||
},
|
||
"name": {
|
||
"type": "string"
|
||
},
|
||
"updatedAt": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"validate.CreateItemParam": {
|
||
"type": "object",
|
||
"required": [
|
||
"desc",
|
||
"img",
|
||
"itemname",
|
||
"price",
|
||
"types"
|
||
],
|
||
"properties": {
|
||
"desc": {
|
||
"type": "string",
|
||
"example": "这是一个女大自用的iPhone18"
|
||
},
|
||
"img": {
|
||
"description": "@description 图片ID,请用 /file/upload/item-img 接口上传图片后获取的图片唯一标识",
|
||
"type": "string",
|
||
"example": "123456789012"
|
||
},
|
||
"itemname": {
|
||
"type": "string",
|
||
"maxLength": 12,
|
||
"example": "女大自用iPhone18"
|
||
},
|
||
"price": {
|
||
"description": "@description 商品价格,单位为分",
|
||
"type": "integer",
|
||
"example": 1000
|
||
},
|
||
"types": {
|
||
"description": "@description 商品类型,可以有多个类型,请用数组传过来,类型id请使用 /item/types 接口获取",
|
||
"type": "array",
|
||
"items": {
|
||
"type": "integer"
|
||
},
|
||
"example": [
|
||
1,
|
||
2
|
||
]
|
||
}
|
||
}
|
||
},
|
||
"validate.DeleteItemParam": {
|
||
"type": "object",
|
||
"required": [
|
||
"id"
|
||
],
|
||
"properties": {
|
||
"id": {
|
||
"type": "integer",
|
||
"example": 1
|
||
}
|
||
}
|
||
},
|
||
"validate.LoginParam": {
|
||
"type": "object",
|
||
"required": [
|
||
"captcha_data",
|
||
"captcha_key",
|
||
"password",
|
||
"username"
|
||
],
|
||
"properties": {
|
||
"captcha_data": {
|
||
"type": "string",
|
||
"example": "DEV1"
|
||
},
|
||
"captcha_key": {
|
||
"type": "string",
|
||
"example": "devonlyy"
|
||
},
|
||
"password": {
|
||
"type": "string",
|
||
"minLength": 6,
|
||
"example": "123456"
|
||
},
|
||
"username": {
|
||
"type": "string",
|
||
"maxLength": 12,
|
||
"example": "wzjian"
|
||
}
|
||
}
|
||
},
|
||
"validate.SignupParam": {
|
||
"type": "object",
|
||
"required": [
|
||
"captcha_data",
|
||
"captcha_key",
|
||
"password",
|
||
"username"
|
||
],
|
||
"properties": {
|
||
"captcha_data": {
|
||
"type": "string",
|
||
"example": "DEV1"
|
||
},
|
||
"captcha_key": {
|
||
"description": "Email string ` + "`" + `json:\"email\" validate:\"required,email\" example:\"wzjian@njtech.edu.cn\"` + "`" + `",
|
||
"type": "string",
|
||
"example": "devonlyy"
|
||
},
|
||
"password": {
|
||
"type": "string",
|
||
"minLength": 6,
|
||
"example": "123456"
|
||
},
|
||
"username": {
|
||
"type": "string",
|
||
"maxLength": 12,
|
||
"example": "wzjian"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}`
|
||
|
||
// SwaggerInfo holds exported Swagger Info so clients can modify it
|
||
var SwaggerInfo = &swag.Spec{
|
||
Version: "1.0",
|
||
Host: "localhost:5001",
|
||
BasePath: "/api",
|
||
Schemes: []string{},
|
||
Title: "Yitao Backend API",
|
||
Description: "Yitao Backend API.",
|
||
InfoInstanceName: "swagger",
|
||
SwaggerTemplate: docTemplate,
|
||
LeftDelim: "{{",
|
||
RightDelim: "}}",
|
||
}
|
||
|
||
func init() {
|
||
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
|
||
}
|