zhibo/android-app/后端接口TODO清单-礼物打赏.md

105 lines
1.8 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. 获取礼物列表
**文件**: `RoomDetailActivity.java`
**接口路径**: `GET /api/gifts`
**返回数据**:
```json
{
"code": 200,
"data": [
{
"id": "string",
"name": "string",
"price": "number",
"iconUrl": "string",
"description": "string",
"level": "number"
}
]
}
```
## 2. 获取用户金币余额
**文件**: `RoomDetailActivity.java`
**接口路径**: `GET /api/user/balance`
**请求参数**: userId从token中获取
**返回数据**:
```json
{
"code": 200,
"data": {
"coinBalance": "number"
}
}
```
## 3. 赠送礼物
**文件**: `RoomDetailActivity.java`
**接口路径**: `POST /api/gifts/send`
**请求参数**:
```json
{
"roomId": "string",
"streamerId": "string",
"giftId": "string",
"count": "number"
}
```
**返回数据**:
```json
{
"code": 200,
"data": {
"success": true,
"newBalance": "number",
"message": "string"
}
}
```
## 4. 获取充值选项列表
**文件**: `RoomDetailActivity.java`
**接口路径**: `GET /api/recharge/options`
**返回数据**:
```json
{
"code": 200,
"data": [
{
"id": "string",
"coinAmount": "number",
"price": "number",
"discountLabel": "string"
}
]
}
```
## 5. 发起充值请求
**文件**: `RoomDetailActivity.java`
**接口路径**: `POST /api/recharge/create`
**请求参数**:
```json
{
"optionId": "string",
"coinAmount": "number",
"price": "number"
}
```
**返回数据**:
```json
{
"code": 200,
"data": {
"orderId": "string",
"paymentUrl": "string"
}
}
```
**后续步骤**:
1. 集成支付SDK微信支付、支付宝等
2. 调用支付SDK发起支付
3. 监听支付结果回调
4. 支付成功后更新用户金币余额