basePath: /api/v1 definitions: controllers.SwagAPIResponse: properties: code: description: HTTP状态码 type: integer data: description: 响应数据 msg: description: 响应消息 type: string type: object controllers.SwagLoginRequest: properties: password: description: 密码 type: string username: description: 用户名 type: string type: object controllers.SwagRegisterRequest: properties: flavorType: description: 类型 type: string password: description: 密码 type: string regionIds: description: 区域ID列表 items: type: integer type: array role: description: 角色 type: string username: description: 用户名 type: string type: object controllers.gatewayPayload: properties: isSold: type: boolean location: type: string mac: type: string name: type: string projectType: type: string regionId: type: integer soldAt: description: SoldAt 是可选字段。如果 IsSold 为 true 且未传此字段,后端自动设为当前时间 type: string type: object controllers.kindergartenPayload: properties: address: type: string name: type: string regionId: type: integer type: object controllers.mqttDebugStartRequest: properties: persistToDatabase: type: boolean type: object controllers.productDefinitionPayload: properties: category: type: string code: type: string description: type: string isActive: type: boolean name: type: string parameterSchema: type: string sort: type: integer trackSerialNumber: type: boolean type: object controllers.productInventoryPayload: properties: assetName: type: string notes: type: string parameterValues: type: string productCode: type: string projectTypeCode: type: string regionId: type: integer serialNumber: type: string soldAt: type: string soldTargetName: type: string soldTargetType: type: string soldTo: type: string status: type: string storageLocation: type: string suiteCode: type: string suiteId: type: integer type: object controllers.productPrototypePayload: properties: assetName: type: string name: type: string notes: type: string parameterValues: type: string productCode: type: string projectTypeCode: type: string regionId: type: integer status: type: string storageLocation: type: string type: object controllers.productSuitePayload: properties: code: type: string inventoryIds: items: type: integer type: array name: type: string notes: type: string projectTypeCode: type: string regionId: type: integer soldTargetName: type: string soldTargetType: type: string type: object controllers.projectTypePayload: properties: code: type: string description: type: string isActive: type: boolean name: type: string sort: type: integer supportsGateway: type: boolean type: object controllers.trainingSessionRequest: properties: age: type: integer aiResult: type: string appName: type: string duration: type: integer endTime: type: integer evaluation: type: string gender: type: string isStart: type: boolean maxHeartRate: type: integer name: type: string peopleNum: type: integer regionId: type: integer runType: type: string testTime: type: integer tid: type: integer time: type: integer type: object controllers.userAdminPayload: properties: email: type: string flavorType: $ref: '#/definitions/models.UserFlavorType' isActive: type: boolean password: type: string phone: type: string regionIds: items: type: integer type: array revokeTokens: type: boolean role: $ref: '#/definitions/models.UserRole' username: type: string type: object models.UserFlavorType: enum: - all - flink - full - light - heartrate - run50 type: string x-enum-varnames: - UserFlavorAll - UserFlavorFlink - UserFlavorFull - UserFlavorLight - UserFlavorHeartRate - UserFlavorRun50 models.UserRole: enum: - super_admin - region_admin - operator - viewer type: string x-enum-varnames: - UserRoleSuperAdmin - UserRoleRegionAdmin - UserRoleOperator - UserRoleViewer host: localhost:8081 info: contact: {} description: 智能心率采集分析平台后端服务,基于 Gin 框架,提供心率采集、AI 分析、教案管理、设备管理等功能 title: 智能心率采集分析平台 API version: "1.0" paths: /admin/gateways: get: description: 查询网关列表,支持关键词/售出状态/项目类型/区域筛选。超级管理员可查全部,操作员只能查所属区域 parameters: - description: 关键词(名称/MAC模糊搜索) in: query name: keyword type: string - description: 售出状态 in: query name: isSold type: boolean - description: 项目类型 in: query name: projectType type: string - description: 区域ID in: query name: regionId type: integer produces: - application/json responses: "200": description: 查询成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' security: - BearerAuth: [] summary: 获取网关列表 tags: - 网关管理 post: consumes: - application/json description: 创建新的网关记录,自动同步到产品库存 parameters: - description: 网关信息 in: body name: gateway required: true schema: $ref: '#/definitions/controllers.gatewayPayload' produces: - application/json responses: "201": description: 创建成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "400": description: 请求参数错误 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "409": description: MAC地址已存在 schema: $ref: '#/definitions/controllers.SwagAPIResponse' security: - BearerAuth: [] summary: 创建网关 tags: - 网关管理 /admin/gateways/{id}: delete: description: 删除指定网关(已售出的网关禁止删除),自动同步删除产品库存 parameters: - description: 网关ID in: path name: id required: true type: integer produces: - application/json responses: "200": description: 删除成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "403": description: 已售出无法删除 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "404": description: 网关不存在 schema: $ref: '#/definitions/controllers.SwagAPIResponse' security: - BearerAuth: [] summary: 删除网关 tags: - 网关管理 put: consumes: - application/json description: 更新指定网关的详细信息,自动同步到产品库存 parameters: - description: 网关ID in: path name: id required: true type: integer - description: 更新信息 in: body name: gateway required: true schema: $ref: '#/definitions/controllers.gatewayPayload' produces: - application/json responses: "200": description: 更新成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "400": description: 请求参数错误 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "404": description: 网关不存在 schema: $ref: '#/definitions/controllers.SwagAPIResponse' security: - BearerAuth: [] summary: 更新网关信息 tags: - 网关管理 /admin/kindergartens: get: description: 查询幼儿园列表,支持按名称/地址模糊搜索 parameters: - description: 关键词(名称/地址模糊搜索) in: query name: keyword type: string produces: - application/json responses: "200": description: 查询成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' security: - BearerAuth: [] summary: 获取幼儿园列表 tags: - 幼儿园管理 post: consumes: - application/json description: 创建新的幼儿园记录 parameters: - description: 幼儿园信息 in: body name: kindergarten required: true schema: $ref: '#/definitions/controllers.kindergartenPayload' produces: - application/json responses: "201": description: 创建成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "400": description: 请求参数错误 schema: $ref: '#/definitions/controllers.SwagAPIResponse' security: - BearerAuth: [] summary: 创建幼儿园 tags: - 幼儿园管理 /admin/kindergartens/{id}: delete: description: 删除指定幼儿园,如果被用户绑定则无法删除 parameters: - description: 幼儿园ID in: path name: id required: true type: integer produces: - application/json responses: "200": description: 删除成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "404": description: 幼儿园不存在 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "409": description: 已绑定用户无法删除 schema: $ref: '#/definitions/controllers.SwagAPIResponse' security: - BearerAuth: [] summary: 删除幼儿园 tags: - 幼儿园管理 put: consumes: - application/json description: 更新指定幼儿园的名称、地址和区域 parameters: - description: 幼儿园ID in: path name: id required: true type: integer - description: 更新信息 in: body name: kindergarten required: true schema: $ref: '#/definitions/controllers.kindergartenPayload' produces: - application/json responses: "200": description: 更新成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "400": description: 请求参数错误 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "404": description: 幼儿园不存在 schema: $ref: '#/definitions/controllers.SwagAPIResponse' security: - BearerAuth: [] summary: 更新幼儿园信息 tags: - 幼儿园管理 /admin/product-definitions: get: description: 查询产品定义列表,支持按关键词/分类/启用状态筛选 parameters: - description: 关键词(代码/名称/描述模糊搜索) in: query name: keyword type: string - description: 分类筛选 in: query name: category type: string - description: 是否启用 in: query name: isActive type: boolean produces: - application/json responses: "200": description: 查询成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' security: - BearerAuth: [] summary: 获取产品定义列表 tags: - 产品定义管理 post: consumes: - application/json description: 创建新的产品定义 parameters: - description: 产品定义信息 in: body name: productDefinition required: true schema: $ref: '#/definitions/controllers.productDefinitionPayload' produces: - application/json responses: "201": description: 创建成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "400": description: 请求参数错误 schema: $ref: '#/definitions/controllers.SwagAPIResponse' security: - BearerAuth: [] summary: 创建产品定义 tags: - 产品定义管理 /admin/product-definitions/{id}: delete: description: 删除指定产品定义(被库存或模板引用的无法删除) parameters: - description: 产品定义ID in: path name: id required: true type: integer produces: - application/json responses: "200": description: 删除成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "404": description: 产品定义不存在 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "409": description: 已被引用无法删除 schema: $ref: '#/definitions/controllers.SwagAPIResponse' security: - BearerAuth: [] summary: 删除产品定义 tags: - 产品定义管理 put: consumes: - application/json description: 更新指定产品定义的信息 parameters: - description: 产品定义ID in: path name: id required: true type: integer - description: 更新信息 in: body name: productDefinition required: true schema: $ref: '#/definitions/controllers.productDefinitionPayload' produces: - application/json responses: "200": description: 更新成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "400": description: 请求参数错误 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "404": description: 产品定义不存在 schema: $ref: '#/definitions/controllers.SwagAPIResponse' security: - BearerAuth: [] summary: 更新产品定义 tags: - 产品定义管理 /admin/product-inventories: get: description: 查询产品库存列表,支持多条件筛选 parameters: - description: 关键词(资产名称/序列号/购买方等模糊搜索) in: query name: keyword type: string - description: 产品代码筛选 in: query name: productCode type: string - description: 项目类型代码筛选 in: query name: projectTypeCode type: string - description: 套件代码筛选 in: query name: suiteCode type: string - description: 状态筛选 in: query name: status type: string - description: 购买方类型筛选 in: query name: soldTargetType type: string - description: 区域ID in: query name: regionId type: integer produces: - application/json responses: "200": description: 查询成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' security: - BearerAuth: [] summary: 获取产品库存列表 tags: - 产品库存管理 post: consumes: - application/json description: 创建新的产品库存记录 parameters: - description: 库存信息 in: body name: inventory required: true schema: $ref: '#/definitions/controllers.productInventoryPayload' produces: - application/json responses: "201": description: 创建成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "400": description: 请求参数错误 schema: $ref: '#/definitions/controllers.SwagAPIResponse' security: - BearerAuth: [] summary: 创建产品库存记录 tags: - 产品库存管理 /admin/product-inventories/{id}: delete: description: 删除指定产品库存记录(已售出的无法删除) parameters: - description: 库存ID in: path name: id required: true type: integer produces: - application/json responses: "200": description: 删除成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "404": description: 库存记录不存在 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "409": description: 已售出无法删除 schema: $ref: '#/definitions/controllers.SwagAPIResponse' security: - BearerAuth: [] summary: 删除产品库存 tags: - 产品库存管理 put: consumes: - application/json description: 更新指定产品库存记录 parameters: - description: 库存ID in: path name: id required: true type: integer - description: 更新信息 in: body name: inventory required: true schema: $ref: '#/definitions/controllers.productInventoryPayload' produces: - application/json responses: "200": description: 更新成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "400": description: 请求参数错误 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "404": description: 库存记录不存在 schema: $ref: '#/definitions/controllers.SwagAPIResponse' security: - BearerAuth: [] summary: 更新产品库存 tags: - 产品库存管理 /admin/product-prototypes: get: description: 查询产品原型列表,支持按关键词/产品代码/项目类型筛选 parameters: - description: 关键词(名称/备注模糊搜索) in: query name: keyword type: string - description: 产品代码筛选 in: query name: productCode type: string - description: 项目类型代码筛选 in: query name: projectTypeCode type: string produces: - application/json responses: "200": description: 查询成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' security: - BearerAuth: [] summary: 获取产品原型列表 tags: - 产品原型管理 post: consumes: - application/json description: 创建新的产品原型 parameters: - description: 产品原型信息 in: body name: productPrototype required: true schema: $ref: '#/definitions/controllers.productPrototypePayload' produces: - application/json responses: "201": description: 创建成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "400": description: 请求参数错误 schema: $ref: '#/definitions/controllers.SwagAPIResponse' security: - BearerAuth: [] summary: 创建产品原型 tags: - 产品原型管理 /admin/product-prototypes/{id}: delete: description: 删除指定产品原型 parameters: - description: 产品原型ID in: path name: id required: true type: integer produces: - application/json responses: "200": description: 删除成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "404": description: 产品原型不存在 schema: $ref: '#/definitions/controllers.SwagAPIResponse' security: - BearerAuth: [] summary: 删除产品原型 tags: - 产品原型管理 put: consumes: - application/json description: 更新指定产品原型的信息 parameters: - description: 产品原型ID in: path name: id required: true type: integer - description: 更新信息 in: body name: productPrototype required: true schema: $ref: '#/definitions/controllers.productPrototypePayload' produces: - application/json responses: "200": description: 更新成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "400": description: 请求参数错误 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "404": description: 产品原型不存在 schema: $ref: '#/definitions/controllers.SwagAPIResponse' security: - BearerAuth: [] summary: 更新产品原型 tags: - 产品原型管理 /admin/product-suites: get: description: 查询产品套件列表,含套件下的库存明细 parameters: - description: 关键词(代码/名称/备注模糊搜索) in: query name: keyword type: string - description: 项目类型代码筛选 in: query name: projectTypeCode type: string produces: - application/json responses: "200": description: 查询成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' security: - BearerAuth: [] summary: 获取产品套件列表 tags: - 产品套件管理 post: consumes: - application/json description: 创建新的产品套件,可选关联库存记录 parameters: - description: 套件信息 in: body name: suite required: true schema: $ref: '#/definitions/controllers.productSuitePayload' produces: - application/json responses: "201": description: 创建成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "400": description: 请求参数错误 schema: $ref: '#/definitions/controllers.SwagAPIResponse' security: - BearerAuth: [] summary: 创建产品套件 tags: - 产品套件管理 /admin/product-suites/{id}: delete: description: 删除指定产品套件,自动解除关联库存的绑定 parameters: - description: 套件ID in: path name: id required: true type: integer produces: - application/json responses: "200": description: 删除成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "404": description: 套件不存在 schema: $ref: '#/definitions/controllers.SwagAPIResponse' security: - BearerAuth: [] summary: 删除产品套件 tags: - 产品套件管理 put: consumes: - application/json description: 更新指定产品套件的信息和关联库存 parameters: - description: 套件ID in: path name: id required: true type: integer - description: 更新信息 in: body name: suite required: true schema: $ref: '#/definitions/controllers.productSuitePayload' produces: - application/json responses: "200": description: 更新成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "400": description: 请求参数错误 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "404": description: 套件不存在 schema: $ref: '#/definitions/controllers.SwagAPIResponse' security: - BearerAuth: [] summary: 更新产品套件 tags: - 产品套件管理 /admin/project-product-templates: get: description: 查询项目产品模板列表,含项目类型和产品名称 parameters: - description: 项目类型代码筛选 in: query name: projectTypeCode type: string produces: - application/json responses: "200": description: 查询成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' security: - BearerAuth: [] summary: 获取项目产品模板列表 tags: - 项目产品模板管理 /admin/project-types: get: description: 查询项目类型列表,支持按关键词/是否支持网关/是否启用筛选 parameters: - description: 关键词(代码/名称/描述模糊搜索) in: query name: keyword type: string - description: 是否支持网关 in: query name: supportsGateway type: boolean - description: 是否启用 in: query name: isActive type: boolean produces: - application/json responses: "200": description: 查询成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' security: - BearerAuth: [] summary: 获取项目类型列表 tags: - 项目类型管理 post: consumes: - application/json description: 创建新的项目类型 parameters: - description: 项目类型信息 in: body name: projectType required: true schema: $ref: '#/definitions/controllers.projectTypePayload' produces: - application/json responses: "201": description: 创建成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "400": description: 请求参数错误 schema: $ref: '#/definitions/controllers.SwagAPIResponse' security: - BearerAuth: [] summary: 创建项目类型 tags: - 项目类型管理 /admin/project-types/{id}: delete: description: 删除指定项目类型(被网关引用的无法删除) parameters: - description: 项目类型ID in: path name: id required: true type: integer produces: - application/json responses: "200": description: 删除成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "404": description: 项目类型不存在 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "409": description: 已被网关引用无法删除 schema: $ref: '#/definitions/controllers.SwagAPIResponse' security: - BearerAuth: [] summary: 删除项目类型 tags: - 项目类型管理 put: consumes: - application/json description: 更新指定项目类型的信息 parameters: - description: 项目类型ID in: path name: id required: true type: integer - description: 更新信息 in: body name: projectType required: true schema: $ref: '#/definitions/controllers.projectTypePayload' produces: - application/json responses: "200": description: 更新成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "400": description: 请求参数错误 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "404": description: 项目类型不存在 schema: $ref: '#/definitions/controllers.SwagAPIResponse' security: - BearerAuth: [] summary: 更新项目类型 tags: - 项目类型管理 /admin/statistics/ai-analysis: get: description: 按区域统计AI分析的使用情况,包括调用次数、Token消耗、费用等 parameters: - description: 区域ID in: query name: regionId type: integer - description: 开始时间(毫秒时间戳) in: query name: startTime type: integer - description: 结束时间(毫秒时间戳) in: query name: endTime type: integer produces: - application/json responses: "200": description: 查询成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' security: - BearerAuth: [] summary: AI分析区域统计 tags: - 统计管理 /admin/statistics/ai-analysis-records: get: description: 分页查询AI分析记录,支持按区域和时间范围筛选 parameters: - description: 页码(默认1) in: query name: pageNum type: integer - description: 每页数量(默认10,最大100) in: query name: pageSize type: integer - description: 区域ID in: query name: regionId type: integer - description: 开始时间(毫秒时间戳) in: query name: startTime type: integer - description: 结束时间(毫秒时间戳) in: query name: endTime type: integer produces: - application/json responses: "200": description: 查询成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' security: - BearerAuth: [] summary: 获取AI分析记录列表 tags: - 统计管理 /admin/statistics/ai-analysis-records/{id}: delete: description: 删除指定的AI分析记录 parameters: - description: 记录ID in: path name: id required: true type: integer produces: - application/json responses: "200": description: 删除成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "404": description: 记录不存在 schema: $ref: '#/definitions/controllers.SwagAPIResponse' security: - BearerAuth: [] summary: 删除AI分析记录 tags: - 统计管理 /admin/statistics/ai-analysis-timeline: get: description: 按日期统计AI分析的使用情况趋势,含总体和分区域数据 parameters: - description: 区域ID in: query name: regionId type: integer - description: 开始时间(毫秒时间戳) in: query name: startTime type: integer - description: 结束时间(毫秒时间戳) in: query name: endTime type: integer produces: - application/json responses: "200": description: 查询成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' security: - BearerAuth: [] summary: AI分析时间线统计 tags: - 统计管理 /admin/statistics/mqtt-training-sessions: get: description: 按区域统计MQTT训练会话情况,包括开始、结束、完成、进行中的会话数 parameters: - description: 区域ID in: query name: regionId type: integer - description: 类型筛选 in: query name: flavorType type: string - description: 开始时间(毫秒时间戳) in: query name: startTime type: integer - description: 结束时间(毫秒时间戳) in: query name: endTime type: integer produces: - application/json responses: "200": description: 查询成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' security: - BearerAuth: [] summary: 训练会话区域统计 tags: - 统计管理 /admin/system-debug/mqtt/start: post: consumes: - application/json description: 启动MQTT调试服务 parameters: - description: 是否持久化到数据库 in: body name: persist schema: $ref: '#/definitions/controllers.mqttDebugStartRequest' produces: - application/json responses: "200": description: 启动成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' security: - BearerAuth: [] summary: 启动MQTT调试 tags: - 系统调试 /admin/system-debug/mqtt/status: get: description: 获取MQTT调试服务的当前运行状态 produces: - application/json responses: "200": description: 查询成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' security: - BearerAuth: [] summary: 获取MQTT调试状态 tags: - 系统调试 /admin/system-debug/mqtt/stop: post: description: 停止MQTT调试服务 produces: - application/json responses: "200": description: 停止成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' security: - BearerAuth: [] summary: 停止MQTT调试 tags: - 系统调试 /admin/system-debug/mqtt/ws: get: description: 通过WebSocket实时监听MQTT消息(需要SuperAdmin权限) parameters: - description: JWT Token in: query name: token required: true type: string responses: "101": description: 切换为WebSocket协议 summary: MQTT WebSocket连接 tags: - 系统调试 /admin/users: get: description: 查询系统用户列表,支持按关键词/角色/类型筛选 parameters: - description: 关键词(用户名/邮箱/手机号模糊搜索) in: query name: keyword type: string - description: 角色筛选 in: query name: role type: string - description: 类型筛选 in: query name: flavorType type: string produces: - application/json responses: "200": description: 查询成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' security: - BearerAuth: [] summary: 获取用户列表 tags: - 用户管理 post: consumes: - application/json description: 创建新的系统用户 parameters: - description: 用户信息 in: body name: user required: true schema: $ref: '#/definitions/controllers.userAdminPayload' produces: - application/json responses: "201": description: 创建成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "400": description: 请求参数错误 schema: $ref: '#/definitions/controllers.SwagAPIResponse' security: - BearerAuth: [] summary: 创建用户 tags: - 用户管理 /admin/users/{id}: delete: description: 删除指定用户(不能删除admin账号和当前登录用户) parameters: - description: 用户ID in: path name: id required: true type: integer produces: - application/json responses: "200": description: 删除成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "400": description: 无法删除受保护账号 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "404": description: 用户不存在 schema: $ref: '#/definitions/controllers.SwagAPIResponse' security: - BearerAuth: [] summary: 删除用户 tags: - 用户管理 put: consumes: - application/json description: 更新指定用户的详细信息,支持重置密码和吊销Token parameters: - description: 用户ID in: path name: id required: true type: integer - description: 更新信息 in: body name: user required: true schema: $ref: '#/definitions/controllers.userAdminPayload' produces: - application/json responses: "200": description: 更新成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "400": description: 请求参数错误 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "404": description: 用户不存在 schema: $ref: '#/definitions/controllers.SwagAPIResponse' security: - BearerAuth: [] summary: 更新用户信息 tags: - 用户管理 /gateways/by-mac: get: description: 根据MAC地址查询网关信息(支持格式兼容:带冒号/横线/纯数字) parameters: - description: MAC地址 in: query name: mac required: true type: string produces: - application/json responses: "200": description: 查询成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "400": description: MAC参数为空 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "404": description: 未找到该网关 schema: $ref: '#/definitions/controllers.SwagAPIResponse' security: - BearerAuth: [] summary: 按MAC查询网关 tags: - 网关管理 /lesson-plans: get: description: 获取教案文件列表(非分页),按创建时间倒序 produces: - application/json responses: "200": description: 查询成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "401": description: 未认证 schema: $ref: '#/definitions/controllers.SwagAPIResponse' security: - BearerAuth: [] summary: 获取教案列表 tags: - 教案管理 /lesson-plans/{id}: delete: description: 删除教案文件及其关联的分享码 parameters: - description: 教案ID in: path name: id required: true type: integer produces: - application/json responses: "200": description: 删除成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "401": description: 未认证 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "403": description: 无权限 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "404": description: 文件不存在 schema: $ref: '#/definitions/controllers.SwagAPIResponse' security: - BearerAuth: [] summary: 删除教案文件 tags: - 教案管理 /lesson-plans/{id}/download: get: description: 通过ID下载教案文件,自动更新下载计数和最后下载时间 parameters: - description: 教案ID in: path name: id required: true type: integer produces: - application/octet-stream responses: "200": description: 教案文件 schema: type: file "401": description: 未认证 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "403": description: 无权限 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "404": description: 文件不存在 schema: $ref: '#/definitions/controllers.SwagAPIResponse' security: - BearerAuth: [] summary: 下载教案文件 tags: - 教案管理 /lesson-plans/{id}/share-code: post: description: 为教案文件生成6位数字分享码,有效期5分钟,每次生成会失效之前的分享码 parameters: - description: 教案ID in: path name: id required: true type: integer produces: - application/json responses: "200": description: 生成成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "401": description: 未认证 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "403": description: 无权限 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "404": description: 文件不存在 schema: $ref: '#/definitions/controllers.SwagAPIResponse' security: - BearerAuth: [] summary: 生成分享码 tags: - 教案管理 /lesson-plans/page: get: description: 分页获取教案文件列表,支持文件名模糊搜索、上传者搜索、区域筛选、排序 parameters: - description: 页码(默认1) in: query name: pageNum type: integer - description: 每页数量(默认10,最大100) in: query name: pageSize type: integer - description: 文件名模糊搜索 in: query name: keyword type: string - description: 上传者名模糊搜索 in: query name: uploaderName type: string - description: 区域ID in: query name: regionId type: integer - description: '排序字段: file_size | created_at' in: query name: sortBy type: string - description: '排序方向: asc | desc' in: query name: sortOrder type: string produces: - application/json responses: "200": description: 查询成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "400": description: 请求参数错误 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "401": description: 未认证 schema: $ref: '#/definitions/controllers.SwagAPIResponse' security: - BearerAuth: [] summary: 分页查询教案 tags: - 教案管理 /lesson-plans/share/{code}/download: get: description: 通过6位分享码下载教案文件(无需认证) parameters: - description: 6位分享码 in: path name: code required: true type: string produces: - application/octet-stream responses: "200": description: 教案文件 schema: type: file "400": description: 分享码无效 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "404": description: 分享码过期或不存在 schema: $ref: '#/definitions/controllers.SwagAPIResponse' summary: 通过分享码下载教案 tags: - 教案管理 /lesson-plans/upload: post: consumes: - multipart/form-data description: 上传 .docx 格式的教案文件,支持MD5去重,最大10MB parameters: - description: 教案文件(.docx) in: formData name: file required: true type: file produces: - application/json responses: "201": description: 上传成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "400": description: 请求参数错误 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "401": description: 未认证 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "409": description: 文件已存在 schema: $ref: '#/definitions/controllers.SwagAPIResponse' security: - BearerAuth: [] summary: 上传教案文件 tags: - 教案管理 /login: post: consumes: - application/json description: 用户名密码登录,返回JWT Token和用户信息 parameters: - description: 登录信息 in: body name: request required: true schema: $ref: '#/definitions/controllers.SwagLoginRequest' produces: - application/json responses: "200": description: 登录成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "400": description: 请求参数错误 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "401": description: 用户名或密码错误 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "403": description: 用户已禁用 schema: $ref: '#/definitions/controllers.SwagAPIResponse' summary: 用户登录 tags: - 认证 /register: post: consumes: - application/json description: 注册新用户,返回JWT Token parameters: - description: 注册信息 in: body name: request required: true schema: $ref: '#/definitions/controllers.SwagRegisterRequest' produces: - application/json responses: "201": description: 注册成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "400": description: 请求参数错误 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "409": description: 用户名已存在 schema: $ref: '#/definitions/controllers.SwagAPIResponse' summary: 用户注册 tags: - 认证 /step: post: consumes: - application/json description: 接收并保存踏步训练记录,包含心率和步频数据,异步计算回归结果 parameters: - description: 踏步训练记录 in: body name: record required: true schema: $ref: '#/definitions/controllers.SwagAPIResponse' produces: - application/json responses: "201": description: 保存成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "400": description: 请求参数错误 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "401": description: 未认证 schema: $ref: '#/definitions/controllers.SwagAPIResponse' security: - BearerAuth: [] summary: 创建踏步训练记录 tags: - 踏步训练 /step/train-data/{trainId}: get: description: 根据训练ID获取踏步训练的详细信息,包含心率和步频数据 parameters: - description: 训练ID in: path name: trainId required: true type: integer produces: - application/json responses: "200": description: 查询成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "400": description: 请求参数错误 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "401": description: 未认证 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "404": description: 训练记录不存在 schema: $ref: '#/definitions/controllers.SwagAPIResponse' security: - BearerAuth: [] summary: 获取踏步训练详情 tags: - 踏步训练 /step/train-rank/{trainId}: get: description: 根据训练ID和回归类型获取训练排名 parameters: - description: 训练ID in: path name: trainId required: true type: integer - description: '回归类型: 1=线性回归 | 3=二次回归' in: query name: type required: true type: integer produces: - application/json responses: "200": description: 查询成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "400": description: 请求参数错误 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "401": description: 未认证 schema: $ref: '#/definitions/controllers.SwagAPIResponse' security: - BearerAuth: [] summary: 获取训练排名 tags: - 踏步训练 /step/train-records: get: description: 分页获取当前用户的踏步训练记录,按开始时间倒序 parameters: - description: 页码(默认1) in: query name: pageNum type: integer - description: 每页数量(默认10,最大100) in: query name: pageSize type: integer produces: - application/json responses: "200": description: 查询成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "400": description: 请求参数错误 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "401": description: 未认证 schema: $ref: '#/definitions/controllers.SwagAPIResponse' security: - BearerAuth: [] summary: 获取踏步训练记录列表 tags: - 踏步训练 /train-records: post: consumes: - application/json description: 接收并保存训练记录及心率数据,支持重复上传(按train_id去重更新) parameters: - description: 训练记录数据 in: body name: record required: true schema: $ref: '#/definitions/controllers.SwagAPIResponse' produces: - application/json responses: "201": description: 保存成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "400": description: 请求参数错误 schema: $ref: '#/definitions/controllers.SwagAPIResponse' summary: 创建训练记录 tags: - 训练管理 /train-records/analysis: get: description: 对历史心率数据进行统计分析和正态分布曲线拟合 produces: - application/json responses: "200": description: 分析成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "400": description: 数据量不足 schema: $ref: '#/definitions/controllers.SwagAPIResponse' summary: 心率曲线分析 tags: - 训练管理 /train-records/analysis-by-ai: post: consumes: - multipart/form-data description: 上传心率CSV和教案文件,通过AI生成课堂分析报告,支持流式和非流式输出 parameters: - description: 心率数据CSV文件 in: formData name: heart_rate_data required: true type: file - description: 步数数据CSV文件(analysis_type为heart_rate_with_steps时必填) in: formData name: step_data type: file - description: 教案DOCX文件(teaching_plan_source为upload/wechat时必填) in: formData name: teaching_plan type: file - description: '分析类型: heart_rate_only(默认) | heart_rate_with_steps' in: formData name: analysis_type type: string - description: '教案来源: upload(默认) | cloud | wechat' in: formData name: teaching_plan_source type: string - description: 区域ID in: formData name: regionid type: string - description: 训练ID in: formData name: trainid type: string - description: 云端教案ID(teaching_plan_source=cloud时必填) in: formData name: lesson_plan_id type: string - description: '是否流式输出: true | false' in: formData name: stream type: string produces: - application/json responses: "200": description: 分析成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "400": description: 请求参数错误 schema: $ref: '#/definitions/controllers.SwagAPIResponse' summary: AI分析 tags: - AI分析 /train-records/cloud-files: get: description: 获取所有云端教案文件列表 produces: - application/json responses: "200": description: 查询成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' summary: 获取云端教案列表 tags: - 训练管理 /train-records/session: post: consumes: - application/json description: 上传训练开始/结束会话,用于MQTT训练会话追踪 parameters: - description: 训练会话数据 in: body name: session required: true schema: $ref: '#/definitions/controllers.trainingSessionRequest' produces: - application/json responses: "200": description: 操作成功 schema: $ref: '#/definitions/controllers.SwagAPIResponse' "400": description: 请求参数错误 schema: $ref: '#/definitions/controllers.SwagAPIResponse' summary: 上传训练会话 tags: - 训练管理 securityDefinitions: BearerAuth: in: header name: Authorization type: apiKey swagger: "2.0"