YiTao/docs/swagger.json
wzj 735aad8cc1
All checks were successful
Deploy on Tag / build-and-deploy (push) Successful in 38s
新增:历史记录与推荐接口
2025-01-21 14:37:34 +08:00

919 lines
31 KiB
JSON
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
"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
}
}
}
}
},
"/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/history/{id}": {
"put": {
"description": "上传用户浏览历史记录",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"item api"
],
"summary": "上传用户浏览历史记录",
"parameters": [
{
"type": "integer",
"description": "商品ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "{\"msg\": \"历史记录统计成功\"}",
"schema": {
"type": "object",
"additionalProperties": true
}
},
"400": {
"description": "{\"msg\": \"错误信息\",\"code\":0}",
"schema": {
"type": "object",
"additionalProperties": true
}
}
}
}
},
"/api/item/list/type/{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
},
{
"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"
}
],
"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/recommend": {
"get": {
"description": "获取推荐商品列表(首页使用,每次返回十个)\n算法模型用户浏览记录用户购买记录商品类型商品热度\n该接口为 BETA 接口,正在测试中,调用请谨慎",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"item api"
],
"summary": "get recommend item api",
"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/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
},
{
"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"
}
],
"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/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"
},
"imgString": {
"type": "string"
},
"imgs": {
"type": "array",
"items": {
"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": "array",
"items": {
"type": "string"
},
"example": [
"123456789012",
"abcdefghijkl"
]
},
"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"
}
}
}
}
}