YiTao/docs/swagger.json

846 lines
28 KiB
JSON
Raw Normal View History

2024-11-09 14:59:27 +08:00
{
"swagger": "2.0",
"info": {
"description": "Yitao Backend API.",
"title": "Yitao Backend API",
"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": "1.0"
},
"host": "localhost:5001",
"basePath": "/api",
"paths": {
"/api/admin/type/create": {
"post": {
"description": "创建商品类型",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"admin api"
],
"summary": "创建商品类型",
"parameters": [
{
"description": "类型名称",
"name": "name",
"in": "body",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "{\"code\": 0}",
"schema": {
"type": "object",
"additionalProperties": true
}
},
"400": {
"description": "{\"msg\": \"错误信息\",\"code\":0}\"`",
"schema": {
"type": "object",
"additionalProperties": true
}
}
}
}
},
2024-11-09 14:59:27 +08:00
"/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
}
}
}
}
},
2024-11-11 22:06:24 +08:00
"/api/item/list/type/{type}": {
2024-11-09 21:24:02 +08:00
"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
2024-11-11 22:38:17 +08:00
},
{
2024-11-13 16:30:51 +08:00
"minimum": 0,
2024-11-11 22:38:17 +08:00
"type": "integer",
2024-11-13 16:30:51 +08:00
"default": 1,
2024-11-11 22:38:17 +08:00
"example": 1,
2024-11-13 16:40:17 +08:00
"description": "@description 页码",
2024-11-11 22:38:17 +08:00
"name": "page",
2024-11-13 16:30:51 +08:00
"in": "query"
2024-11-11 22:38:17 +08:00
},
{
2024-11-13 16:30:51 +08:00
"maximum": 50,
2024-11-11 22:38:17 +08:00
"type": "integer",
2024-11-13 16:30:51 +08:00
"default": 10,
2024-11-11 22:38:17 +08:00
"example": 10,
"description": "@description 每页数量",
"name": "pageSize",
2024-11-13 16:30:51 +08:00
"in": "query"
2024-11-09 21:24:02 +08:00
}
],
"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
}
}
}
}
},
2024-11-09 16:51:53 +08:00
"/api/item/oper/create": {
2024-11-09 14:59:27 +08:00
"post": {
2024-11-09 16:51:53 +08:00
"description": "创建商品接口",
2024-11-09 14:59:27 +08:00
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"item api"
],
2024-11-09 16:51:53 +08:00
"summary": "创建商品",
2024-11-09 14:59:27 +08:00
"parameters": [
{
2024-11-09 16:51:53 +08:00
"description": "商品信息",
"name": "createItemParam",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/validate.CreateItemParam"
}
2024-11-09 14:59:27 +08:00
}
],
"responses": {
"200": {
2024-11-09 16:51:53 +08:00
"description": "{\"id\": 1}",
2024-11-09 14:59:27 +08:00
"schema": {
2024-11-09 16:51:53 +08:00
"$ref": "#/definitions/model.ItemModel"
2024-11-09 14:59:27 +08:00
}
},
"400": {
"description": "{\"msg\": \"错误信息\",\"code\":0}",
"schema": {
"type": "object",
"additionalProperties": true
}
}
}
}
},
2024-11-09 16:51:53 +08:00
"/api/item/oper/delete": {
"delete": {
"description": "删除商品接口",
2024-11-09 14:59:27 +08:00
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"item api"
],
2024-11-09 16:51:53 +08:00
"summary": "删除商品",
2024-11-09 14:59:27 +08:00
"parameters": [
{
"description": "商品信息",
2024-11-09 16:51:53 +08:00
"name": "deleteItemParam",
2024-11-09 14:59:27 +08:00
"in": "body",
"required": true,
"schema": {
2024-11-09 16:51:53 +08:00
"$ref": "#/definitions/validate.DeleteItemParam"
2024-11-09 14:59:27 +08:00
}
}
],
"responses": {
"200": {
2024-11-09 16:51:53 +08:00
"description": "{\"msg\": \"商品操作成功\"}",
2024-11-09 14:59:27 +08:00
"schema": {
2024-11-09 16:51:53 +08:00
"type": "object",
"additionalProperties": true
2024-11-09 14:59:27 +08:00
}
},
"400": {
"description": "{\"msg\": \"错误信息\",\"code\":0}",
"schema": {
"type": "object",
"additionalProperties": true
}
}
}
}
},
2024-11-10 16:19:49 +08:00
"/api/item/search": {
"get": {
"description": "搜索商品",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"item api"
],
"summary": "search item api",
"parameters": [
{
"type": "string",
"description": "搜索关键字",
"name": "keyword",
"in": "query",
"required": true
2024-11-13 16:40:17 +08:00
},
{
"minimum": 0,
"type": "integer",
"default": 1,
"example": 1,
"description": "@description 页码",
"name": "page",
"in": "query"
},
{
"maximum": 50,
"type": "integer",
"default": 10,
"example": 10,
"description": "@description 每页数量",
"name": "pageSize",
"in": "query"
2024-11-10 16:19:49 +08:00
}
],
"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
}
}
}
}
},
2024-11-09 22:11:24 +08:00
"/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
}
}
}
}
},
2024-11-09 16:51:53 +08:00
"/api/item/{id}": {
2024-11-09 21:24:02 +08:00
"get": {
2024-11-09 16:51:53 +08:00
"description": "获取相关ID的商品信息",
2024-11-09 16:36:28 +08:00
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"item api"
],
2024-11-09 16:51:53 +08:00
"summary": "get item api",
2024-11-09 16:36:28 +08:00
"parameters": [
{
2024-11-09 16:51:53 +08:00
"type": "integer",
"description": "商品ID",
"name": "id",
"in": "path",
"required": true
2024-11-09 16:36:28 +08:00
}
],
"responses": {
"200": {
2024-11-09 21:24:02 +08:00
"description": "{\"id\":1}",
2024-11-09 16:36:28 +08:00
"schema": {
2024-11-09 21:24:02 +08:00
"$ref": "#/definitions/model.ItemModel"
2024-11-09 16:36:28 +08:00
}
},
"400": {
"description": "{\"msg\": \"错误信息\",\"code\":0}",
"schema": {
"type": "object",
"additionalProperties": true
}
}
}
}
},
2024-11-09 14:59:27 +08:00
"/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"
},
2024-11-21 21:57:50 +08:00
"imgString": {
2024-11-09 14:59:27 +08:00
"type": "string"
},
2024-11-21 21:57:50 +08:00
"imgs": {
"type": "array",
"items": {
"type": "string"
}
},
2024-11-09 14:59:27 +08:00
"itemname": {
"type": "string"
},
"price": {
"type": "integer"
},
2024-11-09 16:36:28 +08:00
"state": {
2024-11-09 14:59:27 +08:00
"type": "string"
},
"typeString": {
"type": "string"
},
"types": {
"type": "array",
"items": {
"type": "integer"
}
},
2024-11-09 16:36:28 +08:00
"uid": {
"type": "integer"
},
2024-11-09 14:59:27 +08:00
"updatedAt": {
"type": "string"
}
}
},
2024-11-09 22:11:24 +08:00
"model.TypeModel": {
"type": "object",
"properties": {
"createdAt": {
"type": "string"
},
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"updatedAt": {
"type": "string"
}
}
},
2024-11-09 14:59:27 +08:00
"validate.CreateItemParam": {
"type": "object",
"required": [
"desc",
"img",
"itemname",
"price",
"types"
],
"properties": {
"desc": {
"type": "string",
"example": "这是一个女大自用的iPhone18"
},
"img": {
2024-11-21 21:57:50 +08:00
"description": "@description 图片ID请用 /file/upload/item-img 接口上传图片后获取的图片唯一标识,多张图片请数组上传",
"type": "array",
"items": {
"type": "string"
},
"example": [
"123456789012",
"abcdefghijkl"
]
2024-11-09 14:59:27 +08:00
},
"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
]
}
}
},
2024-11-09 16:36:28 +08:00
"validate.DeleteItemParam": {
"type": "object",
"required": [
"id"
],
"properties": {
"id": {
"type": "integer",
"example": 1
}
}
},
2024-11-09 14:59:27 +08:00
"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"
}
}
}
}
}