Files
bw-mini-app-server/swagger.json
iHeyTang 73ca6723ad feat: 添加图片拼接功能和相关API文档更新
- 在应用中引入ImageCompositionController和ImageCompositionService
- 实现图片拼接功能,支持多种排列方式和输出格式
- 更新Swagger文档,添加图片拼接API描述和示例
- 修改模板执行API描述,简化审核流程说明
2025-09-25 20:42:25 +08:00

2695 lines
72 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.
{
"openapi": "3.0.0",
"paths": {
"/api/v1/callback": {
"post": {
"operationId": "AppController_callback",
"parameters": [],
"responses": {
"201": {
"description": ""
}
},
"tags": [
"App"
]
}
},
"/api/v1/templates/{templateId}/execute": {
"post": {
"description": "根据模板ID执行AI生成任务支持图片和视频生成",
"operationId": "TemplateController_executeTemplateById",
"parameters": [
{
"name": "templateId",
"required": true,
"in": "path",
"description": "模板ID",
"schema": {
"example": 1,
"type": "number"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TemplateExecuteDto"
}
}
}
},
"responses": {
"200": {
"description": "执行成功",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TemplateExecuteResponseDto"
}
}
}
},
"400": {
"description": "参数错误",
"content": {
"application/json": {
"schema": {
"example": {
"code": 400,
"message": "imageUrl is required",
"data": null
}
}
}
}
},
"401": {
"description": "未授权访问",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponseDto"
}
}
}
},
"500": {
"description": "服务器内部错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponseDto"
}
}
}
}
},
"summary": "执行模板生成",
"tags": [
"AI模板系统"
]
}
},
"/api/v1/templates/code/{code}/execute": {
"post": {
"description": "\n 根据模板代码执行AI生成任务直接执行模板无需后端审核。\n \n 参数说明:\n - imageUrl: 输入图片URL必需\n - auditTaskId: 前端审核任务ID可选用于追踪审核记录\n \n 返回ID说明\n - executionId: 数据库执行记录主键,用于查询执行状态\n - taskId: 外部服务(N8N)任务ID用于追踪模板执行状态\n - auditTaskId: 前端传入的审核任务ID\n ",
"operationId": "TemplateController_executeTemplateByCode",
"parameters": [
{
"name": "code",
"required": true,
"in": "path",
"description": "模板代码",
"schema": {
"example": "character_figurine_v1",
"type": "string"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TemplateExecuteDto"
}
}
}
},
"responses": {
"200": {
"description": "执行成功",
"content": {
"application/json": {
"schema": {
"example": {
"code": 200,
"message": "模板执行已启动",
"data": {
"executionId": 123,
"taskId": "n8n_task_456",
"auditTaskId": "audit_task_789",
"status": "processing",
"message": "模板执行已启动"
}
}
}
}
}
},
"400": {
"description": "请求参数错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponseDto"
}
}
}
},
"401": {
"description": "未授权访问",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponseDto"
}
}
}
},
"429": {
"description": "任务数量限制",
"content": {
"application/json": {
"schema": {
"example": {
"code": 429,
"message": "当前账号有3个任务正在进行中且距开始时间不足5分钟请稍后再试",
"data": null
}
}
}
}
},
"500": {
"description": "服务器内部错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponseDto"
}
}
}
}
},
"summary": "通过代码执行模板",
"tags": [
"AI模板系统"
]
}
},
"/api/v1/templates/{templateId}/batch-execute": {
"post": {
"description": "批量执行模板生成任务,支持多张图片同时处理",
"operationId": "TemplateController_batchExecuteTemplate",
"parameters": [
{
"name": "templateId",
"required": true,
"in": "path",
"description": "模板ID",
"schema": {
"example": 1,
"type": "number"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/BatchExecuteDto"
}
}
}
},
"responses": {
"200": {
"description": "批量执行成功",
"content": {
"application/json": {
"schema": {
"example": {
"success": true,
"data": {
"templateId": 1,
"totalCount": 2,
"results": [
{
"inputUrl": "image1.jpg",
"outputUrl": "output1.jpg"
},
{
"inputUrl": "image2.jpg",
"outputUrl": "output2.jpg"
}
]
}
}
}
}
}
},
"400": {
"description": "请求参数错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponseDto"
}
}
}
},
"401": {
"description": "未授权访问",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponseDto"
}
}
}
},
"500": {
"description": "服务器内部错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponseDto"
}
}
}
}
},
"summary": "批量执行模板",
"tags": [
"AI模板系统"
]
}
},
"/api/v1/templates": {
"get": {
"description": "获取所有可用的AI生成模板支持按类型筛选",
"operationId": "TemplateController_getAllTemplates",
"parameters": [],
"responses": {
"200": {
"description": "获取成功",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/TemplateListDto"
}
}
}
}
},
"400": {
"description": "请求参数错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponseDto"
}
}
}
},
"401": {
"description": "未授权访问",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponseDto"
}
}
}
},
"500": {
"description": "服务器内部错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponseDto"
}
}
}
}
},
"summary": "获取所有模板列表",
"tags": [
"AI模板系统"
]
},
"post": {
"description": "创建一个新的AI生成模板",
"operationId": "TemplateController_createTemplate",
"parameters": [],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateTemplateDto"
}
}
}
},
"responses": {
"200": {
"description": "创建成功",
"content": {
"application/json": {
"schema": {
"example": {
"success": true,
"data": {
"id": 1,
"code": "new_template_v1",
"name": "新模板"
}
}
}
}
}
},
"400": {
"description": "请求参数错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponseDto"
}
}
}
},
"401": {
"description": "未授权访问",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponseDto"
}
}
}
},
"409": {
"description": "模板代码已存在"
},
"500": {
"description": "服务器内部错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponseDto"
}
}
}
}
},
"summary": "创建新模板",
"tags": [
"AI模板系统"
]
}
},
"/api/v1/templates/image": {
"get": {
"description": "获取所有图片类型的AI生成模板",
"operationId": "TemplateController_getImageTemplates",
"parameters": [],
"responses": {
"200": {
"description": "获取成功",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/TemplateListDto"
}
}
}
}
},
"400": {
"description": "请求参数错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponseDto"
}
}
}
},
"401": {
"description": "未授权访问",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponseDto"
}
}
}
},
"500": {
"description": "服务器内部错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponseDto"
}
}
}
}
},
"summary": "获取图片模板列表",
"tags": [
"AI模板系统"
]
}
},
"/api/v1/templates/video": {
"get": {
"description": "获取所有视频类型的AI生成模板",
"operationId": "TemplateController_getVideoTemplates",
"parameters": [],
"responses": {
"200": {
"description": "获取成功",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/TemplateListDto"
}
}
}
}
},
"400": {
"description": "请求参数错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponseDto"
}
}
}
},
"401": {
"description": "未授权访问",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponseDto"
}
}
}
},
"500": {
"description": "服务器内部错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponseDto"
}
}
}
}
},
"summary": "获取视频模板列表",
"tags": [
"AI模板系统"
]
}
},
"/api/v1/templates/recommend": {
"get": {
"description": "根据用户偏好标签推荐适合的模板",
"operationId": "TemplateController_recommendTemplates",
"parameters": [
{
"name": "tags",
"required": false,
"in": "query",
"description": "用户偏好标签,逗号分隔",
"schema": {
"example": "人物,手办",
"type": "string"
}
},
{
"name": "limit",
"required": false,
"in": "query",
"description": "推荐数量",
"schema": {
"example": 5,
"type": "number"
}
}
],
"responses": {
"200": {
"description": "推荐成功",
"content": {
"application/json": {
"schema": {
"example": {
"success": true,
"data": {
"userTags": [
"人物",
"手办"
],
"recommendedTemplates": []
}
}
}
}
}
},
"400": {
"description": "请求参数错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponseDto"
}
}
}
},
"401": {
"description": "未授权访问",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponseDto"
}
}
}
},
"500": {
"description": "服务器内部错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponseDto"
}
}
}
}
},
"summary": "推荐模板",
"tags": [
"AI模板系统"
]
}
},
"/api/v1/templates/{templateId}": {
"get": {
"description": "根据模板ID获取详细信息",
"operationId": "TemplateController_getTemplateById",
"parameters": [
{
"name": "templateId",
"required": true,
"in": "path",
"description": "模板ID",
"schema": {
"example": 1,
"type": "number"
}
}
],
"responses": {
"200": {
"description": "获取成功",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TemplateListDto"
}
}
}
},
"400": {
"description": "请求参数错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponseDto"
}
}
}
},
"401": {
"description": "未授权访问",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponseDto"
}
}
}
},
"404": {
"description": "模板不存在"
},
"500": {
"description": "服务器内部错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponseDto"
}
}
}
}
},
"summary": "获取模板详情",
"tags": [
"AI模板系统"
]
},
"put": {
"description": "更新指定模板的配置信息",
"operationId": "TemplateController_updateTemplate",
"parameters": [
{
"name": "templateId",
"required": true,
"in": "path",
"description": "模板ID",
"schema": {
"example": 1,
"type": "number"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UpdateTemplateDto"
}
}
}
},
"responses": {
"200": {
"description": "更新成功",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TemplateListDto"
}
}
}
},
"400": {
"description": "请求参数错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponseDto"
}
}
}
},
"401": {
"description": "未授权访问",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponseDto"
}
}
}
},
"404": {
"description": "模板不存在"
},
"409": {
"description": "模板代码已存在"
},
"500": {
"description": "服务器内部错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponseDto"
}
}
}
}
},
"summary": "更新模板",
"tags": [
"AI模板系统"
]
},
"delete": {
"operationId": "TemplateController_deleteTemplate",
"parameters": [
{
"name": "templateId",
"required": true,
"in": "path",
"schema": {
"type": "number"
}
}
],
"responses": {
"200": {
"description": ""
},
"400": {
"description": "请求参数错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponseDto"
}
}
}
},
"401": {
"description": "未授权访问",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponseDto"
}
}
}
},
"500": {
"description": "服务器内部错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponseDto"
}
}
}
}
},
"tags": [
"AI模板系统"
]
}
},
"/api/v1/templates/execution/{executionId}/progress": {
"get": {
"description": "\n 根据 executionId 查询模板执行进度和状态。\n \n 注意:请使用执行接口返回的 executionId 作为查询参数,而不是 taskId 或 auditTaskId。\n \n 返回的状态包括:\n - pending_audit: 图片审核中\n - audit_failed: 图片审核失败\n - processing: 模板执行中\n - completed: 执行完成\n - failed: 执行失败\n ",
"operationId": "TemplateController_getExecutionProgress",
"parameters": [
{
"name": "executionId",
"required": true,
"in": "path",
"description": "执行记录ID从执行接口返回的 executionId",
"schema": {
"example": 123,
"type": "number"
}
}
],
"responses": {
"200": {
"description": "查询成功",
"content": {
"application/json": {
"schema": {
"example": {
"code": 200,
"message": "获取执行进度成功",
"data": {
"executionId": 123,
"taskId": "n8n_task_456",
"auditTaskId": "audit_task_789",
"templateId": 1,
"templateName": "照片修复模板",
"status": "processing",
"progress": 50,
"inputImageUrl": "https://example.com/input.jpg",
"outputUrl": null,
"errorMessage": null,
"createdAt": "2025-01-01T00:00:00Z",
"updatedAt": "2025-01-01T00:05:00Z"
}
}
}
}
}
},
"400": {
"description": "请求参数错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponseDto"
}
}
}
},
"401": {
"description": "未授权访问",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponseDto"
}
}
}
},
"404": {
"description": "执行记录不存在"
},
"500": {
"description": "服务器内部错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponseDto"
}
}
}
}
},
"summary": "查询模板执行进度",
"tags": [
"AI模板系统"
]
}
},
"/api/v1/templates/executions/user/{userId}": {
"get": {
"operationId": "TemplateController_getUserExecutions",
"parameters": [
{
"name": "userId",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
},
{
"name": "status",
"required": true,
"in": "query",
"schema": {
"type": "string"
}
},
{
"name": "limit",
"required": true,
"in": "query",
"schema": {
"type": "number"
}
}
],
"responses": {
"200": {
"description": ""
},
"400": {
"description": "请求参数错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponseDto"
}
}
}
},
"401": {
"description": "未授权访问",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponseDto"
}
}
}
},
"500": {
"description": "服务器内部错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponseDto"
}
}
}
}
},
"tags": [
"AI模板系统"
]
}
},
"/api/v1/templates/admin/{templateId}": {
"get": {
"operationId": "TemplateController_getTemplateForAdmin",
"parameters": [
{
"name": "templateId",
"required": true,
"in": "path",
"schema": {
"type": "number"
}
}
],
"responses": {
"200": {
"description": ""
},
"400": {
"description": "请求参数错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponseDto"
}
}
}
},
"401": {
"description": "未授权访问",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponseDto"
}
}
}
},
"500": {
"description": "服务器内部错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponseDto"
}
}
}
}
},
"tags": [
"AI模板系统"
]
}
},
"/api/v1/templates/admin": {
"get": {
"operationId": "TemplateController_getAllTemplatesForAdmin",
"parameters": [
{
"name": "page",
"required": true,
"in": "query",
"schema": {
"type": "number"
}
},
{
"name": "limit",
"required": true,
"in": "query",
"schema": {
"type": "number"
}
},
{
"name": "type",
"required": true,
"in": "query",
"schema": {
"type": "string"
}
},
{
"name": "isActive",
"required": true,
"in": "query",
"schema": {
"type": "boolean"
}
}
],
"responses": {
"200": {
"description": ""
},
"400": {
"description": "请求参数错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponseDto"
}
}
}
},
"401": {
"description": "未授权访问",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponseDto"
}
}
}
},
"500": {
"description": "服务器内部错误",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponseDto"
}
}
}
}
},
"tags": [
"AI模板系统"
]
}
},
"/api/v1/image-composition/compose": {
"post": {
"description": "将多张图片按指定位置拼接到一个画布上,支持层级、透明度等设置",
"operationId": "ImageCompositionController_composeImages",
"parameters": [],
"requestBody": {
"required": true,
"description": "图片拼接配置 - 简化版本",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ImageCompositionDto"
},
"examples": {
"horizontal": {
"summary": "水平排列示例",
"value": {
"images": [
"https://picsum.photos/300/200",
"https://picsum.photos/300/200",
"https://picsum.photos/300/200"
],
"direction": "horizontal",
"outputFormat": "jpeg",
"maxWidth": 1920,
"maxHeight": 1080,
"quality": 80
}
},
"vertical": {
"summary": "垂直排列示例",
"value": {
"images": [
"https://picsum.photos/200/300",
"https://picsum.photos/200/300",
"https://picsum.photos/200/300"
],
"direction": "vertical",
"outputFormat": "webp",
"maxWidth": 800,
"maxHeight": 1200,
"quality": 85
}
},
"grid": {
"summary": "网格排列示例",
"value": {
"images": [
"https://picsum.photos/200/200",
"https://picsum.photos/200/200",
"https://picsum.photos/200/200",
"https://picsum.photos/200/200",
"https://picsum.photos/200/200"
],
"direction": "grid",
"outputFormat": "jpeg",
"maxWidth": 1024,
"maxHeight": 1024,
"quality": 75
}
}
}
}
}
},
"responses": {
"200": {
"description": "图片拼接成功",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ImageCompositionResponseDto"
}
}
}
},
"400": {
"description": "请求参数错误"
},
"401": {
"description": "未授权访问"
},
"500": {
"description": "服务器内部错误"
}
},
"summary": "图片拼接",
"tags": [
"图片处理"
]
}
},
"/api/v1/users/login": {
"post": {
"description": "支持微信、支付宝、百度、字节跳动等8大平台的统一登录接口",
"operationId": "UnifiedUserController_login",
"parameters": [],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PlatformLoginDto"
}
}
}
},
"responses": {
"200": {
"description": "登录成功",
"content": {
"application/json": {
"schema": {
"example": {
"code": 200,
"message": "登录成功",
"data": {
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"refreshToken": "refresh_token_string",
"userInfo": {
"id": "user-uuid",
"nickname": "用户昵称",
"avatarUrl": "https://example.com/avatar.jpg"
}
}
}
}
}
}
},
"400": {
"description": "请求参数错误"
},
"401": {
"description": "平台授权失败"
}
},
"summary": "多平台统一登录",
"tags": [
"用户管理"
]
}
},
"/api/v1/users/register": {
"post": {
"description": "支持多平台用户注册,自动创建统一用户身份",
"operationId": "UnifiedUserController_register",
"parameters": [],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PlatformLoginDto"
}
}
}
},
"responses": {
"200": {
"description": "注册成功",
"content": {
"application/json": {
"schema": {
"example": {
"code": 200,
"message": "注册成功",
"data": {
"userId": "user-uuid",
"unifiedUserId": "unified-user-123"
}
}
}
}
}
}
},
"summary": "多平台统一注册",
"tags": [
"用户管理"
]
}
},
"/api/v1/users/profile": {
"get": {
"description": "获取当前登录用户的详细信息和平台绑定状态",
"operationId": "UnifiedUserController_getProfile",
"parameters": [],
"responses": {
"200": {
"description": "获取成功",
"content": {
"application/json": {
"schema": {
"example": {
"code": 200,
"message": "获取成功",
"data": {
"id": "user-uuid",
"unifiedUserId": "unified-user-123",
"nickname": "用户昵称",
"avatarUrl": "https://example.com/avatar.jpg",
"phone": "13800138000",
"email": "user@example.com",
"platformUsers": []
}
}
}
}
}
},
"401": {
"description": "未授权访问"
}
},
"security": [
{
"JWT-auth": []
}
],
"summary": "获取用户档案",
"tags": [
"用户管理"
]
},
"put": {
"description": "更新当前用户的基本信息(昵称、头像等)",
"operationId": "UnifiedUserController_updateProfile",
"parameters": [],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UserInfoUpdateDto"
}
}
}
},
"responses": {
"200": {
"description": "更新成功",
"content": {
"application/json": {
"schema": {
"example": {
"code": 200,
"message": "更新成功"
}
}
}
}
},
"401": {
"description": "未授权访问"
}
},
"security": [
{
"JWT-auth": []
}
],
"summary": "更新用户信息",
"tags": [
"用户管理"
]
}
},
"/api/v1/users/bind-platform": {
"post": {
"description": "将其他平台账号绑定到当前统一用户身份",
"operationId": "UnifiedUserController_bindPlatform",
"parameters": [],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PlatformBindDto"
}
}
}
},
"responses": {
"200": {
"description": "绑定成功",
"content": {
"application/json": {
"schema": {
"example": {
"code": 200,
"message": "绑定成功"
}
}
}
}
},
"401": {
"description": "未授权访问"
},
"409": {
"description": "平台账号已绑定其他用户"
}
},
"security": [
{
"JWT-auth": []
}
],
"summary": "绑定平台账号",
"tags": [
"用户管理"
]
}
},
"/api/v1/users/unbind-platform/{platform}": {
"delete": {
"description": "解除指定平台账号与当前用户的绑定关系",
"operationId": "UnifiedUserController_unbindPlatform",
"parameters": [
{
"name": "platform",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "解绑成功",
"content": {
"application/json": {
"schema": {
"example": {
"code": 200,
"message": "解绑成功"
}
}
}
}
},
"401": {
"description": "未授权访问"
},
"404": {
"description": "平台绑定不存在"
}
},
"security": [
{
"JWT-auth": []
}
],
"summary": "解绑平台账号",
"tags": [
"用户管理"
]
}
},
"/api/v1/users/platforms": {
"get": {
"description": "获取系统支持的所有平台类型和相关信息",
"operationId": "UnifiedUserController_getSupportedPlatforms",
"parameters": [],
"responses": {
"200": {
"description": "获取成功",
"content": {
"application/json": {
"schema": {
"example": {
"code": 200,
"message": "获取成功",
"data": [
{
"type": "wechat",
"name": "微信小程序",
"supported": true
},
{
"type": "alipay",
"name": "支付宝小程序",
"supported": true
}
]
}
}
}
}
}
},
"summary": "获取支持的平台列表",
"tags": [
"用户管理"
]
}
},
"/api/v1/content-moderation/{platform}/audit-image": {
"post": {
"operationId": "ContentModerationController_auditImage",
"parameters": [
{
"name": "platform",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ImageAuditDto"
}
}
}
},
"responses": {
"200": {
"description": "审核成功",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ContentAuditResponseDto"
}
}
}
}
},
"security": [
{
"bearer": []
}
],
"summary": "图片内容审核",
"tags": [
"内容审核"
]
}
},
"/api/v1/content-moderation/{platform}/audit-batch": {
"post": {
"operationId": "ContentModerationController_auditImageBatch",
"parameters": [
{
"name": "platform",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
},
"responses": {
"200": {
"description": "批量审核成功",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/BatchAuditResponseDto"
}
}
}
}
},
"security": [
{
"bearer": []
}
],
"summary": "批量图片审核",
"tags": [
"内容审核"
]
}
},
"/api/v1/content-moderation/{platform}/result/{taskId}": {
"get": {
"operationId": "ContentModerationController_getAuditResult",
"parameters": [
{
"name": "platform",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
},
{
"name": "taskId",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "查询成功",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ContentAuditResponseDto"
}
}
}
}
},
"security": [
{
"bearer": []
}
],
"summary": "查询审核结果",
"tags": [
"内容审核"
]
}
},
"/api/v1/content-moderation/{platform}/callback": {
"post": {
"operationId": "ContentModerationController_handleCallback",
"parameters": [
{
"name": "platform",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"responses": {
"201": {
"description": ""
}
},
"summary": "审核结果回调",
"tags": [
"内容审核"
]
}
},
"/api/v1/content-moderation/history": {
"get": {
"operationId": "ContentModerationController_getAuditHistory",
"parameters": [],
"responses": {
"200": {
"description": ""
}
},
"security": [
{
"bearer": []
}
],
"summary": "获取审核历史",
"tags": [
"内容审核"
]
}
},
"/api/v1/content-moderation/stats": {
"get": {
"operationId": "ContentModerationController_getAuditStats",
"parameters": [
{
"name": "platform",
"required": true,
"in": "query",
"schema": {
"type": "string"
}
},
{
"name": "startDate",
"required": true,
"in": "query",
"schema": {
"type": "string"
}
},
{
"name": "endDate",
"required": true,
"in": "query",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "获取成功",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AuditStatsResponseDto"
}
}
}
}
},
"summary": "获取审核统计",
"tags": [
"内容审核"
]
}
},
"/api/v1/content-moderation/user-stats": {
"get": {
"operationId": "ContentModerationController_getUserAuditStats",
"parameters": [],
"responses": {
"200": {
"description": ""
}
},
"security": [
{
"bearer": []
}
],
"summary": "获取用户审核统计",
"tags": [
"内容审核"
]
}
},
"/api/v1/content-moderation/platforms": {
"get": {
"operationId": "ContentModerationController_getSupportedPlatforms",
"parameters": [],
"responses": {
"200": {
"description": ""
}
},
"summary": "获取支持的审核平台",
"tags": [
"内容审核"
]
}
},
"/api/v1/content-moderation/check/{taskId}": {
"get": {
"operationId": "ContentModerationController_checkContentApproval",
"parameters": [
{
"name": "taskId",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": ""
}
},
"summary": "检查内容是否通过审核",
"tags": [
"内容审核"
]
}
}
},
"info": {
"title": "多平台小程序统一后台API",
"description": "\n ## 功能特性\n - 🔐 统一用户认证 (微信/支付宝/百度/字节跳动等)\n - 🎨 AI模板系统 (图片/视频生成)\n - 💰 积分系统 (积分获取、消耗、管理)\n - 📱 多平台适配 (8大平台支持)\n - 🧩 扩展数据存储 (灵活的JSON数据)\n \n ## 认证方式\n 使用JWT Bearer Token进行API认证\n \n ## 响应格式\n 所有API响应都遵循统一格式\n ```json\n {\n \"code\": 200,\n \"message\": \"success\",\n \"data\": {},\n \"timestamp\": 1703001000000,\n \"traceId\": \"trace-uuid\"\n }\n ```\n ",
"version": "1.0.0",
"contact": {
"name": "开发团队",
"url": "https://example.com",
"email": "dev@example.com"
},
"license": {
"name": "MIT",
"url": "https://opensource.org/licenses/MIT"
}
},
"tags": [
{
"name": "用户管理",
"description": "用户注册、登录、信息管理"
},
{
"name": "平台适配",
"description": "各平台特定接口和数据同步"
},
{
"name": "AI模板系统",
"description": "AI图片/视频生成模板管理"
},
{
"name": "积分系统",
"description": "积分获取、消耗、查询管理"
},
{
"name": "扩展服务",
"description": "预留的扩展功能接口"
}
],
"servers": [
{
"url": "http://localhost:3003",
"description": "开发环境"
},
{
"url": "https://sd2s2bl25ni4n75na2bog.apigateway-cn-beijing.volceapi.com",
"description": "测试环境"
},
{
"url": "https://sd2s2bl25ni4n75na2bog.apigateway-cn-beijing.volceapi.com",
"description": "生产环境"
}
],
"components": {
"securitySchemes": {
"JWT-auth": {
"scheme": "bearer",
"bearerFormat": "JWT",
"type": "http",
"name": "JWT",
"description": "Enter JWT token",
"in": "header"
}
},
"schemas": {
"ErrorResponseDto": {
"type": "object",
"properties": {
"code": {
"type": "number",
"description": "错误状态码",
"example": 400
},
"message": {
"type": "string",
"description": "错误消息",
"example": "请求参数错误"
},
"timestamp": {
"type": "number",
"description": "时间戳",
"example": 1703001000000
},
"traceId": {
"type": "string",
"description": "追踪ID",
"example": "trace-uuid-123"
},
"details": {
"description": "详细错误信息",
"example": [
"字段验证失败"
],
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"code",
"message",
"timestamp",
"traceId"
]
},
"TemplateExecuteDto": {
"type": "object",
"properties": {
"imageUrl": {
"type": "string",
"description": "输入图片URL",
"example": "https://cdn.example.com/upload/image.jpg"
},
"auditTaskId": {
"type": "string",
"description": "审核任务ID可选",
"example": "audit_task_12345"
}
},
"required": [
"imageUrl"
]
},
"TemplateExecuteResponseDto": {
"type": "object",
"properties": {
"success": {
"type": "boolean",
"description": "执行状态",
"example": true
},
"imageUrl": {
"type": "string",
"description": "生成结果URL(图片模板)"
},
"videoUrl": {
"type": "string",
"description": "生成结果URL(视频模板)"
},
"thumbnailUrl": {
"type": "string",
"description": "缩略图URL"
},
"taskId": {
"type": "string",
"description": "任务ID",
"example": "req_1704067200_abc123"
},
"executionTime": {
"type": "number",
"description": "执行耗时(毫秒)",
"example": 5000
},
"creditCost": {
"type": "number",
"description": "消耗积分",
"example": 28
}
},
"required": [
"success",
"taskId",
"executionTime",
"creditCost"
]
},
"BatchExecuteDto": {
"type": "object",
"properties": {
"imageUrls": {
"description": "输入图片URL数组",
"example": [
"https://cdn.example.com/upload/image1.jpg",
"https://cdn.example.com/upload/image2.jpg"
],
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"imageUrls"
]
},
"TemplateListDto": {
"type": "object",
"properties": {
"id": {
"type": "number",
"description": "模板ID",
"example": 1
},
"code": {
"type": "string",
"description": "模板代码",
"example": "character_figurine_v1"
},
"name": {
"type": "string",
"description": "模板名称",
"example": "人物手办"
},
"description": {
"type": "string",
"description": "模板描述",
"example": "将人物照片制作成精细的角色手办模型"
},
"templateType": {
"type": "string",
"enum": [
"image",
"video"
],
"description": "模板类型",
"example": "video"
},
"creditCost": {
"type": "number",
"description": "积分消耗",
"example": 28
},
"version": {
"type": "string",
"description": "版本号",
"example": "1.0.0"
},
"inputExampleUrl": {
"type": "string",
"description": "输入示例URL"
},
"outputExampleUrl": {
"type": "string",
"description": "输出示例URL"
},
"tags": {
"description": "标签数组",
"example": [
"人物",
"手办",
"模型"
],
"type": "array",
"items": {
"type": "string"
}
},
"isActive": {
"type": "boolean",
"description": "是否启用",
"example": true
},
"createdAt": {
"format": "date-time",
"type": "string",
"description": "创建时间",
"example": "2024-01-01T00:00:00Z"
}
},
"required": [
"id",
"code",
"name",
"description",
"templateType",
"creditCost",
"version",
"tags",
"isActive",
"createdAt"
]
},
"CreateTemplateDto": {
"type": "object",
"properties": {
"code": {
"type": "string",
"description": "模板代码",
"example": "character_figurine_v1"
},
"name": {
"type": "string",
"description": "模板名称",
"example": "人物手办"
},
"description": {
"type": "string",
"description": "模板描述",
"example": "将人物照片制作成精细的角色手办模型"
},
"creditCost": {
"type": "number",
"description": "积分消耗",
"example": 28,
"minimum": 0
},
"version": {
"type": "string",
"description": "版本号",
"example": "1.0.0"
},
"inputExampleUrl": {
"type": "string",
"description": "输入示例URL",
"example": "https://example.com/input.jpg"
},
"outputExampleUrl": {
"type": "string",
"description": "输出示例URL",
"example": "https://example.com/output.jpg"
},
"tags": {
"description": "标签数组",
"example": [
"人物",
"手办",
"模型"
],
"type": "array",
"items": {
"type": "string"
}
},
"templateType": {
"type": "string",
"description": "模板类型",
"enum": [
"image",
"video"
],
"example": "image"
},
"templateClass": {
"type": "string",
"description": "模板类名",
"example": "CharacterFigurineTemplate"
},
"imageModel": {
"type": "string",
"description": "图片模型",
"example": "flux-dev"
},
"imagePrompt": {
"type": "string",
"description": "图片提示词模板"
},
"videoModel": {
"type": "string",
"description": "视频模型",
"example": "runway-gen3"
},
"videoPrompt": {
"type": "string",
"description": "视频提示词模板"
},
"duration": {
"type": "number",
"description": "视频时长(秒)",
"example": 10,
"minimum": 1,
"maximum": 300
},
"aspectRatio": {
"type": "string",
"description": "宽高比",
"example": "16:9"
},
"isActive": {
"type": "boolean",
"description": "是否启用",
"example": true
},
"sortOrder": {
"type": "number",
"description": "排序权重",
"example": 100
}
},
"required": [
"code",
"name",
"description",
"creditCost",
"version",
"templateType",
"templateClass"
]
},
"UpdateTemplateDto": {
"type": "object",
"properties": {
"code": {
"type": "string",
"description": "模板代码",
"example": "character_figurine_v1"
},
"name": {
"type": "string",
"description": "模板名称",
"example": "人物手办"
},
"description": {
"type": "string",
"description": "模板描述",
"example": "将人物照片制作成精细的角色手办模型"
},
"creditCost": {
"type": "number",
"description": "积分消耗",
"example": 28,
"minimum": 0
},
"version": {
"type": "string",
"description": "版本号",
"example": "1.0.1"
},
"inputExampleUrl": {
"type": "string",
"description": "输入示例URL",
"example": "https://example.com/input.jpg"
},
"outputExampleUrl": {
"type": "string",
"description": "输出示例URL",
"example": "https://example.com/output.jpg"
},
"tags": {
"description": "标签数组",
"example": [
"人物",
"手办",
"模型"
],
"type": "array",
"items": {
"type": "string"
}
},
"templateType": {
"type": "string",
"description": "模板类型",
"enum": [
"image",
"video"
]
},
"templateClass": {
"type": "string",
"description": "模板类名",
"example": "CharacterFigurineTemplate"
},
"imageModel": {
"type": "string",
"description": "图片模型",
"example": "flux-dev"
},
"imagePrompt": {
"type": "string",
"description": "图片提示词模板"
},
"videoModel": {
"type": "string",
"description": "视频模型",
"example": "runway-gen3"
},
"videoPrompt": {
"type": "string",
"description": "视频提示词模板"
},
"duration": {
"type": "number",
"description": "视频时长(秒)",
"example": 10,
"minimum": 1,
"maximum": 300
},
"aspectRatio": {
"type": "string",
"description": "宽高比",
"example": "16:9"
},
"isActive": {
"type": "boolean",
"description": "是否启用",
"example": true
},
"sortOrder": {
"type": "number",
"description": "排序权重",
"example": 100
}
}
},
"ImageCompositionDto": {
"type": "object",
"properties": {
"images": {
"description": "图片URL或base64数据列表",
"example": [
"https://picsum.photos/300/200",
"https://picsum.photos/300/200",
"https://picsum.photos/300/200"
],
"type": "array",
"items": {
"type": "string"
}
},
"direction": {
"type": "string",
"description": "排列方向",
"enum": [
"horizontal",
"vertical",
"grid"
],
"example": "horizontal"
},
"outputFormat": {
"type": "string",
"description": "输出格式",
"enum": [
"jpeg",
"png",
"webp"
],
"example": "png",
"default": "png"
},
"maxWidth": {
"type": "number",
"description": "最大输出宽度(像素),超过会等比压缩",
"example": 1920,
"default": 1920,
"minimum": 100,
"maximum": 4096
},
"maxHeight": {
"type": "number",
"description": "最大输出高度(像素),超过会等比压缩",
"example": 1080,
"default": 1080,
"minimum": 100,
"maximum": 4096
},
"quality": {
"type": "number",
"description": "图片质量1-100仅对JPEG/WebP有效",
"example": 80,
"default": 80,
"minimum": 1,
"maximum": 100
}
},
"required": [
"images",
"direction"
]
},
"ImageCompositionResponseDto": {
"type": "object",
"properties": {
"imageUrl": {
"type": "string",
"description": "拼接后的图片URL",
"example": "https://s3.amazonaws.com/bucket/composed-image-1234567890.png"
},
"format": {
"type": "string",
"description": "图片格式",
"example": "png"
},
"size": {
"type": "number",
"description": "图片大小(字节)",
"example": 12345
},
"width": {
"type": "number",
"description": "画布宽度",
"example": 800
},
"height": {
"type": "number",
"description": "画布高度",
"example": 600
},
"processingTime": {
"type": "number",
"description": "处理耗时(毫秒)",
"example": 150
}
},
"required": [
"imageUrl",
"format",
"size",
"width",
"height",
"processingTime"
]
},
"PlatformType": {
"type": "string",
"enum": [
"wechat",
"alipay",
"baidu",
"bytedance",
"jd",
"qq",
"feishu",
"kuaishou",
"h5",
"rn"
],
"description": "平台类型"
},
"PlatformLoginDto": {
"type": "object",
"properties": {
"platform": {
"description": "平台类型",
"example": "wechat",
"allOf": [
{
"$ref": "#/components/schemas/PlatformType"
}
]
},
"code": {
"type": "string",
"description": "平台授权码",
"example": "081234567890abcdef"
},
"encryptedData": {
"type": "string",
"description": "加密用户数据(微信小程序)"
},
"iv": {
"type": "string",
"description": "加密向量(微信小程序)"
},
"userInfo": {
"type": "object",
"description": "用户基础信息"
},
"anonymousCode": {
"type": "string",
"description": "匿名授权码(抖音小程序)"
}
},
"required": [
"platform",
"code"
]
},
"UserInfoUpdateDto": {
"type": "object",
"properties": {
"nickname": {
"type": "string",
"description": "用户昵称"
},
"avatarUrl": {
"type": "string",
"description": "头像URL"
},
"phone": {
"type": "string",
"description": "手机号码"
},
"email": {
"type": "string",
"description": "电子邮箱"
}
}
},
"PlatformBindDto": {
"type": "object",
"properties": {
"platform": {
"type": "string",
"description": "平台类型",
"enum": [
"wechat",
"alipay",
"baidu",
"bytedance",
"jd",
"qq",
"feishu",
"kuaishou",
"h5",
"rn"
]
},
"code": {
"type": "string",
"description": "平台授权码"
},
"encryptedData": {
"type": "string",
"description": "加密用户数据(微信小程序)"
},
"iv": {
"type": "string",
"description": "加密向量(微信小程序)"
},
"userInfo": {
"type": "object",
"description": "用户基础信息"
}
},
"required": [
"platform",
"code"
]
},
"ImageAuditDto": {
"type": "object",
"properties": {
"imageUrl": {
"type": "string",
"description": "图片URL",
"example": "https://example.com/image.jpg"
},
"imageBase64": {
"type": "string",
"description": "图片Base64可选"
},
"taskId": {
"type": "string",
"description": "任务ID可选"
},
"businessType": {
"type": "string",
"description": "业务类型",
"example": "user_avatar"
},
"extraData": {
"type": "object",
"description": "扩展数据"
}
},
"required": [
"imageUrl"
]
},
"AuditDetailResponseDto": {
"type": "object",
"properties": {
"type": {
"type": "string",
"description": "检测类型"
},
"label": {
"type": "string",
"description": "具体标签"
},
"confidence": {
"type": "number",
"description": "置信度",
"example": 85
},
"description": {
"type": "string",
"description": "描述信息"
}
},
"required": [
"type",
"label",
"confidence",
"description"
]
},
"ContentAuditResponseDto": {
"type": "object",
"properties": {
"taskId": {
"type": "string",
"description": "任务ID"
},
"status": {
"type": "string",
"enum": [
"pending",
"processing",
"completed",
"failed",
"timeout"
],
"description": "审核状态"
},
"conclusion": {
"type": "string",
"enum": [
"pass",
"reject",
"review",
"uncertain"
],
"description": "审核结论"
},
"confidence": {
"type": "number",
"description": "置信度 (0-100)",
"example": 85
},
"details": {
"description": "详细审核结果",
"type": "array",
"items": {
"$ref": "#/components/schemas/AuditDetailResponseDto"
}
},
"riskLevel": {
"type": "string",
"enum": [
"low",
"medium",
"high",
"critical"
],
"description": "风险等级"
},
"suggestion": {
"type": "string",
"enum": [
"pass",
"block",
"human_review",
"delete"
],
"description": "建议操作"
},
"timestamp": {
"format": "date-time",
"type": "string",
"description": "审核时间"
}
},
"required": [
"taskId",
"status",
"conclusion",
"confidence",
"details",
"riskLevel",
"suggestion",
"timestamp"
]
},
"BatchAuditResponseDto": {
"type": "object",
"properties": {
"totalCount": {
"type": "number",
"description": "总数"
},
"successCount": {
"type": "number",
"description": "成功数"
},
"failureCount": {
"type": "number",
"description": "失败数"
},
"results": {
"description": "审核结果列表",
"type": "array",
"items": {
"$ref": "#/components/schemas/ContentAuditResponseDto"
}
}
},
"required": [
"totalCount",
"successCount",
"failureCount",
"results"
]
},
"AuditStatsResponseDto": {
"type": "object",
"properties": {
"totalAudits": {
"type": "number",
"description": "总审核数"
},
"passRate": {
"type": "number",
"description": "通过率 (%)",
"example": 85.5
},
"rejectRate": {
"type": "number",
"description": "拒绝率 (%)",
"example": 10.2
},
"reviewRate": {
"type": "number",
"description": "复审率 (%)",
"example": 4.3
},
"averageConfidence": {
"type": "number",
"description": "平均置信度",
"example": 88.7
}
},
"required": [
"totalAudits",
"passRate",
"rejectRate",
"reviewRate",
"averageConfidence"
]
}
}
}
}