517 lines
12 KiB
YAML
517 lines
12 KiB
YAML
basePath: /api
|
||
definitions:
|
||
model.ItemModel:
|
||
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:
|
||
items:
|
||
type: integer
|
||
type: array
|
||
uid:
|
||
type: integer
|
||
updatedAt:
|
||
type: string
|
||
type: object
|
||
model.TypeModel:
|
||
properties:
|
||
createdAt:
|
||
type: string
|
||
id:
|
||
type: integer
|
||
name:
|
||
type: string
|
||
updatedAt:
|
||
type: string
|
||
type: object
|
||
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
|
||
validate.DeleteItemParam:
|
||
properties:
|
||
id:
|
||
example: 1
|
||
type: integer
|
||
required:
|
||
- id
|
||
type: object
|
||
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
|
||
/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
|
||
/api/item/{id}:
|
||
get:
|
||
consumes:
|
||
- application/json
|
||
description: 获取相关ID的商品信息
|
||
parameters:
|
||
- description: 商品ID
|
||
in: path
|
||
name: id
|
||
required: true
|
||
type: integer
|
||
produces:
|
||
- application/json
|
||
responses:
|
||
"200":
|
||
description: '{"id":1}'
|
||
schema:
|
||
$ref: '#/definitions/model.ItemModel'
|
||
"400":
|
||
description: '{"msg": "错误信息","code":0}'
|
||
schema:
|
||
additionalProperties: true
|
||
type: object
|
||
summary: get item api
|
||
tags:
|
||
- item api
|
||
/api/item/list/{type}:
|
||
get:
|
||
consumes:
|
||
- application/json
|
||
description: 通过类型获取相关商品列表
|
||
parameters:
|
||
- description: 商品类型
|
||
in: path
|
||
name: type
|
||
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: get item list api
|
||
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
|
||
/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
|
||
/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
|
||
/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"
|