Skip to content

一起听状态 ​

查询当前登录账号是否在一起听房间中,以及房间内的成员信息。

接口信息 ​

项目值
接口地址/listentogether/status
请求方式GET / POST
需要登录是
对应模块listentogether_status
文档分类一起听
上游路径/api/listen/together/status/get

请求参数 ​

无需业务参数。

HTTP 示例 ​

bash
GET /listentogether/status

编程式调用 ​

ts
import { listentogetherStatus } from 'hana-music-api';

const result = await listentogetherStatus();

console.log(result.body);

返回内容 ​

body.code、通到状态的 body.data 和接口就是为了拿的 body.data.inRoom 收紧;data.anotherFollowStatus 宽松;data.roomInfo、data.anotherDeviceInfo 和 data.status 在录制里只见过 null,未声明并原样保留。结构定义和类型是 ListentogetherStatusBody,见 返回体结构。

返回关注点 ​

  • data.inRoom: 当前账号是否在一起听房间中。
  • data.roomInfo: 当前房间信息。
  • data.roomInfo.roomUsers: 房间成员列表;上游示例页会直接用它渲染在线用户头像和昵称。

调用场景 ​

  • 房主或从机刷新当前房间状态。
  • 页面初始化时判断是否需要恢复房间 UI。
  • 轮询房间成员变化。

补充说明 ​

  • 如果 data.inRoom 为 false,通常意味着需要重新创建房间或重新接受邀请。

相关接口 ​

Released under the MIT License.