]> 127.0.0.1 Git - bili_danmu/.git/commitdiff
使用热门榜替代旧小时榜
authorqydysky <qydysky@foxmail.com>
Thu, 7 Jan 2021 13:25:40 +0000 (21:25 +0800)
committerqydysky <qydysky@foxmail.com>
Thu, 7 Jan 2021 13:25:40 +0000 (21:25 +0800)
Reply/Msg.go
Reply/Reply.go
Reply/ws_msg/HOT_RANK_CHANGED.go [new file with mode: 0644]

index c647d2e2701526d3ebc544d873188e0755f15bc1..173b761bab5e0f1dcd5289cdda1f8ec142c337e1 100644 (file)
@@ -15,7 +15,7 @@ var msglog = c.Log.Base(`Msg`)
 //Msg类型数据处理方法map
 var Msg_map = map[string]func(replyF, string) {
        `HOT_RANK_SETTLEMENT`:nil,
-       `HOT_RANK_CHANGED`:nil,
+       `HOT_RANK_CHANGED`:replyF.hot_rank_changed,//热门榜变动
        `CARD_MSG`:nil,//提示关注
        `LIVE_INTERACTIVE_GAME`:nil,
        `WIDGET_BANNER`:nil,//每日任务
@@ -71,7 +71,7 @@ var Msg_map = map[string]func(replyF, string) {
        "SUPER_CHAT_MESSAGE_DELETE":nil,//SC删除
        "SUPER_CHAT_MESSAGE":nil,//replyF.super_chat_message,//SC
        "SUPER_CHAT_MESSAGE_JPN":replyF.super_chat_message,//SC
-       "PANEL":replyF.panel,//排行榜
+       "PANEL":nil,//replyF.panel,//排行榜 被HOT_RANK_CHANGED替代
        "ENTRY_EFFECT":nil,//replyF.entry_effect,//进入特效
        "ROOM_REAL_TIME_MESSAGE_UPDATE":nil,//replyF.roominfo,//粉丝数
 }
index 1fb69e11d76eaf9fd878ecd889a9e7709bd5ec6a..7f67897e2a857c3bb56f580b62c078db6823c3da 100644 (file)
@@ -6,10 +6,12 @@ import (
        "bytes"
        "strconv"
        "compress/zlib"
+       "encoding/json"
 
        p "github.com/qydysky/part"
        mq "github.com/qydysky/part/msgq"
        F "github.com/qydysky/bili_danmu/F"
+       ws_msg "github.com/qydysky/bili_danmu/Reply/ws_msg"
        send "github.com/qydysky/bili_danmu/Send"
        c "github.com/qydysky/bili_danmu/CV"
 )
@@ -506,7 +508,7 @@ func (replyF) super_chat_message(s string){
        msglog.Base_add("礼").Log_show_control(false).L(`I: `, logg...)
 }
 
-//Msg-分区排行
+//Msg-分区排行 使用热门榜替代
 func (replyF) panel(s string){
        msglog := msglog.Base_add("房").Log_show_control(false)
 
@@ -520,6 +522,26 @@ func (replyF) panel(s string){
        }
 }
 
+//Msg-热门榜变动
+func (replyF) hot_rank_changed(s string){
+       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 {
+               msglog.L(`E: `, e)
+       }
+       if type_item.Data.Area_name != `` {
+               c.Note = type_item.Data.Area_name + " "
+               if type_item.Data.Rank == 0 {
+                       c.Note += "50+"
+               } else {
+                       c.Note += strconv.Itoa(type_item.Data.Rank)
+               }
+               fmt.Println("热门榜", c.Note)
+               msglog.L(`I: `, "热门榜", c.Note)
+       }
+}
+
 //Msg-进入特效,大多为大航海进入,信息少,使用welcome_guard替代
 func (replyF) entry_effect(s string){
        msglog := msglog.Base_add("房").Log_show_control(false)
diff --git a/Reply/ws_msg/HOT_RANK_CHANGED.go b/Reply/ws_msg/HOT_RANK_CHANGED.go
new file mode 100644 (file)
index 0000000..93bd398
--- /dev/null
@@ -0,0 +1,18 @@
+package part
+
+type HOT_RANK_CHANGED struct {
+       Cmd string `json:"cmd"`
+       Data struct {
+               Rank int `json:"rank"`
+               Trend int `json:"trend"`
+               Countdown string `json:"countdown"`
+               Timestamp string `json:"timestamp"`
+               Web_url string `json:"web_url"`
+               Live_url string `json:"live_url"`
+               Blink_url string `json:"blink_url"`
+               Live_link_url string `json:"live_link_url"`
+               Pc_link_url string `json:"pc_link_url"`
+               Icon string `json:"icon"`
+               Area_name string `json:"area_name"`
+       } `json:"data"`
+}