修改管理后台
This commit is contained in:
@@ -5,8 +5,52 @@ const options = {
|
||||
openapi: '3.0.0',
|
||||
info: {
|
||||
title: '宁夏智慧养殖监管平台 API',
|
||||
version: '1.0.0',
|
||||
description: '宁夏智慧养殖监管平台后端 API 文档',
|
||||
version: '2.1.0',
|
||||
description: `
|
||||
## 宁夏智慧养殖监管平台 API 文档
|
||||
|
||||
### 概述
|
||||
本文档提供了智慧养殖监管平台的完整API接口说明,包括:
|
||||
|
||||
- **核心功能**: 农场管理、动物管理、设备监控、预警管理
|
||||
- **业务功能**: 产品管理、订单管理、报表生成
|
||||
- **系统功能**: 用户管理、权限控制、系统配置
|
||||
|
||||
### 认证机制
|
||||
- 采用JWT (JSON Web Token) 进行身份认证
|
||||
- 所有API请求需在Header中携带Authorization字段
|
||||
- 格式: \`Authorization: Bearer <token>\`
|
||||
|
||||
### 响应格式
|
||||
所有API响应均采用统一格式:
|
||||
\`\`\`json
|
||||
{
|
||||
"success": true,
|
||||
"data": {},
|
||||
"message": "操作成功",
|
||||
"timestamp": "2025-01-18T10:30:00Z"
|
||||
}
|
||||
\`\`\`
|
||||
|
||||
### 错误处理
|
||||
- HTTP状态码遵循RESTful标准
|
||||
- 详细错误信息在响应体中提供
|
||||
- 支持多语言错误消息
|
||||
|
||||
### 版本信息
|
||||
- **当前版本**: v2.1.0
|
||||
- **最后更新**: 2025-01-18
|
||||
- **维护状态**: 积极维护中
|
||||
`,
|
||||
contact: {
|
||||
name: '技术支持',
|
||||
email: 'support@nxxm.com',
|
||||
url: 'https://github.com/nxxm-platform'
|
||||
},
|
||||
license: {
|
||||
name: 'MIT',
|
||||
url: 'https://opensource.org/licenses/MIT'
|
||||
}
|
||||
},
|
||||
servers: [
|
||||
{
|
||||
@@ -355,6 +399,247 @@ const options = {
|
||||
default: 'active'
|
||||
}
|
||||
}
|
||||
},
|
||||
User: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: {
|
||||
type: 'integer',
|
||||
description: '用户ID'
|
||||
},
|
||||
username: {
|
||||
type: 'string',
|
||||
description: '用户名'
|
||||
},
|
||||
email: {
|
||||
type: 'string',
|
||||
format: 'email',
|
||||
description: '邮箱地址'
|
||||
},
|
||||
roles: {
|
||||
type: 'integer',
|
||||
description: '角色ID'
|
||||
},
|
||||
status: {
|
||||
type: 'string',
|
||||
enum: ['active', 'inactive'],
|
||||
description: '用户状态'
|
||||
},
|
||||
last_login: {
|
||||
type: 'string',
|
||||
format: 'date-time',
|
||||
description: '最后登录时间'
|
||||
}
|
||||
}
|
||||
},
|
||||
Product: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: {
|
||||
type: 'integer',
|
||||
description: '产品ID'
|
||||
},
|
||||
name: {
|
||||
type: 'string',
|
||||
description: '产品名称'
|
||||
},
|
||||
description: {
|
||||
type: 'string',
|
||||
description: '产品描述'
|
||||
},
|
||||
price: {
|
||||
type: 'number',
|
||||
format: 'decimal',
|
||||
description: '产品价格'
|
||||
},
|
||||
stock: {
|
||||
type: 'integer',
|
||||
description: '库存数量'
|
||||
},
|
||||
status: {
|
||||
type: 'string',
|
||||
enum: ['active', 'inactive'],
|
||||
description: '产品状态'
|
||||
}
|
||||
}
|
||||
},
|
||||
Order: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: {
|
||||
type: 'integer',
|
||||
description: '订单ID'
|
||||
},
|
||||
user_id: {
|
||||
type: 'integer',
|
||||
description: '用户ID'
|
||||
},
|
||||
total_amount: {
|
||||
type: 'number',
|
||||
format: 'decimal',
|
||||
description: '订单总金额'
|
||||
},
|
||||
status: {
|
||||
type: 'string',
|
||||
enum: ['pending', 'processing', 'shipped', 'delivered', 'cancelled'],
|
||||
description: '订单状态'
|
||||
},
|
||||
payment_status: {
|
||||
type: 'string',
|
||||
enum: ['unpaid', 'paid', 'refunded'],
|
||||
description: '支付状态'
|
||||
},
|
||||
shipping_address: {
|
||||
type: 'string',
|
||||
description: '收货地址'
|
||||
}
|
||||
}
|
||||
},
|
||||
SystemConfig: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: {
|
||||
type: 'integer',
|
||||
description: '配置ID'
|
||||
},
|
||||
config_key: {
|
||||
type: 'string',
|
||||
description: '配置键名'
|
||||
},
|
||||
config_value: {
|
||||
type: 'string',
|
||||
description: '配置值'
|
||||
},
|
||||
config_type: {
|
||||
type: 'string',
|
||||
enum: ['string', 'number', 'boolean', 'json', 'array'],
|
||||
description: '配置类型'
|
||||
},
|
||||
category: {
|
||||
type: 'string',
|
||||
description: '配置分类'
|
||||
},
|
||||
description: {
|
||||
type: 'string',
|
||||
description: '配置描述'
|
||||
},
|
||||
is_public: {
|
||||
type: 'boolean',
|
||||
description: '是否公开'
|
||||
},
|
||||
is_editable: {
|
||||
type: 'boolean',
|
||||
description: '是否可编辑'
|
||||
}
|
||||
}
|
||||
},
|
||||
MenuPermission: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: {
|
||||
type: 'integer',
|
||||
description: '菜单ID'
|
||||
},
|
||||
menu_key: {
|
||||
type: 'string',
|
||||
description: '菜单标识'
|
||||
},
|
||||
menu_name: {
|
||||
type: 'string',
|
||||
description: '菜单名称'
|
||||
},
|
||||
menu_path: {
|
||||
type: 'string',
|
||||
description: '菜单路径'
|
||||
},
|
||||
parent_id: {
|
||||
type: 'integer',
|
||||
description: '父菜单ID'
|
||||
},
|
||||
menu_type: {
|
||||
type: 'string',
|
||||
enum: ['page', 'button', 'api'],
|
||||
description: '菜单类型'
|
||||
},
|
||||
required_roles: {
|
||||
type: 'array',
|
||||
items: {
|
||||
type: 'string'
|
||||
},
|
||||
description: '所需角色'
|
||||
},
|
||||
icon: {
|
||||
type: 'string',
|
||||
description: '菜单图标'
|
||||
},
|
||||
sort_order: {
|
||||
type: 'integer',
|
||||
description: '排序顺序'
|
||||
},
|
||||
is_visible: {
|
||||
type: 'boolean',
|
||||
description: '是否可见'
|
||||
},
|
||||
is_enabled: {
|
||||
type: 'boolean',
|
||||
description: '是否启用'
|
||||
}
|
||||
}
|
||||
},
|
||||
ApiResponse: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
success: {
|
||||
type: 'boolean',
|
||||
description: '操作是否成功'
|
||||
},
|
||||
data: {
|
||||
description: '响应数据'
|
||||
},
|
||||
message: {
|
||||
type: 'string',
|
||||
description: '响应消息'
|
||||
},
|
||||
timestamp: {
|
||||
type: 'string',
|
||||
format: 'date-time',
|
||||
description: '响应时间'
|
||||
}
|
||||
}
|
||||
},
|
||||
ErrorResponse: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
success: {
|
||||
type: 'boolean',
|
||||
example: false
|
||||
},
|
||||
message: {
|
||||
type: 'string',
|
||||
description: '错误消息'
|
||||
},
|
||||
error: {
|
||||
type: 'string',
|
||||
description: '错误详情'
|
||||
},
|
||||
errors: {
|
||||
type: 'array',
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
field: {
|
||||
type: 'string',
|
||||
description: '错误字段'
|
||||
},
|
||||
message: {
|
||||
type: 'string',
|
||||
description: '错误消息'
|
||||
}
|
||||
}
|
||||
},
|
||||
description: '详细错误列表'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user