zhibo/android-app/后端接口TODO清单-用户资料.md

74 lines
1.6 KiB
Markdown
Raw Permalink 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}/profile`
**请求参数**: userId (路径参数从token中获取)
**返回数据**:
```json
{
"code": 200,
"data": {
"id": "string",
"name": "string",
"avatarUrl": "string",
"bio": "string",
"level": "number",
"badge": "string",
"birthday": "string",
"gender": "string",
"location": "string",
"followingCount": "number",
"fansCount": "number",
"likesCount": "number"
}
}
```
## 2. 更新用户资料
**文件**: `ProfileActivity.java`, `EditProfileActivity.java`
**接口路径**: `PUT /api/users/{userId}/profile`
**请求参数**:
```json
{
"name": "string", // 昵称(可选)
"bio": "string", // 个人签名(可选)
"avatarUrl": "string", // 头像URL可选
"birthday": "string", // 生日(可选)
"gender": "string", // 性别(可选)
"location": "string" // 所在地(可选)
}
```
**返回数据**: 同获取用户资料接口
## 3. 上传头像
**文件**: `EditProfileActivity.java`
**接口路径**: `POST /api/upload/avatar`
**请求参数**: multipart/form-data
- file: 图片文件
**返回数据**:
```json
{
"code": 200,
"data": {
"url": "string" // 上传后的图片URL
}
}
```
## 4. 获取用户统计数据
**文件**: `ProfileActivity.java`
**接口路径**: `GET /api/users/{userId}/stats`
**请求参数**: userId (路径参数)
**返回数据**:
```json
{
"code": 200,
"data": {
"followingCount": "number",
"fansCount": "number",
"likesCount": "number"
}
}
```