zhibo/android-app/后端接口TODO清单-作品管理.md

187 lines
3.3 KiB
Markdown
Raw 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.

# 后端接口 TODO 清单 - 作品管理模块
## 1. 获取用户作品列表
**文件**: `ProfileActivity.java`
**接口路径**: `GET /api/users/{userId}/works`
**请求参数**:
- userId: 用户ID路径参数从token中获取
- page (可选): 页码
- pageSize (可选): 每页数量
**返回数据**:
```json
{
"code": 200,
"data": [
{
"id": "string",
"title": "string",
"coverUrl": "string",
"likeCount": "number",
"viewCount": "number",
"publishTime": "number"
}
]
}
```
## 2. 获取用户收藏列表
**文件**: `ProfileActivity.java`
**接口路径**: `GET /api/users/{userId}/favorites`
**请求参数**: 同上
**返回数据**: 同上
## 3. 获取用户赞过的作品列表
**文件**: `ProfileActivity.java`
**接口路径**: `GET /api/users/{userId}/liked`
**请求参数**: 同上
**返回数据**: 同上
## 4. 发布作品
**文件**: `ProfileActivity.java`, `PublishWorkActivity.java`
**接口路径**: `POST /api/works`
**请求参数**:
```json
{
"userId": "string",
"title": "string",
"description": "string",
"coverUrl": "string",
"videoUrl": "string",
"images": ["string"]
}
```
**返回数据**:
```json
{
"code": 200,
"data": {
"id": "string",
"title": "string",
"coverUrl": "string",
"likeCount": "number",
"viewCount": "number",
"publishTime": "number"
}
}
```
## 5. 上传作品图片/视频
**文件**: `PublishWorkActivity.java`
**接口路径**: `POST /api/upload/work`
**请求参数**: multipart/form-data
- file: 图片或视频文件
**返回数据**:
```json
{
"code": 200,
"data": {
"url": "string"
}
}
```
## 6. 获取作品详情
**文件**: `WorkDetailActivity.java`
**接口路径**: `GET /api/works/{workId}`
**请求参数**: workId (路径参数)
**返回数据**:
```json
{
"code": 200,
"data": {
"id": "string",
"title": "string",
"description": "string",
"coverUrl": "string",
"videoUrl": "string",
"imageUrls": ["string"],
"likeCount": "number",
"viewCount": "number",
"commentCount": "number",
"publishTime": "number",
"author": {
"userId": "string",
"username": "string",
"avatarUrl": "string"
}
}
}
```
## 7. 点赞/取消点赞作品
**文件**: `WorkDetailActivity.java`
**接口路径**: `POST /api/works/{workId}/like`
**请求参数**:
```json
{
"workId": "string",
"action": "like|unlike"
}
```
**返回数据**:
```json
{
"code": 200,
"data": {
"success": true,
"likeCount": "number"
}
}
```
## 8. 收藏/取消收藏作品
**文件**: `WorkDetailActivity.java`
**接口路径**: `POST /api/works/{workId}/favorite`
**请求参数**:
```json
{
"workId": "string",
"action": "favorite|unfavorite"
}
```
**返回数据**:
```json
{
"code": 200,
"data": {
"success": true
}
}
```
## 9. 删除作品
**文件**: `WorkDetailActivity.java`
**接口路径**: `DELETE /api/works/{workId}`
**请求参数**: workId (路径参数)
**返回数据**:
```json
{
"code": 200,
"data": {
"success": true
}
}
```
## 10. 编辑作品
**文件**: `WorkDetailActivity.java`
**接口路径**: `PUT /api/works/{workId}`
**请求参数**:
```json
{
"workId": "string",
"title": "string",
"description": "string"
}
```
**返回数据**:
```json
{
"code": 200,
"data": {
"success": true
}
}
```