Table of Contents
15.2 粉丝端聊天偶像列表【基础探测通过,待数据联调】
GET /tieup/api/v1/me/artist-chats
查询参数:
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
page |
integer | 否 | 页码,默认 1 |
page_size |
integer | 否 | 每页数量,默认 20 |
鉴权:需要 Authorization: Bearer <access_token>。
数据来自本地 tieup_subscription 订阅历史、tieup_artist_im_group 超级群配置和 tieup_im_message_stat 消息元数据,不调用融云远程查询群列表。列表按当前粉丝历史订阅过的艺人去重返回:刚订阅且尚无消息的艺人群会返回;订阅已到期的艺人群也会返回,但最后消息、历史消息和未读数只统计该粉丝订阅有效区间内的可见消息。
可见消息范围:
- 粉丝向艺人的定向消息:
direction=1且fan_user_id=当前粉丝。 - 艺人向粉丝的定向消息:
direction=2且fan_user_id=当前粉丝。 - 艺人超级群普通群发:
direction=3。 - 不包含其他粉丝向同一艺人的定向消息。
- 最后消息允许
send_status=1的正常消息或send_status=3的撤回消息,且sent_at必须落在当前粉丝对该艺人的任一tieup_subscription.started_at ~ expires_at区间内;撤回消息保留原消息位置并返回空正文占位,不回退到更早的普通消息。未读数仍只统计发送成功且未撤回的消息;续约中间断档期间的消息不返回、不计未读。 - 当前粉丝身份已通过“用户侧删除 IM 消息”接口删除的消息不再参与最后消息、会话排序和未读数计算;同一账号的偶像端身份及其他用户不受影响。
响应字段:
| 字段 | 类型 | 说明 |
|---|---|---|
items |
array | 当前页数据列表 |
items[].artist_id |
integer | 艺人 ID |
items[].artist_name |
string | 艺人名称 |
items[].artist_avatar |
string | 艺人头像;优先来自艺人档案,未配置时回退绑定用户头像,两者均为空时返回空字符串 |
items[].artist_online_status |
integer | 艺人身份在线状态:0=离线,1=在线;只根据 tieup_artist_{artist_id} 融云身份计算 |
items[].rong_ultra_group_id |
string | 本地记录的融云超级群 ID;无本地群记录时为空字符串 |
items[].rong_channel_id |
string | 融云超级群频道 ID,默认频道为空字符串 |
items[].is_current_fan |
integer | 当前是否仍为有效订阅粉丝:1=是,2=否 |
items[].last_message |
object/null | 最后一条粉丝可见消息,字段格式与“粉丝端与偶像消息列表”一致;无可见消息时为 null |
items[].last_message.message_no |
string | 本地消息编号,用于已读、撤回等系统业务处理 |
items[].last_message.direction |
integer | 本地业务消息方向:1=粉丝发偶像,2=偶像定向回复粉丝,3=偶像普通群发 |
items[].last_message.conversationType |
integer | 融云超级群会话类型,当前固定返回 10 |
items[].last_message.targetId |
string | 融云群 ID,对应本地 rong_ultra_group_id |
items[].last_message.channelId |
string | 融云超级群频道 ID,无频道返回空字符串 |
items[].last_message.messageId |
integer | 本地消息表 ID |
items[].last_message.messageDirection |
integer | 粉丝视角消息方向:1=当前粉丝发送,2=当前粉丝接收 |
items[].last_message.senderUserId |
string | 发送者融云用户 ID,来自 tieup_im_user_bind.rong_user_id;绑定缺失时返回空字符串 |
items[].last_message.sentStatus |
integer | 融云发送状态:10=创建中,20=发送失败,30=发送成功或已撤回 |
items[].last_message.receivedTime |
integer | 接收时间,毫秒时间戳;无发送时间返回 0 |
items[].last_message.sentTime |
integer | 发送时间,毫秒时间戳;无发送时间返回 0 |
items[].last_message.objectName |
string | 当前消息融云 ObjectName,如 RC:TxtMsg、RC:ImgMsg;新版引用回复保持真实消息类型 |
items[].last_message.content |
object | 融云消息正文快照;媒体消息仅返回链接和必要元数据,不返回 Base64;消息已撤回时返回空对象 {} |
items[].last_message.content.content |
string | 仅文本消息返回文本正文;图片、语音、视频消息不返回该字段 |
items[].last_message.content.imageUri |
string | 图片消息原图 URL,仅 RC:ImgMsg 返回 |
items[].last_message.content.remoteUrl |
string | 语音消息 URL,仅 RC:HQVCMsg 返回 |
items[].last_message.content.sightUrl |
string | 视频消息 URL,仅 RC:SightMsg 返回 |
items[].last_message.content.duration |
integer | 语音或视频时长,单位秒 |
items[].last_message.content.size |
string | 视频文件大小,单位字节 |
items[].last_message.content.name |
string | 语音或视频原始文件名 |
items[].last_message.messageUId |
string | 融云服务端消息唯一 ID,无值返回空字符串 |
items[].last_message.canIncludeExpansion |
boolean | 存在扩展快照且消息发送成功、未撤回、具备融云 UID 时返回 true,否则返回 false |
items[].last_message.expansionDic |
object | 发送时扩展快照;普通粉丝消息在本地查询时批量覆盖当前画像和 replyCount,定向消息追加 is_read,群发消息追加 readCount、targetCount |
items[].last_message.expansionDic.readCount |
string | 仅群发消息提供,MySQL 与 Redis 实时人数的较大值,且不超过目标人数 |
items[].last_message.expansionDic.targetCount |
string | 仅群发消息提供,原群发消息目标人数 |
items[].last_message.directedUserIds |
array | 定向接收融云用户 ID 列表,无值返回空数组 |
items[].last_message.disableUpdateLastMessage |
boolean | 是否不更新最后一条消息,当前固定返回 false |
items[].last_message.quoteInfo |
object | 引用消息信息;无引用时返回空对象 {} |
items[].last_message.quoteInfo.messageUId |
string | 被引用消息融云 UID |
items[].last_message.quoteInfo.senderId |
string | 被引用消息发送者融云用户 ID |
items[].last_message.quoteInfo.objectName |
string | 被引用消息 ObjectName |
items[].last_message.quoteInfo.quoteMessageStatus |
integer | 被引用消息状态:0=正常,1=已撤回 |
items[].last_message.originMessage |
object | 当前粉丝可见的引用原消息展示信息;无引用、原消息缺失、不可见或已被当前粉丝身份删除时返回空对象 {} |
items[].last_message.originMessage.senderNickname |
string | 原消息发送者当前昵称;粉丝取用户昵称,艺人优先取艺名并回退用户昵称 |
items[].last_message.originMessage.content |
object | 原消息主体;媒体消息不返回 Base64,原消息已撤回时返回空对象 {} |
items[].last_message.originMessage.content.content |
string | 原消息为文本时的正文;图片、语音、视频不返回该字段 |
items[].last_message.originMessage.content.imageUri |
string | 原消息为图片时的原图 URL |
items[].last_message.originMessage.content.remoteUrl |
string | 原消息为语音时的远程 URL |
items[].last_message.originMessage.content.sightUrl |
string | 原消息为视频时的远程 URL |
items[].last_message.originMessage.content.duration |
integer | 原消息为语音或视频时的时长,单位秒 |
items[].last_message.originMessage.content.size |
string | 原消息为视频时的文件大小,单位字节 |
items[].last_message.originMessage.content.name |
string | 原消息为语音或视频时的原始文件名 |
items[].last_message.readReceiptInfo |
object | 当前查看人视角的已读回执信息 |
items[].last_message.readReceiptInfo.isReceiptRequestMessage |
boolean | 消息是否参与本地已读统计;发送成功且未撤回的定向或群发消息为 true |
items[].last_message.readReceiptInfo.hasRespond |
boolean | 当前查看人作为接收方时是否已读;发送方视角固定为 false |
items[].last_message.readReceiptInfo.userIdList |
object | 已读用户列表;历史列表当前固定返回空对象 {},群发明细请使用群发已读统计接口 |
items[].unread_count |
integer | 未读数量;包含艺人定向未读和当前粉丝未读的艺人群发,订阅业务消息不计入艺人定向未读 |
pagination.page |
integer | 当前页码 |
pagination.page_size |
integer | 每页数量 |
pagination.total |
integer | 总数量 |
pagination.next_cursor |
string/null | 游标分页预留,当前为 null |
响应示例:
{
"code": 200,
"message": "成功",
"data": {
"items": [
{
"artist_id": 20001,
"artist_name": "示例艺人",
"artist_avatar": "https://cdn.example.com/artist.png",
"artist_online_status": 1,
"rong_ultra_group_id": "tieup_artist_group_20001",
"rong_channel_id": "",
"is_current_fan": 1,
"last_message": {
"message_no": "MSG2026070610300012345678",
"direction": 3,
"conversationType": 10,
"targetId": "tieup_artist_group_20001",
"channelId": "",
"messageId": 456,
"messageDirection": 2,
"senderUserId": "tieup_artist_20001",
"sentStatus": 30,
"receivedTime": 1783314600000,
"sentTime": 1783314600000,
"objectName": "RC:ImgMsg",
"content": {},
"messageUId": "XXXX-JJJJ-KKKK",
"canIncludeExpansion": true,
"expansionDic": {
"senderRole": "artist",
"artistId": "20001",
"artistNickname": "示例艺人",
"readCount": "328",
"targetCount": "1000"
},
"directedUserIds": [],
"disableUpdateLastMessage": false,
"quoteInfo": {},
"originMessage": {},
"readReceiptInfo": {
"isReceiptRequestMessage": false,
"hasRespond": false,
"userIdList": {}
}
},
"unread_count": 0
}
],
"pagination": {
"page": 1,
"page_size": 20,
"total": 1,
"next_cursor": null
}
}
}
说明:聊天列表不会触发自动已读。last_message 按真实发送时间选择最后一条当前粉丝可见且未被当前身份删除的消息;最后消息已撤回时不会回退到上一条普通消息,而是保持原 objectName、messageUId、发送时间等历史字段并返回 content={},客户端可展示“消息已撤回”。撤回消息不计入 unread_count,readReceiptInfo.isReceiptRequestMessage=false。last_message 为正常定向消息时,expansionDic.is_read 使用当前已落库的接收方实际阅读状态;正常群发消息不提供 is_read,改为通过一次 Redis Pipeline 批量读取实时人数,并动态返回字符串 readCount、targetCount。图片、语音、视频的正常 last_message.content 只返回远程链接和必要元数据,服务端不会把融云载荷中的 Base64 字段透传给 APP。