YiTao/docs/swagger.yaml

558 lines
13 KiB
YAML
Raw Normal View History

2024-11-09 14:59:27 +08:00
basePath: /api
definitions:
model.ItemModel:
properties:
createdAt:
type: string
desc:
type: string
id:
type: integer
img:
type: string
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:
items:
type: integer
type: array
2024-11-09 16:36:28 +08:00
uid:
type: integer
2024-11-09 14:59:27 +08:00
updatedAt:
type: string
type: object
2024-11-09 22:11:24 +08:00
model.TypeModel:
properties:
createdAt:
type: string
id:
type: integer
name:
type: string
updatedAt:
type: string
type: object
2024-11-09 14:59:27 +08:00
validate.CreateItemParam:
properties:
desc:
example: 这是一个女大自用的iPhone18
type: string
img:
description: '@description 图片ID请用 /file/upload/item-img 接口上传图片后获取的图片唯一标识'
example: "123456789012"
type: string
itemname:
example: 女大自用iPhone18
maxLength: 12
type: string
price:
description: '@description 商品价格,单位为分'
example: 1000
type: integer
types:
description: '@description 商品类型可以有多个类型请用数组传过来类型id请使用 /item/types 接口获取'
example:
- 1
- 2
items:
type: integer
type: array
required:
- desc
- img
- itemname
- price
- types
type: object
2024-11-09 16:36:28 +08:00
validate.DeleteItemParam:
properties:
id:
example: 1
type: integer
required:
- id
type: object
2024-11-09 14:59:27 +08:00
validate.LoginParam:
properties:
captcha_data:
example: DEV1
type: string
captcha_key:
example: devonlyy
type: string
password:
example: "123456"
minLength: 6
type: string
username:
example: wzjian
maxLength: 12
type: string
required:
- captcha_data
- captcha_key
- password
- username
type: object
validate.SignupParam:
properties:
captcha_data:
example: DEV1
type: string
captcha_key:
description: Email string `json:"email" validate:"required,email" example:"wzjian@njtech.edu.cn"`
example: devonlyy
type: string
password:
example: "123456"
minLength: 6
type: string
username:
example: wzjian
maxLength: 12
type: string
required:
- captcha_data
- captcha_key
- password
- username
type: object
host: localhost:5001
info:
contact:
email: support@swagger.io
name: API Support
url: http://www.swagger.io/support
description: Yitao Backend API.
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
termsOfService: http://swagger.io/terms/
title: Yitao Backend API
version: "1.0"
paths:
/api/admin/type/create:
post:
consumes:
- application/json
description: 创建商品类型
parameters:
- description: 类型名称
in: body
name: name
required: true
schema:
type: string
produces:
- application/json
responses:
"200":
description: '{"code": 0}'
schema:
additionalProperties: true
type: object
"400":
description: '{"msg": "错误信息","code":0}"`'
schema:
additionalProperties: true
type: object
summary: 创建商品类型
tags:
- admin api
2024-11-09 14:59:27 +08:00
/api/captcha/click/{key}/submit:
post:
consumes:
- application/json
description: 校验按次序点击验证码
parameters:
- description: 验证码标识符
in: path
name: key
required: true
type: string
- description: '15,851;458,18;58,15;x,y; #用户点击的坐标集合'
in: formData
name: key
required: true
type: string
produces:
- application/json
responses:
"200":
description: '{"flag": true|false}'
schema:
additionalProperties: true
type: object
"400":
description: '{"msg": "错误信息","code":0}'
schema:
additionalProperties: true
type: object
summary: Captcha Click Validate
tags:
- captcha api
/api/captcha/click/gen:
get:
consumes:
- application/json
description: 生成按次序点击验证码
produces:
- application/json
responses:
"200":
description: '{"key": "验证码标识符","master":"主图用户点击图base64","subimg":"子图文字次序图base64"}'
schema:
additionalProperties: true
type: object
"400":
description: '{"msg": "错误信息","code":0}'
schema:
additionalProperties: true
type: object
summary: Captcha Click Generate
tags:
- captcha api
/api/captcha/img/{key}:
get:
consumes:
- application/json
description: 通过 key 获取验证码图片
parameters:
- description: 验证码标识符
in: path
name: key
required: true
type: string
produces:
- image/png
responses:
"200":
description: IMG
schema:
items:
type: integer
type: array
"400":
description: '{"msg": "错误信息","code":0}'
schema:
additionalProperties: true
type: object
summary: Captcha Img Get
tags:
- captcha api
/api/captcha/img/gen:
get:
consumes:
- application/json
description: 获取一张图片验证码的标识符
produces:
- application/json
responses:
"200":
description: '{"key": "ASDFGHJK"}'
schema:
additionalProperties: true
type: object
"400":
description: '{"msg": "错误信息","code":0}'
schema:
additionalProperties: true
type: object
summary: Captcha Img Generate
tags:
- captcha api
/api/captcha/img/validate/{key}:
get:
consumes:
- application/json
description: 图片验证码校验(一般情况下后端校验)
parameters:
- description: 验证码标识符
in: path
name: key
required: true
type: string
- description: 验证码
in: query
name: code
required: true
type: string
produces:
- application/json
responses:
"200":
description: '{"msg": "正确信息","code":0}'
schema:
additionalProperties: true
type: object
"400":
description: '{"msg": "错误信息","code":0}'
schema:
additionalProperties: true
type: object
summary: Captcha Img Validate
tags:
- captcha api
/api/file/upload/item-img:
put:
consumes:
- application/json
description: 上传商品图片
parameters:
- description: 图片文件
in: formData
name: file
required: true
type: file
produces:
- application/json
responses:
"200":
description: '{"id": 1,"key":"图片唯一标识"}'
schema:
additionalProperties: true
type: object
"400":
description: '{"msg": "错误信息","code":0}'
schema:
additionalProperties: true
type: object
summary: 上传商品图片
tags:
- file api
2024-11-09 16:51:53 +08:00
/api/item/{id}:
2024-11-09 21:24:02 +08:00
get:
2024-11-09 14:59:27 +08:00
consumes:
- application/json
description: 获取相关ID的商品信息
parameters:
- description: 商品ID
in: path
name: id
required: true
type: integer
produces:
- application/json
responses:
"200":
2024-11-09 21:24:02 +08:00
description: '{"id":1}'
schema:
$ref: '#/definitions/model.ItemModel'
"400":
description: '{"msg": "错误信息","code":0}'
2024-11-09 14:59:27 +08:00
schema:
additionalProperties: true
type: object
2024-11-09 21:24:02 +08:00
summary: get item api
tags:
- item api
2024-11-11 22:06:24 +08:00
/api/item/list/type/{type}:
2024-11-09 21:24:02 +08:00
get:
consumes:
- application/json
description: 通过类型获取相关商品列表
parameters:
- description: 商品类型
in: path
name: type
required: true
type: string
2024-11-13 16:30:51 +08:00
- default: 1
2024-11-11 22:38:17 +08:00
example: 1
in: query
2024-11-13 16:30:51 +08:00
minimum: 0
2024-11-11 22:38:17 +08:00
name: page
type: integer
2024-11-13 16:30:51 +08:00
- default: 10
description: '@description 每页数量'
2024-11-11 22:38:17 +08:00
example: 10
in: query
2024-11-13 16:30:51 +08:00
maximum: 50
2024-11-11 22:38:17 +08:00
name: pageSize
type: integer
2024-11-09 21:24:02 +08:00
produces:
- application/json
responses:
"200":
description: '{["id":1],["id":2]}'
schema:
items:
$ref: '#/definitions/model.ItemModel'
type: array
2024-11-09 14:59:27 +08:00
"400":
description: '{"msg": "错误信息","code":0}'
schema:
additionalProperties: true
type: object
2024-11-09 21:24:02 +08:00
summary: get item list api
2024-11-09 14:59:27 +08:00
tags:
- item api
/api/item/oper/create:
post:
consumes:
- application/json
description: 创建商品接口
parameters:
- description: 商品信息
in: body
name: createItemParam
required: true
schema:
$ref: '#/definitions/validate.CreateItemParam'
produces:
- application/json
responses:
"200":
description: '{"id": 1}'
schema:
$ref: '#/definitions/model.ItemModel'
"400":
description: '{"msg": "错误信息","code":0}'
schema:
additionalProperties: true
type: object
summary: 创建商品
tags:
- item api
2024-11-09 16:36:28 +08:00
/api/item/oper/delete:
delete:
consumes:
- application/json
description: 删除商品接口
parameters:
- description: 商品信息
in: body
name: deleteItemParam
required: true
schema:
$ref: '#/definitions/validate.DeleteItemParam'
produces:
- application/json
responses:
"200":
description: '{"msg": "商品操作成功"}'
schema:
additionalProperties: true
type: object
"400":
description: '{"msg": "错误信息","code":0}'
schema:
additionalProperties: true
type: object
summary: 删除商品
tags:
- item api
2024-11-10 16:19:49 +08:00
/api/item/search:
get:
consumes:
- application/json
description: 搜索商品
parameters:
- description: 搜索关键字
in: query
name: keyword
required: true
type: string
produces:
- application/json
responses:
"200":
description: '{["id":1],["id":2]}'
schema:
items:
$ref: '#/definitions/model.ItemModel'
type: array
"400":
description: '{"msg": "错误信息","code":0}'
schema:
additionalProperties: true
type: object
summary: search item api
tags:
- item api
2024-11-09 22:11:24 +08:00
/api/item/types:
get:
consumes:
- application/json
description: 获取商品类型列表
produces:
- application/json
responses:
"200":
description: '[{id:1,name:类型1},{id:2,name:类型2}]'
schema:
items:
$ref: '#/definitions/model.TypeModel'
type: array
"400":
description: '{"msg": "错误信息","code":0}'
schema:
additionalProperties: true
type: object
summary: get item types api
tags:
- item api
2024-11-09 14:59:27 +08:00
/api/user/auth/login:
post:
consumes:
- application/json
description: the 用户登录接口
parameters:
- description: 登录参数
in: body
name: loginParam
required: true
schema:
$ref: '#/definitions/validate.LoginParam'
produces:
- application/json
responses:
"200":
description: '{"jwt": "jwt.jwt.jwt"}'
schema:
additionalProperties: true
type: object
"400":
description: '{"msg": "错误信息","code":0}'
schema:
additionalProperties: true
type: object
summary: login api
tags:
- auth api
/api/user/auth/signup:
post:
consumes:
- application/json
description: 用户注册接口
parameters:
- description: 注册参数
in: body
name: signupParam
required: true
schema:
$ref: '#/definitions/validate.SignupParam'
produces:
- application/json
responses:
"200":
description: '{"msg": "注册成功","code":1}'
schema:
additionalProperties: true
type: object
"400":
description: '{"msg": "错误信息","code":0}'
schema:
additionalProperties: true
type: object
summary: 注册API
tags:
- auth api
swagger: "2.0"