From 4a543749294dbf41040207da557766e0228619ca Mon Sep 17 00:00:00 2001 From: qydysky Date: Sun, 23 May 2021 01:31:14 +0800 Subject: [PATCH] =?utf8?q?=E8=BF=9E=E9=BA=A6=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Reply/Msg.go | 3 ++ Reply/Reply.go | 35 +++++++++++++++++++--- Reply/ws_msg/VOICE_JOIN_LIST.go | 14 +++++++++ Reply/ws_msg/VOICE_JOIN_ROOM_COUNT_INFO.go | 15 ++++++++++ Reply/ws_msg/VOICE_JOIN_STATUS.go | 20 +++++++++++++ demo/config/config_tts.json | 3 +- 6 files changed, 85 insertions(+), 5 deletions(-) create mode 100644 Reply/ws_msg/VOICE_JOIN_LIST.go create mode 100644 Reply/ws_msg/VOICE_JOIN_ROOM_COUNT_INFO.go create mode 100644 Reply/ws_msg/VOICE_JOIN_STATUS.go diff --git a/Reply/Msg.go b/Reply/Msg.go index 86ee3d0..ddc41a1 100644 --- a/Reply/Msg.go +++ b/Reply/Msg.go @@ -14,6 +14,9 @@ var msglog = c.Log.Base(`Msg`) //Msg类型数据处理方法map var Msg_map = map[string]func(replyF, string) { + `VOICE_JOIN_ROOM_COUNT_INFO`:replyF.voice_join_room_count_info,//连麦等待 + `VOICE_JOIN_LIST`:nil, + `VOICE_JOIN_STATUS`:replyF.voice_join_status,//连麦人状态 `STOP_LIVE_ROOM_LIST`:nil,//停止直播的直播间 `PK_LOTTERY_START`:replyF.pk_lottery_start,//大乱斗pk `PK_BATTLE_PRE_NEW`:nil,//pk准备 diff --git a/Reply/Reply.go b/Reply/Reply.go index 7a90269..cb08b67 100644 --- a/Reply/Reply.go +++ b/Reply/Reply.go @@ -75,7 +75,33 @@ func (replyF) pk_lottery_start(s string){ return } Gui_show(j.Data.Title,`0room`) - msglog.L(`I`, j.Data.Title) + msglog.L(`I: `, j.Data.Title) +} + +//连麦人状态 +func (replyF) voice_join_status(s string){ + msglog := msglog.Base_add("连麦") + var j ws_msg.VOICE_JOIN_STATUS + if e := json.Unmarshal([]byte(s), &j);e != nil{ + msglog.L(`E: `, e) + return + } + if j.Data.UserName == `` {return} + + Gui_show(`连麦中:`+j.Data.UserName,`0room`) + msglog.L(`I: `, `连麦中:`, j.Data.UserName) +} + +//连麦等待 +func (replyF) voice_join_room_count_info(s string){ + msglog := msglog.Base_add("连麦") + var j ws_msg.VOICE_JOIN_ROOM_COUNT_INFO + if e := json.Unmarshal([]byte(s), &j);e != nil{ + msglog.L(`E: `, e) + return + } + Gui_show(`连麦等待:`+strconv.Itoa(j.Data.ApplyCount),`0room`) + msglog.L(`I: `, `连麦等待人数`, j.Data.ApplyCount) } //大乱斗pk状态 @@ -88,7 +114,7 @@ func (replyF) pk_battle_process_new(s string){ } if diff := j.Data.InitInfo.Votes-j.Data.MatchInfo.Votes;diff<0 { Gui_show(`大乱斗落后`,strconv.Itoa(diff),`0room`) - msglog.L(`I`, `大乱斗落后`,diff) + msglog.L(`I: `, `大乱斗落后`,diff) } } @@ -107,7 +133,7 @@ func (replyF) vtr_gift_lottery(s string){ }) } Gui_show(j.Data.InteractMsg,`0room`) - msglog.L(`I`, j.Data.InteractMsg) + msglog.L(`I: `, j.Data.InteractMsg) } //msg-直播间进入信息,此处用来提示关注 @@ -619,7 +645,7 @@ func (replyF) panel(s string){ //Msg-热门榜变动 func (replyF) hot_rank_changed(s string){ - msglog := msglog.Base_add("房") + msglog := msglog.Base_add("房").Log_show_control(false) var type_item ws_msg.HOT_RANK_CHANGED if e := json.Unmarshal([]byte(s), &type_item);e != nil { @@ -632,6 +658,7 @@ func (replyF) hot_rank_changed(s string){ } else { c.Note += strconv.Itoa(type_item.Data.Rank) } + fmt.Printf("%s\t%s\n", "热门榜", c.Note) msglog.L(`I: `, "热门榜", c.Note) } } diff --git a/Reply/ws_msg/VOICE_JOIN_LIST.go b/Reply/ws_msg/VOICE_JOIN_LIST.go new file mode 100644 index 0000000..c5c2ce8 --- /dev/null +++ b/Reply/ws_msg/VOICE_JOIN_LIST.go @@ -0,0 +1,14 @@ +package part + +type VOICE_JOIN_LIST struct { + Cmd string `json:"cmd"` + Data struct { + RoomID int `json:"room_id"` + Category int `json:"category"` + ApplyCount int `json:"apply_count"` + RedPoint int `json:"red_point"` + Refresh int `json:"refresh"` + } `json:"data"` + Roomid int `json:"roomid"` +} +//{"cmd":"VOICE_JOIN_LIST","data":{"room_id":1017,"category":1,"apply_count":62,"red_point":1,"refresh":0},"roomid":1017} \ No newline at end of file diff --git a/Reply/ws_msg/VOICE_JOIN_ROOM_COUNT_INFO.go b/Reply/ws_msg/VOICE_JOIN_ROOM_COUNT_INFO.go new file mode 100644 index 0000000..db42a3b --- /dev/null +++ b/Reply/ws_msg/VOICE_JOIN_ROOM_COUNT_INFO.go @@ -0,0 +1,15 @@ +package part + +type VOICE_JOIN_ROOM_COUNT_INFO struct { + Cmd string `json:"cmd"` + Data struct { + RoomID int `json:"room_id"` + RootStatus int `json:"root_status"` + RoomStatus int `json:"room_status"` + ApplyCount int `json:"apply_count"` + NotifyCount int `json:"notify_count"` + RedPoint int `json:"red_point"` + } `json:"data"` + Roomid int `json:"roomid"` +} +//{"cmd":"VOICE_JOIN_ROOM_COUNT_INFO","data":{"room_id":1017,"root_status":1,"room_status":1,"apply_count":62,"notify_count":0,"red_point":0},"roomid":1017} \ No newline at end of file diff --git a/Reply/ws_msg/VOICE_JOIN_STATUS.go b/Reply/ws_msg/VOICE_JOIN_STATUS.go new file mode 100644 index 0000000..7aa03b6 --- /dev/null +++ b/Reply/ws_msg/VOICE_JOIN_STATUS.go @@ -0,0 +1,20 @@ +package part + +type VOICE_JOIN_STATUS struct { + Cmd string `json:"cmd"` + Data struct { + RoomID int `json:"room_id"` + Status int `json:"status"` + Channel string `json:"channel"` + ChannelType string `json:"channel_type"` + UID int `json:"uid"` + UserName string `json:"user_name"` + HeadPic string `json:"head_pic"` + Guard int `json:"guard"` + StartAt int `json:"start_at"` + CurrentTime int `json:"current_time"` + WebShareLink string `json:"web_share_link"` + } `json:"data"` + Roomid int `json:"roomid"` +} +//{"cmd":"VOICE_JOIN_STATUS","data":{"room_id":1017,"status":0,"channel":"","channel_type":"voice","uid":0,"user_name":"","head_pic":"","guard":0,"start_at":0,"current_time":1621702198,"web_share_link":"https:\/\/live.bilibili.com\/h5\/1017"},"roomid":1017} \ No newline at end of file diff --git a/demo/config/config_tts.json b/demo/config/config_tts.json index e4b1f86..a167e5a 100644 --- a/demo/config/config_tts.json +++ b/demo/config/config_tts.json @@ -14,6 +14,7 @@ "?":"问号", "?":"问号", "!":"叹号", - "!":"叹号" + "!":"叹号", + "hso":"好色哦" } } \ No newline at end of file -- 2.39.2