# 文件上传模块

文件上传控制器 提供本地和cos上传，之后的接口支持都加在这里

**类路径**：`UploadController`
**前缀**：`/upload`

## 1. full

**接口路径**：`POST /upload/full`

**权限**：需要登录（普通用户及以上）

**接口说明**：通用上传接口 除这个接口外，其它接口都是为了兼容旧版

**请求参数**：

| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|--------|------|------|--------|------|
| file | MultipartFile（文件上传） | 否 | - | 文件上传 |
| token | String | 否 | - |  |

**响应说明**：
```json
{
  "code": 1,
  "msg": "",
  "data": ...
}
```

**前端调用参考**：
- 前端调用：this.$API.upload()  （https://api.ruletree.club/upload/full）

---

## 2. cosUpload

**接口路径**：`POST /upload/cosUpload`

**权限**：需要登录（普通用户及以上）

**接口说明**：上传cos @return

**请求参数**：

| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|--------|------|------|--------|------|
| file | MultipartFile（文件上传） | 否 | - | 文件上传 |
| token | String | 否 | - |  |

**响应说明**：
```json
{
  "code": 1,
  "msg": "",
  "data": ...
}
```

**前端调用参考**：
- 前端调用：this.$API.upload()  （https://api.ruletree.club/upload/full）

---

## 3. localUpload

**接口路径**：`POST /upload/localUpload`

**权限**：需要登录（普通用户及以上）

**接口说明**：上传到本地

**请求参数**：

| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|--------|------|------|--------|------|
| file | MultipartFile（文件上传） | 否 | - | 文件上传 |
| token | String | 否 | - |  |

**响应说明**：
```json
{
  "code": 1,
  "msg": "",
  "data": ...
}
```

**前端调用参考**：
- 前端调用：this.$API.upload()  （https://api.ruletree.club/upload/full）

---

## 4. ossUpload

**接口路径**：`POST /upload/ossUpload`

**权限**：需要登录（普通用户及以上）

**接口说明**：上传到oss

**请求参数**：

| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|--------|------|------|--------|------|
| file | MultipartFile（文件上传） | 否 | - | 文件上传 |
| token | String | 否 | - |  |

**响应说明**：
```json
{
  "code": 1,
  "msg": "",
  "data": ...
}
```

**前端调用参考**：
- 前端调用：this.$API.upload()  （https://api.ruletree.club/upload/full）

---

## 5. qiniuUpload

**接口路径**：`POST /upload/qiniuUpload`

**权限**：需要登录（普通用户及以上）

**接口说明**：上传到七牛云

**请求参数**：

| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|--------|------|------|--------|------|
| file | MultipartFile（文件上传） | 否 | - | 文件上传 |
| token | String | 否 | - |  |

**响应说明**：
```json
{
  "code": 1,
  "msg": "",
  "data": ...
}
```

**前端调用参考**：
- 前端调用：this.$API.upload()  （https://api.ruletree.club/upload/full）

---

## 6. ftpUpload

**接口路径**：`POST /upload/ftpUpload`

**权限**：需要登录（普通用户及以上）

**接口说明**：上传到远程ftp

**请求参数**：

| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|--------|------|------|--------|------|
| file | MultipartFile（文件上传） | 否 | - | 文件上传 |
| token | String | 否 | - |  |

**响应说明**：
```json
{
  "code": 1,
  "msg": "",
  "data": ...
}
```

**前端调用参考**：
- 前端调用：this.$API.upload()  （https://api.ruletree.club/upload/full）

---

## 7. s3Upload

**接口路径**：`POST /upload/s3Upload`

**权限**：需要登录（普通用户及以上）

**接口说明**：上传到oss

**请求参数**：

| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|--------|------|------|--------|------|
| file | MultipartFile（文件上传） | 否 | - | 文件上传 |
| token | String | 否 | - |  |

**响应说明**：
```json
{
  "code": 1,
  "msg": "",
  "data": ...
}
```

**前端调用参考**：
- 前端调用：this.$API.upload()  （https://api.ruletree.club/upload/full）

---

## 8. fileList

**接口路径**：`GET/POST /upload/fileList`

**权限**：公开接口；但当系统配置 isLogin=1 时会强制要求登录

**接口说明**：文件列表

**请求参数**：

| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|--------|------|------|--------|------|
| searchParams | String（JSON 字符串，需后端解析） | 否 | - | JSON 字符串，需后端解析 |
| searchKey | String | 否 | - |  |
| page | Integer | 否 | 1 |  |
| order | String | 否 | created |  |
| limit | Integer | 否 | 15 |  |

**响应说明**：
```json
{
  "code": 1,
  "msg": "",
  "data": ...
}
```

**前端调用参考**：
- 前端调用：this.$API.upload()  （https://api.ruletree.club/upload/full）

---

## 9. fileDelete

**接口路径**：`GET/POST /upload/fileDelete`

**权限**：需要超级管理员权限

**接口说明**：删除文件记录（仅删除数据库记录，不删除物理文件）

**请求参数**：

| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|--------|------|------|--------|------|
| id | Integer | 否 | - |  |
| token | String | 否 | - |  |

**响应说明**：
```json
{
  "code": 1,
  "msg": "",
  "data": ...
}
```

**前端调用参考**：
- 前端调用：this.$API.upload()  （https://api.ruletree.club/upload/full）

---

## 10. uploadChunk

**接口路径**：`POST /upload/chunk`

**权限**：需要登录（普通用户及以上）

**接口说明**：将 MultipartFile 转换为 File @param file @return @throws IOException

**请求参数**：

| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|--------|------|------|--------|------|
| uploadId | String | 否 | - |  |
| index | Integer | 否 | - |  |
| total | Integer | 否 | - |  |
| file | MultipartFile（文件上传） | 否 | - | 文件上传 |
| 上传 | H5 | 否 | - |  |
| chunk | String | 否 | - |  |
| base64 | 小程序 | 否 | - |  |
| token | String | 否 | - |  |

**响应说明**：
```json
{
  "code": 1,
  "msg": "",
  "data": ...
}
```

**前端调用参考**：
- 前端调用：this.$API.upload()  （https://api.ruletree.club/upload/full）
- 前端调用：this.$API.uploadChunk()  （https://api.ruletree.club/upload/chunk）

---

## 11. mergeChunks

**接口路径**：`POST /upload/merge`

**权限**：需要登录（普通用户及以上）

**接口说明**：将 MultipartFile 转换为 File @param file @return @throws IOException

**请求参数**：

| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|--------|------|------|--------|------|
| uploadId | String | 否 | - |  |
| filename | String | 否 | - |  |
| total | Integer | 否 | - |  |
| token | String | 否 | - |  |

**响应说明**：
```json
{
  "code": 1,
  "msg": "",
  "data": ...
}
```

**前端调用参考**：
- 前端调用：this.$API.upload()  （https://api.ruletree.club/upload/full）
- 前端调用：this.$API.uploadMerge()  （https://api.ruletree.club/upload/merge）

---
