]> 127.0.0.1 Git - bili_danmu/.git/commitdiff
VTR_GIFT_LOTTERY 直播状态提示 小心心修复
authorqydysky <qydysky@foxmail.com>
Tue, 30 Mar 2021 12:05:49 +0000 (20:05 +0800)
committerqydysky <qydysky@foxmail.com>
Tue, 30 Mar 2021 12:05:49 +0000 (20:05 +0800)
F/api.go
F/cmd.go
Reply/F.go
Reply/Msg.go
Reply/Reply.go
Reply/ws_msg/VTR_GIFT_LOTTERY.go
bili_danmu.go

index b606ee393b81fea0f6c4bd9813056c25eebea91a..22467a5d9b046e1bd7954f61c85f54c425c9c3fc 100644 (file)
--- a/F/api.go
+++ b/F/api.go
@@ -62,8 +62,7 @@ func Get(key string) {
                        Html,
                },
                `Roomid`:[]func()([]string){//房间id
-                       getInfoByRoom,
-                       Html,
+                       missRoomId,
                },
                `GuardNum`:[]func()([]string){//舰长数
                        Get_guardNum,
@@ -229,7 +228,7 @@ func Html() (missKey []string) {
                        //Roominitres
                        {
                                var j struct{
-                                       Roominitres J.Roominitres  `json:"roomInfoRes"`
+                                       Roominitres J.Roominitres  `json:"roomInitRes"`
                                }
                                if e := json.Unmarshal([]byte(s),&j);e != nil{
                                        apilog.L(`E: `, e)
@@ -242,7 +241,9 @@ func Html() (missKey []string) {
                                //主播uid
                                c.UpUid = j.Roominitres.Data.UID
                                //房间号(完整)
-                               c.Roomid = j.Roominitres.Data.RoomID
+                               if j.Roominitres.Data.RoomID != 0 {
+                                       c.Roomid = j.Roominitres.Data.RoomID
+                               }
                                //直播开始时间
                                c.Live_Start_Time = time.Unix(int64(j.Roominitres.Data.LiveTime),0)
                                //是否在直播
@@ -324,6 +325,11 @@ func Html() (missKey []string) {
        return
 }
 
+func missRoomId() (missKey []string) {
+       apilog.Base_add(`missRoomId`).L(`E: `,`missRoomId`)
+       return
+}
+
 func getInfoByRoom() (missKey []string) {
        apilog := apilog.Base_add(`getInfoByRoom`)
 
@@ -376,7 +382,9 @@ func getInfoByRoom() (missKey []string) {
                        //主播id
                        c.UpUid = j.Data.RoomInfo.UID
                        //房间id
-                       c.Roomid = j.Data.RoomInfo.RoomID
+                       if j.Data.RoomInfo.RoomID != 0 {
+                               c.Roomid = j.Data.RoomInfo.RoomID
+                       }
                        //舰长数
                        c.GuardNum = j.Data.GuardInfo.Count
                        //分区排行
@@ -447,7 +455,9 @@ func getRoomPlayInfo() (missKey []string) {
                //主播uid
                c.UpUid = j.Data.UID
                //房间号(完整)
-               c.Roomid = j.Data.RoomID
+               if j.Data.RoomID != 0{
+                       c.Roomid = j.Data.RoomID
+               }
                //直播开始时间
                c.Live_Start_Time = time.Unix(int64(j.Data.LiveTime),0)
                //是否在直播
@@ -552,7 +562,9 @@ func getRoomPlayInfoByQn() (missKey []string) {
                //主播uid
                c.UpUid = j.Data.UID
                //房间号(完整)
-               c.Roomid = j.Data.RoomID
+               if j.Data.RoomID != 0{
+                       c.Roomid = j.Data.RoomID
+               }
                //直播开始时间
                c.Live_Start_Time = time.Unix(int64(j.Data.LiveTime),0)
                //是否在直播
@@ -1277,8 +1289,8 @@ func CheckSwitch_FansMedal() (missKey []string) {
                        medal_id = v.Medal_id
                }
                if medal_id == 0 {//无牌
+                       apilog.L(`I: `,`无主播粉丝牌`)
                        if c.Wearing_FansMedal == 0 {//当前没牌
-                               apilog.L(`I: `,`当前无粉丝牌,不切换`)
                                return
                        }
                }
index 1ce534cddbb65285bb2d4ccb14e36a3215cc9091..767822123336599904ca5679802e30c6845106ee 100644 (file)
--- a/F/cmd.go
+++ b/F/cmd.go
@@ -46,7 +46,6 @@ func Cmd() {
                                if len(inputs) > 5 {
                                        if room,ok := liveList[inputs];ok{
                                                c.Roomid = room
-                                               cmdlog.L(`I: `, "进入房间",room)
                                                c.Danmu_Main_mq.Push_tag(`change_room`,nil)
                                                continue
                                        }
index 8f79fe1f8cad18de56095dca416fb729d12a2c4f..94a18d6807d4df98dcdc5b3045e4ab7415e54462 100644 (file)
@@ -227,6 +227,9 @@ func Saveflvf(){
 
        cuLinkIndex := 0
        for {
+               F.Get(`Liveing`)
+               if !c.Liveing {break}
+               
                F.Get(`Live`)
                if len(c.Live)==0 {break}
 
@@ -268,6 +271,7 @@ func Saveflvf(){
                                saveflv.cancel.Done()
                                cuLinkIndex += 1
                                if cuLinkIndex >= len(c.Live) {cuLinkIndex = 0}
+                               time.Sleep(time.Second*5)
                                continue
                        }
                }
index 6639af94ac1331e0a17a1402e50b0cf4a26b7e07..56f1f93101b1c2c1d35520e4c3e63a438e83246e 100644 (file)
@@ -14,6 +14,7 @@ var msglog = c.Log.Base(`Msg`)
 
 //Msg类型数据处理方法map
 var Msg_map = map[string]func(replyF, string) {
+       `VTR_GIFT_LOTTERY`:replyF.vtr_gift_lottery,//特别礼物
        `ENTRY_EFFECT_MUST_RECEIVE`:nil,//高能榜前三进入
        `GIFT_BAG_DOT`:nil,
        `LITTLE_MESSAGE_BOX`:replyF.little_message_box,//小消息
index 8b8effd049cb22d037387b4cb6bcd3649bc22bfc..c9cc668c95bb84736bffa9389551e9a52800f845 100644 (file)
@@ -64,6 +64,24 @@ func (replyF) defaultMsg(s string){
        msglog.Base_add("Unknow").L(`E: `, s)
 }
 
+//msg-特别礼物
+func (replyF) vtr_gift_lottery(s string){
+       msglog := msglog.Base_add("特别礼物")
+       var j ws_msg.VTR_GIFT_LOTTERY
+       if e := json.Unmarshal([]byte(s), &j);e != nil{
+               msglog.L(`E: `, e)
+               return
+       }
+       {//语言tts
+               c.Danmu_Main_mq.Push_tag(`tts`,Danmu_mq_t{
+                       uid:`0room`,
+                       msg:fmt.Sprint(j.Data.InteractMsg),
+               })
+       }
+       Gui_show(j.Data.InteractMsg,`0room`)
+       msglog.L(`I`, j.Data.InteractMsg)
+}
+
 //msg-直播间进入信息,此处用来提示关注
 func (replyF) interact_word(s string){
        msg_type := p.Json().GetValFromS(s, "data.msg_type");
index 27f87a56276f9f097dbc176019318469941c9e3d..e461ded3dfdf66b8308e81753759264ecfa3af4a 100644 (file)
@@ -1,13 +1,17 @@
 package part
 
 type VTR_GIFT_LOTTERY struct {
-       Cmd string `json:"cmd"`
+       Cmd  string `json:"cmd"`
        Data struct {
-               Dark_highlight_col int `json:"dark_highlight_col"`
-        Highlight_col int `json:"highlight_col"`
-        Interact_msg int `json:"interact_msg"`
-        Room_id string `json:"room_id"`
-       Toast_msg int `json:"toast_msg"`
+               ActName          string `json:"act_name"`
+               AwardUsername    string `json:"award_username"`
+               InteractMsg      string `json:"interact_msg"`
+               ToastMsg         string `json:"toast_msg"`
+               RoomID           int    `json:"room_id"`
+               UID              int    `json:"uid"`
+               HighlightCol     string `json:"highlight_col"`
+               DarkHighlightCol string `json:"dark_highlight_col"`
+               LotteryID        string `json:"lottery_id"`
        } `json:"data"`
 }
 /*
index b7598b39077eb635b7105cb9e2ecaba7350b38b5..8d9a8e179c5990719d8e97b6a69a14e6b1ec7eea 100644 (file)
@@ -163,12 +163,8 @@ func Demo(roomid ...int) {
                F.Get(`Silver_2_coin`)
                //每日签到
                F.Dosign()
-               //检查与切换粉丝牌,只在cookie存在时启用
-               F.Get(`CheckSwitch_FansMedal`)
                //客户版本
                F.Get(`VERSION`)
-               //小心心
-               go F.F_x25Kn()
                //附加功能 保持牌子点亮
                go reply.Keep_medal_light()
                //附加功能 自动发送即将过期礼物
@@ -190,6 +186,14 @@ func Demo(roomid ...int) {
                                return true
                        })
 
+                       F.Get(`Liveing`)
+                       //直播状态
+                       if c.Liveing {
+                               danmulog.L(`I: `,"直播中")
+                       } else {
+                               danmulog.L(`I: `,"未直播")
+                       }
+
                        //对每个弹幕服务器尝试
                        F.Get(`WSURL`)
                        for _, v := range c.WSURL {
@@ -283,6 +287,10 @@ func Demo(roomid ...int) {
                                                        go reply.Entry_danmu()
                                                        go reply.Saveflvf()
                                                        go reply.ShowRevf()
+                                                       //检查与切换粉丝牌,只在cookie存在时启用
+                                                       F.Get(`CheckSwitch_FansMedal`)
+                                                       //小心心
+                                                       go F.F_x25Kn()
                                                }
                                        }()
                                }