zhibo/模块文档/03-直播间弹幕模块.md
2025-12-30 11:11:11 +08:00

75 lines
1.2 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.

# 直播间弹幕模块接口文档
## 模块概述
直播间弹幕模块提供弹幕消息的发送和历史记录查询功能。
---
## 接口列表
### 1. 获取历史弹幕
**接口路径**: `GET /api/front/live/public/rooms/{roomId}/messages`
**请求参数**:
```
roomId: 房间ID (路径参数)
limit: 获取最近N条消息 (可选默认50)
```
**返回参数**:
```json
{
"code": 200,
"msg": "success",
"data": [
{
"id": "消息ID",
"userId": 用户ID,
"nickname": "用户昵称",
"avatar": "用户头像URL",
"content": "弹幕内容",
"type": "text",
"createTime": "2024-12-30T10:30:00"
}
]
}
```
---
### 2. 发送弹幕消息
**接口路径**: `POST /api/front/live/public/rooms/{roomId}/messages`
**请求头**:
```
Authorization: Bearer {token}
```
**请求参数**:
```json
{
"roomId": "房间ID",
"content": "弹幕内容",
"type": "text"
}
```
**返回参数**:
```json
{
"code": 200,
"msg": "success",
"data": {
"id": "消息ID",
"userId": 用户ID,
"nickname": "用户昵称",
"avatar": "用户头像URL",
"content": "弹幕内容",
"type": "text",
"createTime": "2024-12-30T10:30:00"
}
}
```