From f2a770c09e7c5bbba7ba4a75ebdbd35bf04f1905 Mon Sep 17 00:00:00 2001 From: qydysky Date: Sat, 27 Jul 2024 02:28:40 +0800 Subject: [PATCH] =?utf8?q?Add=20msg=20=E7=83=AD=E9=97=A8=E6=A6=9C=E5=8F=98?= =?utf8?q?=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Reply/Msg.go | 1 + Reply/Reply.go | 26 ++++++++++++++++++++++++++ Reply/ws_msg/RANK_CHANGED.go | 16 ++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 Reply/ws_msg/RANK_CHANGED.go diff --git a/Reply/Msg.go b/Reply/Msg.go index 18ed9f9..aad646a 100644 --- a/Reply/Msg.go +++ b/Reply/Msg.go @@ -17,6 +17,7 @@ var msglog = c.C.Log.Base(`Msg`) // Msg类型数据处理方法map var Msg_map = map[string]func(replyF, string){ + `RANK_CHANGED`: replyF.rank_changed, //热门榜变动 `LIVE_MULTI_VIEW_NEW_INFO`: nil, `POPULARITY_RANK_TAB_CHG`: nil, `POPULAR_RANK_GUIDE_CARD`: nil, //投喂一个人气票帮助主播打榜 diff --git a/Reply/Reply.go b/Reply/Reply.go index 094fd74..a0ae3f5 100644 --- a/Reply/Reply.go +++ b/Reply/Reply.go @@ -151,6 +151,32 @@ func (t replyF) defaultMsg(s string) { msglog.Base_add("Unknow").L(`W: `, s) } +// 房间封禁提示 +func (t replyF) rank_changed(s string) { + msglog := msglog.Base_add("房") + var j ws_msg.RANK_CHANGED + if e := json.Unmarshal([]byte(s), &j); e != nil { + msglog.L(`E: `, e) + return + } + + var tmp = `获得:` + j.Data.RankNameByType + " 第" + if j.Data.Rank != 0 { + tmp += strconv.Itoa(j.Data.Rank) + } else { + return + } + Gui_show(tmp, "0rank") + t.Common.Danmu_Main_mq.Push_tag(`tts`, Danmu_mq_t{ //传入消息队列 + uid: "0rank", + m: map[string]string{ + `{Area_name}`: j.Data.RankNameByType, + `{Rank}`: strconv.Itoa(j.Data.Rank), + }, + }) + msglog.L(`I: `, "热门榜", tmp) +} + // 房间封禁提示 func (t replyF) room_lock(s string) { msglog := msglog.Base_add("房") diff --git a/Reply/ws_msg/RANK_CHANGED.go b/Reply/ws_msg/RANK_CHANGED.go new file mode 100644 index 0000000..ff4f2ef --- /dev/null +++ b/Reply/ws_msg/RANK_CHANGED.go @@ -0,0 +1,16 @@ +package part + +type RANK_CHANGED struct { + Cmd string `json:"cmd"` + Data struct { + UID int `json:"uid"` + Rank int `json:"rank"` + Countdown int `json:"countdown"` + Timestamp int `json:"timestamp"` + OnRankNameByType string `json:"on_rank_name_by_type"` + RankNameByType string `json:"rank_name_by_type"` + URLByType string `json:"url_by_type"` + RankByType int `json:"rank_by_type"` + RankType int `json:"rank_type"` + } `json:"data"` +} -- 2.39.2