# 内容模块（文章/视频）

控制层 TypechoContentsController @author buxia97 @date 2021/11/29

**类路径**：`ContentsController`
**前缀**：`/typechoContents`

## 1. contentsInfo

**接口路径**：`GET/POST /typechoContents/contentsInfo`

**权限**：公开接口，不校验 token

**接口说明**：查询文章详情

**请求参数**：

| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|--------|------|------|--------|------|
| key | String | 否 | - |  |
| isMd | Integer | 否 | 0 |  |
| token | String | 否 | - |  |

**响应说明**：
```json
{
  "code": 1,
  "msg": "",
  "data": ...
}
```

**前端调用参考**：
- 前端调用：this.$API.getContentsInfo()  （https://api.ruletree.club/typechoContents/contentsInfo）

---

## 2. contentsList

**接口路径**：`GET/POST /typechoContents/contentsList`

**权限**：公开接口；但当系统配置 isLogin=1 时会强制要求登录

**接口说明**：表单查询请求 @param searchParams Bean对象JSON字符串 @param page         页码 @param limit        每页显示数量

**请求参数**：

| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|--------|------|------|--------|------|
| searchParams | String（JSON 字符串，需后端解析） | 否 | - | JSON 字符串，需后端解析 |
| page | Integer | 否 | 1 |  |
| limit | Integer | 否 | 15 |  |
| searchKey | String | 否 | - |  |
| order | String | 否 | - |  |
| random | Integer | 否 | 0 |  |
| token | String | 否 | - |  |

**响应说明**：
```json
{
  "code": 1,
  "msg": "",
  "data": ...
}
```

**前端调用参考**：
- 前端调用：this.$API.getContentsList()  （https://api.ruletree.club/typechoContents/contentsList）

---

## 3. contentsAdd

**接口路径**：`GET/POST /typechoContents/contentsAdd`

**权限**：需要登录（普通用户及以上）

**接口说明**：发布文章 @param params Bean对象JSON字符串

**请求参数**：

| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|--------|------|------|--------|------|
| params | String（JSON 字符串，需后端解析） | 否 | - | JSON 字符串，需后端解析 |
| token | String | 否 | - |  |
| text | String | 否 | - |  |
| isMd | Integer | 否 | 1 |  |
| isSpace | Integer | 否 | 0 |  |
| isDraft | Integer | 否 | 0 |  |
| isPaid | Integer | 否 | 0 |  |
| shopPice | String | 否 | 0.00 |  |
| shopText | String | 否 | - |  |
| shopDiscount | String | 否 | 1.0 |  |
| unlockMode | Integer | 否 | 0 |  |
| adNum | Integer | 否 | 1 |  |
| verifyCode | String | 否 | - |  |

**响应说明**：
```json
{
  "code": 1,
  "msg": "",
  "data": ...
}
```

**前端调用参考**：
- 前端调用：this.$API.contentsAdd()  （https://api.ruletree.club/typechoContents/contentsAdd）

---

## 4. contentsUpdate

**接口路径**：`GET/POST /typechoContents/contentsUpdate`

**权限**：需要登录（普通用户及以上）

**接口说明**：文章修改 @param params Bean对象JSON字符串

**请求参数**：

| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|--------|------|------|--------|------|
| params | String（JSON 字符串，需后端解析） | 否 | - | JSON 字符串，需后端解析 |
| token | String | 否 | - |  |
| text | String | 否 | - |  |
| isDraft | Integer | 否 | 0 |  |
| isMd | Integer | 否 | 1 |  |
| isPaid | Integer | 否 | 0 |  |
| shopPice | String | 否 | 0.00 |  |
| shopText | String | 否 | - |  |
| shopDiscount | String | 否 | 1.0 |  |
| unlockMode | Integer | 否 | 0 |  |
| adNum | Integer | 否 | 1 |  |

**响应说明**：
```json
{
  "code": 1,
  "msg": "",
  "data": ...
}
```

**前端调用参考**：
- 前端调用：this.$API.contentsUpdate()  （https://api.ruletree.club/typechoContents/contentsUpdate）

---

## 5. formDelete

**接口路径**：`GET/POST /typechoContents/contentsDelete`

**权限**：需要登录（普通用户及以上）

**接口说明**：文章删除

**请求参数**：

| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|--------|------|------|--------|------|
| key | String | 否 | - |  |
| token | String | 否 | - |  |

**响应说明**：
```json
{
  "code": 1,
  "msg": "",
  "data": ...
}
```

**前端调用参考**：
- 前端调用：this.$API.contentsDelete()  （https://api.ruletree.club/typechoContents/contentsDelete）

---

## 6. contentsAudit

**接口路径**：`GET/POST /typechoContents/contentsAudit`

**权限**：需要登录（普通用户及以上）

**接口说明**：文章审核

**请求参数**：

| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|--------|------|------|--------|------|
| key | String | 否 | - |  |
| token | String | 否 | - |  |
| type | Integer | 否 | 0 |  |
| reason | String | 否 | - |  |

**响应说明**：
```json
{
  "code": 1,
  "msg": "",
  "data": ...
}
```

**前端调用参考**：
- 前端调用：this.$API.contentsAudit()  （https://api.ruletree.club/typechoContents/contentsAudit）

---

## 7. setFields

**接口路径**：`GET/POST /typechoContents/setFields`

**权限**：需要登录（普通用户及以上）

**接口说明**：文章自定义字段设置

**请求参数**：

| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|--------|------|------|--------|------|
| cid | Integer | 否 | - |  |
| name | String | 否 | - |  |
| strvalue | String | 否 | - |  |
| token | String | 否 | - |  |

**响应说明**：
```json
{
  "code": 1,
  "msg": "",
  "data": ...
}
```

**前端调用参考**：
- 前端调用：this.$API.setFields()  （https://api.ruletree.club/typechoContents/setFields）

---

## 8. addRecommend

**接口路径**：`GET/POST /typechoContents/toRecommend`

**权限**：需要管理员或编辑权限

**接口说明**：文章推荐&加精

**请求参数**：

| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|--------|------|------|--------|------|
| key | String | 否 | - |  |
| recommend | Integer | 否 | - |  |
| token | String | 否 | - |  |

**响应说明**：
```json
{
  "code": 1,
  "msg": "",
  "data": ...
}
```

**前端调用参考**：
- 前端调用：this.$API.toRecommend()  （https://api.ruletree.club/typechoContents/toRecommend）

---

## 9. addTop

**接口路径**：`GET/POST /typechoContents/addTop`

**权限**：需要管理员或编辑权限

**接口说明**：文章置顶

**请求参数**：

| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|--------|------|------|--------|------|
| key | String | 否 | - |  |
| istop | Integer | 否 | - |  |
| token | String | 否 | - |  |

**响应说明**：
```json
{
  "code": 1,
  "msg": "",
  "data": ...
}
```

**前端调用参考**：
- 前端调用：this.$API.contentsAdd()  （https://api.ruletree.club/typechoContents/contentsAdd）
- 前端调用：this.$API.toTop()  （https://api.ruletree.club/typechoContents/addTop）

---

## 10. addSwiper

**接口路径**：`GET/POST /typechoContents/addSwiper`

**权限**：需要管理员或编辑权限

**接口说明**：文章轮播（兼容旧版APP，后续新版不通过此渠道）

**请求参数**：

| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|--------|------|------|--------|------|
| key | String | 否 | - |  |
| isswiper | Integer | 否 | - |  |
| token | String | 否 | - |  |

**响应说明**：
```json
{
  "code": 1,
  "msg": "",
  "data": ...
}
```

**前端调用参考**：
- 前端调用：this.$API.contentsAdd()  （https://api.ruletree.club/typechoContents/contentsAdd）
- 前端调用：this.$API.toSwiper()  （https://api.ruletree.club/typechoContents/addSwiper）

---

## 11. isCommnet

**接口路径**：`GET/POST /typechoContents/isCommnet`

**权限**：需要登录（普通用户及以上）

**接口说明**：文章是否评论过（用于回复可见）

**请求参数**：

| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|--------|------|------|--------|------|
| key | String | 否 | - |  |
| token | String | 否 | - |  |

**响应说明**：
```json
{
  "code": 1,
  "msg": "",
  "data": ...
}
```

**前端调用参考**：
- 前端调用：this.$API.isCommnet()  （https://api.ruletree.club/typechoContents/isCommnet）

---

## 12. ImagePexels

**接口路径**：`GET/POST /typechoContents/ImagePexels`

**权限**：公开接口；但当系统配置 isLogin=1 时会强制要求登录

**接口说明**：pexels图库

**请求参数**：

| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|--------|------|------|--------|------|
| page | Integer | 否 | 1 |  |
| searchKey | String | 否 | - |  |

**响应说明**：
```json
{
  "code": 1,
  "msg": "",
  "data": ...
}
```

**前端调用参考**：
- 前端调用：this.$API.contentsImage()  （https://api.ruletree.club/typechoContents/ImagePexels）

---

## 13. rewardList

**接口路径**：`GET/POST /typechoContents/rewardList`

**权限**：公开接口；但当系统配置 isLogin=1 时会强制要求登录

**接口说明**：文章打赏者列表

**请求参数**：

| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|--------|------|------|--------|------|
| page | Integer | 否 | 1 |  |
| limit | Integer | 否 | 15 |  |
| id | Integer | 否 | - |  |

**响应说明**：
```json
{
  "code": 1,
  "msg": "",
  "data": ...
}
```

**前端调用参考**：
- 前端调用：this.$API.rewardList()  （https://api.ruletree.club/typechoContents/rewardList）

---

## 14. foreverblog

**接口路径**：`GET/POST /typechoContents/foreverblog`

**权限**：公开接口；但当系统配置 isLogin=1 时会强制要求登录

**接口说明**：十年之约 https://www.foreverblog.cn/

**请求参数**：

| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|--------|------|------|--------|------|
| page | String | 否 | - |  |

**响应说明**：
```json
{
  "code": 1,
  "msg": "",
  "data": ...
}
```

**前端调用参考**：
- 前端调用：this.$API.getForeverblog()  （https://api.ruletree.club/typechoContents/foreverblog）

---

## 15. contentConfig

**接口路径**：`GET/POST /typechoContents/contentConfig`

**权限**：公开接口；但当系统配置 isLogin=1 时会强制要求登录

**接口说明**：注册系统配置信息

**请求参数**：

无请求参数

**响应说明**：
```json
{
  "code": 1,
  "msg": "",
  "data": ...
}
```

**前端调用参考**：
- 前端调用：this.$API.contentConfig()  （https://api.ruletree.club/typechoContents/contentConfig）

---

## 16. allData

**接口路径**：`GET/POST /typechoContents/allData`

**权限**：需要管理员或编辑权限

**接口说明**：全站统计

**请求参数**：

| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|--------|------|------|--------|------|
| token | String | 否 | - |  |

**响应说明**：
```json
{
  "code": 1,
  "msg": "",
  "data": ...
}
```

**前端调用参考**：
- 前端调用：this.$API.allData()  （https://api.ruletree.club/typechoContents/allData）

---

## 17. followSpace

**接口路径**：`GET/POST /typechoContents/followContents`

**权限**：需要登录（普通用户及以上）

**接口说明**：我关注的人的文章

**请求参数**：

| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|--------|------|------|--------|------|
| token | String | 否 | - |  |
| page | Integer | 否 | 1 |  |
| limit | Integer | 否 | 15 |  |

**响应说明**：
```json
{
  "code": 1,
  "msg": "",
  "data": ...
}
```

**前端调用参考**：
- 前端调用：this.$API.follow()  （https://api.ruletree.club/typechoUsers/follow）
- 前端调用：this.$API.followContents()  （https://api.ruletree.club/typechoContents/followContents）

---

## 18. getDocx

**接口路径**：`GET/POST /typechoContents/getDocx`

**权限**：需要超级管理员权限

**接口说明**：我关注的人的文章

**请求参数**：

| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|--------|------|------|--------|------|
| token | String | 否 | - |  |
| cid | String | 否 | - |  |

**响应说明**：
```json
{
  "code": 1,
  "msg": "",
  "data": ...
}
```

**前端调用参考**：
- 前端调用：this.$API.getDocx()  （https://api.ruletree.club/typechoContents/getDocx）

---

## 19. userTextBlockStatus

**接口路径**：`GET/POST /typechoContents/userTextBlockStatus`

**权限**：需要登录（普通用户及以上）

**接口说明**：用户自己检测文章是否违规

**请求参数**：

| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|--------|------|------|--------|------|
| text | String | 否 | - |  |
| token | String | 否 | - |  |

**响应说明**：
```json
{
  "code": 1,
  "msg": "",
  "data": ...
}
```

---

## 20. videoFeed

**接口路径**：`GET/POST /typechoContents/videoFeed`

**权限**：公开接口；但当系统配置 isLogin=1 时会强制要求登录

**接口说明**：视频推送接口，类似抖音

**请求参数**：

| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|--------|------|------|--------|------|
| lastTime | Long | 否 | - |  |
| cid | Integer | 否 | - |  |
| direction | String | 否 | down |  |
| limit | Integer | 否 | 10 |  |
| token | String | 否 | - |  |

**响应说明**：
```json
{
  "code": 1,
  "msg": "",
  "data": ...
}
```

**前端调用参考**：
- 前端调用：this.$API.videoFeed()  （https://api.ruletree.club/typechoContents/videoFeed）

---

## 21. videoList

**接口路径**：`GET/POST /typechoContents/videoList`

**权限**：公开接口；但当系统配置 isLogin=1 时会强制要求登录

**接口说明**：视频分页接口

**请求参数**：

| 参数名 | 类型 | 必填 | 默认值 | 说明 |
|--------|------|------|--------|------|
| page | Integer | 否 | 1 |  |
| limit | Integer | 否 | 10 |  |
| token | String | 否 | - |  |

**响应说明**：
```json
{
  "code": 1,
  "msg": "",
  "data": ...
}
```

---
