zhibo/android-app/后端接口TODO清单-评论功能.md

89 lines
1.5 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. 获取作品评论列表
**文件**: `WorkDetailActivity.java`
**接口路径**: `GET /api/works/{workId}/comments`
**请求参数**:
- workId: 作品ID路径参数
- page (可选): 页码
- pageSize (可选): 每页数量默认20
**返回数据**:
```json
{
"code": 200,
"data": [
{
"commentId": "string",
"userId": "string",
"username": "string",
"avatarUrl": "string",
"content": "string",
"likeCount": "number",
"createTime": "number"
}
]
}
```
## 2. 发表评论
**文件**: `WorkDetailActivity.java`
**接口路径**: `POST /api/works/{workId}/comments`
**请求参数**:
```json
{
"workId": "string",
"content": "string",
"userId": "string"
}
```
**返回数据**:
```json
{
"code": 200,
"data": {
"commentId": "string",
"userId": "string",
"username": "string",
"avatarUrl": "string",
"content": "string",
"likeCount": 0,
"createTime": "number"
}
}
```
## 3. 删除评论
**文件**: `WorkDetailActivity.java`
**接口路径**: `DELETE /api/comments/{commentId}`
**请求参数**: commentId (路径参数)
**返回数据**:
```json
{
"code": 200,
"data": {
"success": true
}
}
```
## 4. 点赞评论
**文件**: `WorkDetailActivity.java`
**接口路径**: `POST /api/comments/{commentId}/like`
**请求参数**:
```json
{
"commentId": "string",
"action": "like|unlike"
}
```
**返回数据**:
```json
{
"code": 200,
"data": {
"success": true,
"likeCount": "number"
}
}
```