From 4d712f8332bb2672e3ffb9544ae67bce1ae4bff0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=88=90?= Date: Tue, 16 Dec 2025 10:55:59 +0800 Subject: [PATCH] 1 --- _doc/发布的接口文档.md | 22 +++++++++++----------- api/middleware/job/aiService.js | 2 +- api/services/ai_service.js | 2 +- config/framework.config.js | 4 ++-- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/_doc/发布的接口文档.md b/_doc/发布的接口文档.md index 48e8635..51b6eb7 100644 --- a/_doc/发布的接口文档.md +++ b/_doc/发布的接口文档.md @@ -99,7 +99,7 @@ module.exports = { - **请求头**: ``` Content-Type: application/json - Authorization: Bearer ${token} + Authorization: ${token} ``` - **请求参数**: ```json @@ -157,7 +157,7 @@ module.exports = { - **请求头**: ``` Content-Type: multipart/form-data - Authorization: Bearer ${token} + Authorization: ${token} ``` - **请求参数**(Form Data): | 参数名 | 类型 | 必填 | 说明 | @@ -187,7 +187,7 @@ module.exports = { // 发送请求 form.submit('http://api.example.com/api/file/upload_version', { headers: { - 'Authorization': `Bearer ${token}` + 'Authorization': `${token}` } }, callback); ``` @@ -224,7 +224,7 @@ module.exports = { - **请求头**: ``` Content-Type: application/json - Authorization: Bearer ${token} + Authorization: ${token} ``` - **请求参数**: ```json @@ -290,8 +290,8 @@ module.exports = { 1. **Token 配置** - 确保 `config/appConfig.js` 中有有效的 `token` - - Token 用于 API 认证,格式为 `Bearer ${token}` - - 所有接口请求都需要在请求头中包含 `Authorization: Bearer ${token}` + - Token 用于 API 认证,格式为 `${token}` + - 所有接口请求都需要在请求头中包含 `Authorization: ${token}` 2. **接口路径** - 所有接口路径前缀为 `/api` @@ -432,7 +432,7 @@ async function createVersion() { status: 1 }, { headers: { - 'Authorization': `Bearer ${token}`, + 'Authorization': `${token}`, 'Content-Type': 'application/json' } }); @@ -472,7 +472,7 @@ async function uploadVersionFile(versionId) { const response = await axios.post('http://api.example.com/api/file/upload_version', form, { headers: { - 'Authorization': `Bearer ${token}`, + 'Authorization': `${token}`, ...form.getHeaders() }, maxContentLength: Infinity, @@ -494,7 +494,7 @@ async function updateVersionDownloadUrl(versionId, downloadUrl, fileHash) { file_hash: fileHash }, { headers: { - 'Authorization': `Bearer ${token}`, + 'Authorization': `${token}`, 'Content-Type': 'application/json' } }); @@ -536,7 +536,7 @@ async function publishVersion() { ```bash curl -X POST http://api.example.com/api/version/create \ - -H "Authorization: Bearer your-token-here" \ + -H "Authorization: your-token-here" \ -H "Content-Type: application/json" \ -d '{ "version": "1.0.0", @@ -556,7 +556,7 @@ curl -X POST http://api.example.com/api/version/create \ ```bash curl -X POST http://api.example.com/api/file/upload_version \ - -H "Authorization: Bearer your-token-here" \ + -H "Authorization: your-token-here" \ -F "file=@./dist/app-1.0.0.exe" \ -F "version=1.0.0" \ -F "platform=win32" \ diff --git a/api/middleware/job/aiService.js b/api/middleware/job/aiService.js index 90eca06..aebf587 100644 --- a/api/middleware/job/aiService.js +++ b/api/middleware/job/aiService.js @@ -42,7 +42,7 @@ class aiService { try { const response = await axios.post(this.apiUrl, requestData, { headers: { - 'Authorization': `Bearer ${this.apiKey}`, + 'Authorization': `${this.apiKey}`, 'Content-Type': 'application/json' }, timeout: 30000 diff --git a/api/services/ai_service.js b/api/services/ai_service.js index 1b7b676..4d66fed 100644 --- a/api/services/ai_service.js +++ b/api/services/ai_service.js @@ -18,7 +18,7 @@ class AIService { timeout: this.timeout, headers: { 'Content-Type': 'application/json', - 'Authorization': `Bearer ${this.apiKey}` + 'Authorization': `${this.apiKey}` } }); } diff --git a/config/framework.config.js b/config/framework.config.js index b4cad4d..71497e4 100644 --- a/config/framework.config.js +++ b/config/framework.config.js @@ -9,7 +9,7 @@ const customSchemas = require('./custom.schemas.js'); module.exports = { // ===== 必需配置 ===== env: process.env.NODE_ENV || 'development', - "project_key": "BallBookingMiniProgram", + "project_key": "autoAiWorkSys", // 数据库配置(必需) db: { username: baseConfig.db.username, @@ -68,7 +68,7 @@ module.exports = { // 基础 URL(根据环境区分) baseUrl: (() => { - const env = process.env.NODE_ENV || 'production'; + const env = process.env.NODE_ENV || 'development'; switch (env) { case 'production':