获取评论页数
var commentPage = Mudu.Room.Comment.GetPage()
发送评论
Mudu.Room.Comment.Send(
'活动很赞很给力',
function (response) {
response = JSON.parse(response)
if (response.status === 'y') {
console.log('发送成功')
}
if (response.status === 'n') {
console.log('发送失败,错误码为:' + response.flag)
}
}
)
{
status: 'y',
flag: 100,
info: "发送消息成功!/失败!"
}
flag |
info |
status |
100 |
发送消息成功 |
y |
101 |
管理员禁止了聊天 |
n |
102 |
观众被禁言 |
n |
103 |
发送失败 |
n |
104 |
禁止匿名聊天 |
n |
获取评论
Mudu.Room.Comment.Get(
2,
function (response) {
response = JSON.parse(response)
if (response.status === 'y') {
console.log('获取评论成功,数据为:', response.data)
}
if (response.status === 'n'){
console.log('获取评论失败')
}
}
)
{
"status": 'y',
"data": {
page: 70,
comments: [
{
"id": 3438056,
"visitor_id": "1493401897797743654_api",
"username": "小白白",
"message": "这个真不错",
"avatar": "http://cdn12.mudu.tv/thumbnails/uploads/9/b5ed4ba472bbaa27e092be7594a2e31d.jpg",
"dateline": "2020-04-16T15:56:00+08:00",
"pushed": 1,
"priority": 10,
"top": 0,
"msg_type": 10,
"is_admin": 0
},
......
]
},
}
名称 |
说明 |
类型 |
id |
评论id |
int |
visitor_id |
观众标志 |
string |
username |
评论者的观众名 |
string |
message |
评论的文本 |
string |
avatar |
评论这个的头像 |
string |
dateline |
评论时间 |
字符串 |
pushed |
是否已经发送了弹幕,0未发送,1已发送 |
int |
priority |
优先级 ,0 未审核,10已审核,时间戳(置顶时间) |
int |
top |
是否置顶 ,0 不置顶,1置顶 |
int |
msg_type |
消息来源类型, 10为普通文本消息...,详情见下表 |
int |
is_admin |
是否为管理员发送, 1是, 0不是 |
int |
- msg_type 和 message之间的映射关系
类型 |
标志位(msg_type) |
存储类型 |
示例(message) |
备注 |
普通评论 |
10 |
字符串 |
"真香" |
表情替换 |
发送普通红包 |
20 |
字符串json |
'{"id":"nm4dk9jm", "type":1, "name":"恭喜发财!大吉大利!", }' |
type 2:钉钉 |
发送口令红包 |
21 |
字符串json |
'{"id":"nm4dk9jm", "type":1, "name":"恭喜发财!大吉大利!"}' |
type 2:钉钉 |
发送竞答红包 |
22 |
字符串json |
'{"id":"nm4dk9jm", "name":"参与竞答领取红包!"}' |
|
发送竞答红包(自定义) |
23 |
字符串json |
'{"id":"nm4dk9jm", "name":"参与竞答领取红包!"}' |
|
抢口令红包评论 |
31 |
字符串 |
"大吉大利,今晚吃鸡" |
|
免费道具打赏 |
40 |
字符串json |
'{"src":"https://xxx.com/a.jpg". "name":"免费道具", "number":1 }' |
|
付费道具打赏 |
41 |
字符串json |
'{"src":"https://xxx.com/c.jpg". "name":"付费道具", "number":88 }' |
|
现金打赏 |
42 |
字符串json |
'{"name":"赏赐", "amount":88.99 }' |
|
图片评论 |
50 |
字符串 |
"https://xxx.com/abc.jpg" |
Comment.New事件会在评论新增的时候被触发
Mudu.MsgBus.On(
'Comment.New',
function (newComment) {
newComment = JSON.parse(newComment)
console.log(newComment.username + '发送了一条新评论: ' + newComment.message)
}
)
Comment.Top事件会在评论置顶/取消置顶时触发
Mudu.MsgBus.On(
'Comment.Top',
function (newComment) {
newComment = JSON.parse(newComment)
console.log('一条评论被' + (newComment.top === 1 ? '置顶' : '取消置顶') + '了');
}
)
Comment.Delete事件会在评论被管理员删除时触发
Mudu.MsgBus.On(
'Comment.Delete',
function (newComment) {
newComment = JSON.parse(newComment)
console.log('一条评论被删除了');
}
)
名称 |
说明 |
类型 |
id |
评论id |
int |
visitor_id |
观众标志 |
string |
username |
评论者的观众名 |
string |
message |
评论的文本 |
string |
avatar |
评论这个的头像 |
string |
dateline |
评论的时间戳 |
int |
pushed |
是否已经发送了弹幕,0未发送,1已发送 |
int |
priority |
优先级 ,0 未审核,10已审核,时间戳(置顶时间) |
int |
top |
是否置顶 ,0 不置顶,1置顶 |
int |
msg_type |
消息来源类型, 10为普通文本消息...,详情见上表 |
int |
is_admin |
是否为管理员发送, 1是, 0不是 |
int |