Skip to content

Commit

Permalink
fix message error
Browse files Browse the repository at this point in the history
  • Loading branch information
Sjj1024 committed Jun 29, 2024
1 parent a29b132 commit 44eea3a
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 421 deletions.
21 changes: 21 additions & 0 deletions analysis/chatmessage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
1: ["common", r.webcast.im.Common.decode, 1],
2: ["user", r.webcast.data.User.decode, 1],
3: ["content", e.string, 0],
4: ["visible_to_sender", e.bool, 0],
5: ["background_image", r.webcast.data.Image.decode, 1],
6: ["full_screen_text_color", e.string, 0],
7: ["background_image_v2", r.webcast.data.Image.decode, 1],
9: ["public_area_common", r.webcast.im.PublicAreaCommon.decode, 1],
10: ["gift_image", r.webcast.data.Image.decode, 1],
11: ["agree_msg_id", e.int64String, 0],
12: ["priority_level", e.int32, 0],
13: ["landscape_area_common", r.webcast.im.LandscapeAreaCommon.decode, 1],
15: ["event_time", e.int64String, 0],
16: ["send_review", e.bool, 0],
17: ["from_intercom", e.bool, 0],
18: ["intercom_hide_user_card", e.bool, 0],
19: ["chat_tags", e.int32, 6],
20: ["chat_by", e.int64String, 0],
21: ["individual_chat_priority", e.int32, 0],
40: ["rtf_content", r.webcast.data.Text.decode, 1],
41: ["rtf_content_v2", r.webcast.data.Text.decode, 1]
18 changes: 11 additions & 7 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const liveInfo = ref({
avatar: Logo,
fans: 0,
customer: 0,
totalCustomer: 0,
totalLike: 0,
signature: '',
})
Expand Down Expand Up @@ -80,7 +80,7 @@ const startListen = async () => {
avatar: roomInfo.owner.avatar_thumb.url_list[0],
fans: 0,
customer: roomInfo.user_count_str,
totalCustomer: roomInfo.stats.total_user_str,
totalLike: roomInfo.stats.total_user_str,
signature: 'roomInfo.signature',
}
// 加载直播视频:可能没有HD1
Expand All @@ -101,7 +101,7 @@ const startListen = async () => {
avatar: roomInfo.avatar_thumb.url_list[0],
fans: 0,
customer: 0,
totalCustomer: 0,
totalLike: 0,
signature: 'roomInfo.signature',
}
// 清空播放器
Expand Down Expand Up @@ -329,7 +329,7 @@ const decodeChat = (data) => {
// console.log('chatMsg-----', chatMsg)
const { common, user, content } = chatMsg
const message = {
id: common.userId,
id: common.msgId,
name: user.nickName,
msg: content,
}
Expand Down Expand Up @@ -365,14 +365,18 @@ const enterLive = (data) => {
// 点赞消息
const likeLive = (data) => {
const likeMsg = douyin.LikeMessage.decode(data)
const { common, user, count } = likeMsg
console.log('likeMsg---', likeMsg)
const { common, user, total } = likeMsg
const message = {
id: common.msgId,
name: user.nickName,
msg: `为主播点赞了`,
}
liveInfo.value = {
...liveInfo.value,
totalLike: total,
}
messageList.value.push(message)
// console.log('likeMsg---', likeMsg)
}
// 关注主播
Expand Down Expand Up @@ -428,7 +432,7 @@ const countLive = (data) => {
<div class="nickBox">
<span class="nickName">{{ liveInfo.name }}</span>
<span class="fans">
{{ liveInfo.totalCustomer }}本场点赞
{{ liveInfo.totalLike }}本场点赞
</span>
</div>
</div>
Expand Down
Loading

0 comments on commit 44eea3a

Please sign in to comment.