1
This commit is contained in:
@@ -99,7 +99,7 @@ module.exports = {
|
|||||||
- **请求头**:
|
- **请求头**:
|
||||||
```
|
```
|
||||||
Content-Type: application/json
|
Content-Type: application/json
|
||||||
Authorization: Bearer ${token}
|
Authorization: ${token}
|
||||||
```
|
```
|
||||||
- **请求参数**:
|
- **请求参数**:
|
||||||
```json
|
```json
|
||||||
@@ -157,7 +157,7 @@ module.exports = {
|
|||||||
- **请求头**:
|
- **请求头**:
|
||||||
```
|
```
|
||||||
Content-Type: multipart/form-data
|
Content-Type: multipart/form-data
|
||||||
Authorization: Bearer ${token}
|
Authorization: ${token}
|
||||||
```
|
```
|
||||||
- **请求参数**(Form Data):
|
- **请求参数**(Form Data):
|
||||||
| 参数名 | 类型 | 必填 | 说明 |
|
| 参数名 | 类型 | 必填 | 说明 |
|
||||||
@@ -187,7 +187,7 @@ module.exports = {
|
|||||||
// 发送请求
|
// 发送请求
|
||||||
form.submit('http://api.example.com/api/file/upload_version', {
|
form.submit('http://api.example.com/api/file/upload_version', {
|
||||||
headers: {
|
headers: {
|
||||||
'Authorization': `Bearer ${token}`
|
'Authorization': `${token}`
|
||||||
}
|
}
|
||||||
}, callback);
|
}, callback);
|
||||||
```
|
```
|
||||||
@@ -224,7 +224,7 @@ module.exports = {
|
|||||||
- **请求头**:
|
- **请求头**:
|
||||||
```
|
```
|
||||||
Content-Type: application/json
|
Content-Type: application/json
|
||||||
Authorization: Bearer ${token}
|
Authorization: ${token}
|
||||||
```
|
```
|
||||||
- **请求参数**:
|
- **请求参数**:
|
||||||
```json
|
```json
|
||||||
@@ -290,8 +290,8 @@ module.exports = {
|
|||||||
|
|
||||||
1. **Token 配置**
|
1. **Token 配置**
|
||||||
- 确保 `config/appConfig.js` 中有有效的 `token`
|
- 确保 `config/appConfig.js` 中有有效的 `token`
|
||||||
- Token 用于 API 认证,格式为 `Bearer ${token}`
|
- Token 用于 API 认证,格式为 `${token}`
|
||||||
- 所有接口请求都需要在请求头中包含 `Authorization: Bearer ${token}`
|
- 所有接口请求都需要在请求头中包含 `Authorization: ${token}`
|
||||||
|
|
||||||
2. **接口路径**
|
2. **接口路径**
|
||||||
- 所有接口路径前缀为 `/api`
|
- 所有接口路径前缀为 `/api`
|
||||||
@@ -432,7 +432,7 @@ async function createVersion() {
|
|||||||
status: 1
|
status: 1
|
||||||
}, {
|
}, {
|
||||||
headers: {
|
headers: {
|
||||||
'Authorization': `Bearer ${token}`,
|
'Authorization': `${token}`,
|
||||||
'Content-Type': 'application/json'
|
'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, {
|
const response = await axios.post('http://api.example.com/api/file/upload_version', form, {
|
||||||
headers: {
|
headers: {
|
||||||
'Authorization': `Bearer ${token}`,
|
'Authorization': `${token}`,
|
||||||
...form.getHeaders()
|
...form.getHeaders()
|
||||||
},
|
},
|
||||||
maxContentLength: Infinity,
|
maxContentLength: Infinity,
|
||||||
@@ -494,7 +494,7 @@ async function updateVersionDownloadUrl(versionId, downloadUrl, fileHash) {
|
|||||||
file_hash: fileHash
|
file_hash: fileHash
|
||||||
}, {
|
}, {
|
||||||
headers: {
|
headers: {
|
||||||
'Authorization': `Bearer ${token}`,
|
'Authorization': `${token}`,
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -536,7 +536,7 @@ async function publishVersion() {
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl -X POST http://api.example.com/api/version/create \
|
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" \
|
-H "Content-Type: application/json" \
|
||||||
-d '{
|
-d '{
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
@@ -556,7 +556,7 @@ curl -X POST http://api.example.com/api/version/create \
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl -X POST http://api.example.com/api/file/upload_version \
|
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 "file=@./dist/app-1.0.0.exe" \
|
||||||
-F "version=1.0.0" \
|
-F "version=1.0.0" \
|
||||||
-F "platform=win32" \
|
-F "platform=win32" \
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ class aiService {
|
|||||||
try {
|
try {
|
||||||
const response = await axios.post(this.apiUrl, requestData, {
|
const response = await axios.post(this.apiUrl, requestData, {
|
||||||
headers: {
|
headers: {
|
||||||
'Authorization': `Bearer ${this.apiKey}`,
|
'Authorization': `${this.apiKey}`,
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
},
|
},
|
||||||
timeout: 30000
|
timeout: 30000
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class AIService {
|
|||||||
timeout: this.timeout,
|
timeout: this.timeout,
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Authorization': `Bearer ${this.apiKey}`
|
'Authorization': `${this.apiKey}`
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ const customSchemas = require('./custom.schemas.js');
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
// ===== 必需配置 =====
|
// ===== 必需配置 =====
|
||||||
env: process.env.NODE_ENV || 'development',
|
env: process.env.NODE_ENV || 'development',
|
||||||
"project_key": "BallBookingMiniProgram",
|
"project_key": "autoAiWorkSys",
|
||||||
// 数据库配置(必需)
|
// 数据库配置(必需)
|
||||||
db: {
|
db: {
|
||||||
username: baseConfig.db.username,
|
username: baseConfig.db.username,
|
||||||
@@ -68,7 +68,7 @@ module.exports = {
|
|||||||
|
|
||||||
// 基础 URL(根据环境区分)
|
// 基础 URL(根据环境区分)
|
||||||
baseUrl: (() => {
|
baseUrl: (() => {
|
||||||
const env = process.env.NODE_ENV || 'production';
|
const env = process.env.NODE_ENV || 'development';
|
||||||
|
|
||||||
switch (env) {
|
switch (env) {
|
||||||
case 'production':
|
case 'production':
|
||||||
|
|||||||
Reference in New Issue
Block a user