diff --git a/bilibili/live.go b/bilibili/live.go index a21e8a7..5fb566e 100644 --- a/bilibili/live.go +++ b/bilibili/live.go @@ -116,7 +116,7 @@ func (l *LiveBilibili) preConnect() (url string, err error) { msg_handler.NewDanmakuHandler(l.roomInfo.RoomId), msg_handler.NewSendGiftHandler(l.roomInfo.RoomId), msg_handler.NewGuardBuyHandler(l.roomInfo.RoomId), - //&msg_handler.InterActWordHandler{}, + msg_handler.NewRedPocketHandler(l.roomInfo.RoomId), ) } return diff --git a/bilibili/msg_handler/common.go b/bilibili/msg_handler/common.go index 6e70b25..c28f679 100644 --- a/bilibili/msg_handler/common.go +++ b/bilibili/msg_handler/common.go @@ -3,20 +3,21 @@ package msg_handler // FansMedal 粉丝勋章 // TODO 完善粉丝勋章解析,后边带?的是未知的 type FansMedal struct { - AnchorRoomId int `json:"anchor_roomid"` // 佩戴勋章所指的直播间ID - GuardLevel int `json:"guard_level"` // 舰队等级 - IconId int `json:"icon_id"` // 图标ID??? - IsLighted int `json:"is_lighted"` // ??? + AnchorRoomId int64 `json:"anchor_roomid"` // 佩戴勋章所指的直播间ID + AnchorUname string `json:"anchor_uname"` // 佩戴勋章所指的UP主名称 + GuardLevel int64 `json:"guard_level"` // 舰队等级 + IconId int64 `json:"icon_id"` // 图标ID??? + IsLighted int64 `json:"is_lighted"` // ??? - MedalColor int `json:"medal_color"` // 勋章颜色 - MedalColorBorder int `json:"medal_color_border"` // 勋章边框颜色 - MedalColorEnd int `json:"medal_color_end"` // 渐变勋章结束颜色 - MedalColorStart int `json:"medal_color_start"` // 渐变勋章开始颜色 - MedalLevel int `json:"medal_level"` // 勋章等级 + MedalColor int64 `json:"medal_color"` // 勋章颜色 + MedalColorBorder int64 `json:"medal_color_border"` // 勋章边框颜色 + MedalColorEnd int64 `json:"medal_color_end"` // 渐变勋章结束颜色 + MedalColorStart int64 `json:"medal_color_start"` // 渐变勋章开始颜色 + MedalLevel int64 `json:"medal_level"` // 勋章等级 MedalName string `json:"medal_name"` // 勋章名 - Score int `json:"score"` // ??? + Score int64 `json:"score"` // ??? Special string `json:"special"` // ??? - TargetId int `json:"target_id"` // 佩戴勋章所指的主播ID + TargetId int64 `json:"target_id"` // 佩戴勋章所指的主播ID } const ( diff --git a/bilibili/msg_handler/danmaku.go b/bilibili/msg_handler/danmaku.go index 8d6f9b9..20cef4f 100644 --- a/bilibili/msg_handler/danmaku.go +++ b/bilibili/msg_handler/danmaku.go @@ -5,7 +5,8 @@ import ( "git.noahlan.cn/northlan/ntools-go/kafka" "git.noahlan.cn/northlan/ntools-go/logger" "live-gateway/config" - "live-gateway/pb" + "live-gateway/pb/mq" + pbVars "live-gateway/pb/vars" kfk "live-gateway/pkg/kafka" "strconv" ) @@ -33,10 +34,9 @@ type Danmaku struct { MobileVerify bool `json:"mobile_verify"` // 是否验证手机号 UnameColor string `json:"uname_color"` // 用户名颜色 - MedalLevel int `json:"medal_level"` // 粉丝勋章等级 - MedalName string `json:"medal_name"` // 勋章名 - MedalUpName string `json:"medal_up_name"` // up主名称 - UserLevel int `json:"user_level"` // 用户等级 + FansMedal + + UserLevel int64 `json:"user_level"` // 用户UL等级 } type DanmakuHandler struct { @@ -65,7 +65,7 @@ func (d *DanmakuHandler) HandlerMessage(data []byte) { return } - dm := &Danmaku{} + dm := &Danmaku{FansMedal: FansMedal{}} info := baseMsg.Info l := len(info) @@ -98,28 +98,40 @@ func (d *DanmakuHandler) HandlerMessage(data []byte) { h := info[3].([]interface{}) l2 := len(h) if l2 >= 1 { - dm.MedalLevel = int(h[0].(float64)) + dm.FansMedal.MedalLevel = int64(h[0].(float64)) } if l2 >= 2 { - dm.MedalName = h[1].(string) + dm.FansMedal.MedalName = h[1].(string) } if l2 >= 3 { - dm.MedalUpName = h[2].(string) + dm.FansMedal.AnchorUname = h[2].(string) + } + if l2 >= 4 { + dm.FansMedal.AnchorRoomId = int64(h[3].(float64)) + } + if l2 >= 5 { + dm.FansMedal.TargetId = int64(h[4].(float64)) } } if l >= 5 { h := info[4].([]interface{}) - dm.UserLevel = int(h[0].(float64)) + dm.UserLevel = int64(h[0].(float64)) } logger.SLog.Debugf("%s 说: %s", dm.Uname, dm.Content) dmMsg := &pbMq.MqDanmaku{ - Platform: pbMq.Platform_name[int32(pbMq.Platform_bilibili)], + Platform: pbVars.Platform_name[int32(pbVars.Platform_Bilibili)], LiveRoomId: d.liveRoomId, Uid: dm.UID, Uname: dm.Uname, + Avatar: "", Msg: dm.Content, + MsgId: "", Timestamp: dm.SendTime, + + FansMedalWearingStatus: dm.FansMedal.AnchorRoomId == d.liveRoomId, + FansMedalName: dm.FansMedal.MedalName, + FansMedalLevel: dm.FansMedal.MedalLevel, } _ = d.producer.SendMessageAsync(dmMsg, strconv.FormatInt(dm.UID, 10)) diff --git a/bilibili/msg_handler/danmaku_official.go b/bilibili/msg_handler/danmaku_official.go index d1414e4..b8b344a 100644 --- a/bilibili/msg_handler/danmaku_official.go +++ b/bilibili/msg_handler/danmaku_official.go @@ -5,7 +5,8 @@ import ( "git.noahlan.cn/northlan/ntools-go/kafka" "git.noahlan.cn/northlan/ntools-go/logger" "live-gateway/config" - pbMq "live-gateway/pb" + pbMq "live-gateway/pb/mq" + pbVars "live-gateway/pb/vars" kfk "live-gateway/pkg/kafka" "strconv" ) @@ -59,7 +60,7 @@ func (d *DanmakuOfficialHandler) HandlerMessage(data []byte) { logger.SLog.Debugf("%+v", dm) dmMsg := &pbMq.MqDanmaku{ - Platform: pbMq.Platform_name[int32(pbMq.Platform_bilibili)], + Platform: pbVars.Platform_name[int32(pbVars.Platform_Bilibili)], LiveRoomId: d.liveRoomId, Uid: dm.UID, Uname: dm.Uname, diff --git a/bilibili/msg_handler/gift_official.go b/bilibili/msg_handler/gift_official.go index cc53a29..8e04f5a 100644 --- a/bilibili/msg_handler/gift_official.go +++ b/bilibili/msg_handler/gift_official.go @@ -4,7 +4,8 @@ import ( "encoding/json" "git.noahlan.cn/northlan/ntools-go/kafka" "live-gateway/config" - "live-gateway/pb" + "live-gateway/pb/mq" + pbVars "live-gateway/pb/vars" kfk "live-gateway/pkg/kafka" "strconv" ) @@ -66,7 +67,7 @@ func (h *GiftOfficialHandler) HandlerMessage(data []byte) { gift := baseMsg.Data dmMsg := &pbMq.MqGift{ - Platform: pbMq.Platform_name[int32(pbMq.Platform_bilibili)], + Platform: pbVars.Platform_name[int32(pbVars.Platform_Bilibili)], LiveRoomId: h.liveRoomId, Uid: gift.Uid, Uname: gift.Uname, diff --git a/bilibili/msg_handler/guard_buy.go b/bilibili/msg_handler/guard_buy.go index 238b221..ceed88f 100644 --- a/bilibili/msg_handler/guard_buy.go +++ b/bilibili/msg_handler/guard_buy.go @@ -5,7 +5,8 @@ import ( "git.noahlan.cn/northlan/ntools-go/kafka" "git.noahlan.cn/northlan/ntools-go/logger" "live-gateway/config" - "live-gateway/pb" + "live-gateway/pb/mq" + pbVars "live-gateway/pb/vars" kfk "live-gateway/pkg/kafka" "strconv" ) @@ -51,7 +52,7 @@ func (h *GuardBuyHandler) HandlerMessage(data []byte) { logger.SLog.Infof("%s 购买 %s x %d", baseMsg.Data.Uname, baseMsg.Data.GiftName, baseMsg.Data.Num) dmMsg := &pbMq.MqNobilityBuy{ - Platform: pbMq.Platform_name[int32(pbMq.Platform_bilibili)], + Platform: pbVars.Platform_name[int32(pbVars.Platform_Bilibili)], LiveRoomId: h.liveRoomId, Uid: baseMsg.Data.Uid, Uname: baseMsg.Data.Uname, diff --git a/bilibili/msg_handler/guard_buy_official.go b/bilibili/msg_handler/guard_buy_official.go index e2b68c1..7487e82 100644 --- a/bilibili/msg_handler/guard_buy_official.go +++ b/bilibili/msg_handler/guard_buy_official.go @@ -6,7 +6,8 @@ import ( "git.noahlan.cn/northlan/ntools-go/logger" "github.com/jinzhu/now" "live-gateway/config" - "live-gateway/pb" + "live-gateway/pb/mq" + pbVars "live-gateway/pb/vars" kfk "live-gateway/pkg/kafka" "live-gateway/pkg/timex" "strconv" @@ -62,7 +63,7 @@ func (h *GuardBuyOfficialHandler) HandlerMessage(data []byte) { logger.SLog.Infof("%s 购买 %d %d%s", d.UserInfo.Uname, d.GuardLevel, d.GuardNum, d.GuardUnit) dmMsg := &pbMq.MqNobilityBuy{ - Platform: pbMq.Platform_name[int32(pbMq.Platform_bilibili)], + Platform: pbVars.Platform_name[int32(pbVars.Platform_Bilibili)], LiveRoomId: h.liveRoomId, Uid: d.UserInfo.Uid, Uname: d.UserInfo.Uname, diff --git a/bilibili/msg_handler/red_pocket.go b/bilibili/msg_handler/red_pocket.go new file mode 100644 index 0000000..cffd9ff --- /dev/null +++ b/bilibili/msg_handler/red_pocket.go @@ -0,0 +1,81 @@ +package msg_handler + +import ( + "encoding/json" + "git.noahlan.cn/northlan/ntools-go/kafka" + "live-gateway/config" + "live-gateway/pb/mq" + pbVars "live-gateway/pb/vars" + kfk "live-gateway/pkg/kafka" + "strconv" +) + +type RedPocket struct { + LotId int64 `json:"lot_id"` // 本次抽奖ID + Uname string `json:"uname"` // UName + UID int64 `json:"uid"` // UID + + StartTime int64 `json:"start_time"` // 红包开始时间 + CurrentTime int64 `json:"current_time"` // 当前时间 + WaitNum int64 `json:"wait_num"` // 不清楚??? + Action string `json:"action"` + + GiftName string `json:"gift_name"` // 名 + GiftID int64 `json:"gift_id"` // id - 13000 + Num int64 `json:"num"` // 数量 + Price int64 `json:"price"` // 电池数 + + MedalInfo FansMedal `json:"medal_info"` +} + +type RedPocketHandler struct { + producer *kafka.Producer + liveRoomId int64 +} + +func NewRedPocketHandler(liveRoomId int64) *RedPocketHandler { + cfg := config.Config.Kafka.Gift + return &RedPocketHandler{ + producer: kafka.NewKafkaProducer(kfk.DefaultProducerConfig, cfg.Addr, cfg.Topic), + liveRoomId: liveRoomId, + } +} + +func (h *RedPocketHandler) CMD() string { + return "POPULARITY_RED_POCKET_NEW" +} + +func (h *RedPocketHandler) HandlerMessage(data []byte) { + var baseMsg struct { + CMD string `json:"cmd"` + Data *RedPocket `json:"data"` + } + if err := json.Unmarshal(data, &baseMsg); err != nil { + return + } + + //logger.SLog.Infof("%s %s礼物 %s x%d", baseMsg.Data.Uname, baseMsg.Data.Action, baseMsg.Data.GiftName, baseMsg.Data.Num) + + dmMsg := &pbMq.MqGift{ + Platform: pbVars.Platform_name[int32(pbVars.Platform_Bilibili)], + LiveRoomId: h.liveRoomId, + MsgId: "", + Timestamp: baseMsg.Data.CurrentTime, + Uid: baseMsg.Data.UID, + Uname: baseMsg.Data.Uname, + Avatar: "", + GiftId: baseMsg.Data.GiftID, + GiftName: baseMsg.Data.GiftName, + GiftNum: baseMsg.Data.Num, + Price: baseMsg.Data.Price * 100, // 红包的price是电池,转换为金瓜子 + IsPaid: true, + Type: pbMq.MqGift_RED_PACK, + PackGift: nil, + + FansMedalWearingStatus: baseMsg.Data.MedalInfo.AnchorRoomId == h.liveRoomId, + FansMedalName: baseMsg.Data.MedalInfo.MedalName, + FansMedalLevel: baseMsg.Data.MedalInfo.MedalLevel, + } + + _ = h.producer.SendMessageAsync(dmMsg, strconv.FormatInt(dmMsg.Uid, 10)) +} diff --git a/bilibili/msg_handler/send_gift.go b/bilibili/msg_handler/send_gift.go index ed21c7c..bd0ea07 100644 --- a/bilibili/msg_handler/send_gift.go +++ b/bilibili/msg_handler/send_gift.go @@ -4,61 +4,72 @@ import ( "encoding/json" "git.noahlan.cn/northlan/ntools-go/kafka" "live-gateway/config" - "live-gateway/pb" + "live-gateway/pb/mq" + pbVars "live-gateway/pb/vars" kfk "live-gateway/pkg/kafka" "strconv" ) -type SendGift struct { - Action string `json:"action"` // 动作,投喂等 - BatchComboId string `json:"batch_combo_id"` // 礼物连击ID - BatchComboSend interface{} `json:"batch_combo_send"` // ??? - BeatId string `json:"beatId"` // ??? - BizSource string `json:"biz_source"` // ?? :live - BlindGift interface{} `json:"blind_gift"` // ?? - BroadcastId int `json:"broadcast_id"` // 广播ID ?? - CoinType string `json:"coin_type"` // 瓜子类型, gold金瓜子 silver银瓜子(免费礼物) - ComboResourcesId int `json:"combo_resources_id"` // ??? - ComboSend interface{} `json:"combo_send"` // ??? - ComboStayTime int `json:"combo_stay_time"` // 连击停留时间??? 秒? - ComboTotalCoin int `json:"combo_total_coin"` // 连击总币数??? - CritProb int `json:"crit_prob"` // ??? - Demarcation int `json:"demarcation"` // ???: 1 - DiscountPrice int `json:"discount_price"` // 折扣价??? - DMScore int `json:"dmscore"` // 活动积分,普通道具为0 - Draw int `json:"draw"` // ??? - Effect int `json:"effect"` // ??? - EffectBlock int `json:"effect_block"` // ??? - Face string `json:"face"` // 头像? - GiftId int64 `json:"giftId"` // 礼物ID - GiftName string `json:"giftName"` // 礼物名称 - GiftType int `json:"giftType"` // 礼物类型 普通,弹幕,活动 - Gold int `json:"gold"` // 用户剩余金瓜子 - GuardLevel int `json:"guard_level"` // 舰队等级 - IsFirst bool `json:"is_first"` // 是否首次投喂? - IsSpecialBatch int `json:"is_special_batch"` // ??? - Magnification int `json:"magnification"` // 是否放大??? - MedalInfo *FansMedal `json:"medal_info"` // 佩戴勋章的主播信息 - NameColor string `json:"name_color"` // 名 颜色 - Num int64 `json:"num"` // 数量 - OriginalGiftName string `json:"original_gift_name"` // 原始礼物名称??? - Price int64 `json:"price"` // 价格? 但不是电池 - RCost int `json:"rcost"` // ??? - Remain int `json:"remain"` // 用户道具包裹剩余数量 - Rnd string `json:"rnd"` // 随机数? - SendMaster interface{} `json:"send_master"` // ??? - Silver int `json:"silver"` // 用户剩余银瓜子 - Super int `json:"super"` // ??? - SuperBatchGiftNum int `json:"super_batch_gift_num"` // ??? - SuperGiftNum int `json:"super_gift_num"` // ??? - SvgaBlock int `json:"svga_block"` // ??? - TagImage string `json:"tag_image"` // ??? - Timestamp int64 `json:"timestamp"` // 赠送时间 - TopList interface{} `json:"top_list"` // ??? - TotalCoin int `json:"total_coin"` // 总值 瓜子数 - Uid int `json:"uid"` // 用户ID - Uname string `json:"uname"` // 用户名 -} +type ( + SendGift struct { + Action string `json:"action"` // 动作,投喂等 + BatchComboId string `json:"batch_combo_id"` // 礼物连击ID + BatchComboSend interface{} `json:"batch_combo_send"` // ??? + BeatId string `json:"beatId"` // ??? + BizSource string `json:"biz_source"` // ?? :live + BlindGift *BlindGift `json:"blind_gift"` // ?? + BroadcastId int `json:"broadcast_id"` // 广播ID ?? + CoinType string `json:"coin_type"` // 瓜子类型, gold金瓜子 silver银瓜子(免费礼物) + ComboResourcesId int `json:"combo_resources_id"` // ??? + ComboSend interface{} `json:"combo_send"` // ??? + ComboStayTime int `json:"combo_stay_time"` // 连击停留时间??? 秒? + ComboTotalCoin int `json:"combo_total_coin"` // 连击总币数??? + CritProb int `json:"crit_prob"` // ??? + Demarcation int `json:"demarcation"` // ???: 1 + DiscountPrice int `json:"discount_price"` // 折扣价??? + DMScore int `json:"dmscore"` // 活动积分,普通道具为0 + Draw int `json:"draw"` // ??? + Effect int `json:"effect"` // ??? + EffectBlock int `json:"effect_block"` // ??? + Face string `json:"face"` // 头像? + GiftId int64 `json:"giftId"` // 礼物ID + GiftName string `json:"giftName"` // 礼物名称 + GiftType int `json:"giftType"` // 礼物类型 普通,弹幕,活动 + Gold int `json:"gold"` // 用户剩余金瓜子 + GuardLevel int `json:"guard_level"` // 舰队等级 + IsFirst bool `json:"is_first"` // 是否首次投喂? + IsSpecialBatch int `json:"is_special_batch"` // ??? + Magnification int `json:"magnification"` // 是否放大??? + MedalInfo FansMedal `json:"medal_info"` // 佩戴勋章的主播信息 + NameColor string `json:"name_color"` // 名 颜色 + Num int64 `json:"num"` // 数量 + OriginalGiftName string `json:"original_gift_name"` // 原始礼物名称??? + Price int64 `json:"price"` // 价格? 但不是电池 + RCost int `json:"rcost"` // ??? + Remain int `json:"remain"` // 用户道具包裹剩余数量 + Rnd string `json:"rnd"` // 随机数? + SendMaster interface{} `json:"send_master"` // ??? + Silver int `json:"silver"` // 用户剩余银瓜子 + Super int `json:"super"` // ??? + SuperBatchGiftNum int `json:"super_batch_gift_num"` // ??? + SuperGiftNum int `json:"super_gift_num"` // ??? + SvgaBlock int `json:"svga_block"` // ??? + TagImage string `json:"tag_image"` // ??? + Timestamp int64 `json:"timestamp"` // 赠送时间 + TopList interface{} `json:"top_list"` // ??? + TotalCoin int `json:"total_coin"` // 总值 瓜子数 + Uid int64 `json:"uid"` // 用户ID + Uname string `json:"uname"` // 用户名 + } + // BlindGift 宝箱类礼物 + BlindGift struct { + BlindGiftConfigId int64 `json:"blind_gift_config_id"` // id + From int64 `json:"from"` // ?? + GiftAction string `json:"gift_action"` // 爆出/投喂 + OriginalGiftId int64 `json:"original_gift_id"` // 原始礼物ID + OriginalGiftName string `json:"original_gift_name"` // 原始礼物名 + } +) type SendGiftHandler struct { producer *kafka.Producer @@ -89,22 +100,33 @@ func (h *SendGiftHandler) HandlerMessage(data []byte) { //logger.SLog.Infof("%s %s礼物 %s x%d", baseMsg.Data.Uname, baseMsg.Data.Action, baseMsg.Data.GiftName, baseMsg.Data.Num) dmMsg := &pbMq.MqGift{ - Platform: pbMq.Platform_name[int32(pbMq.Platform_bilibili)], - LiveRoomId: h.liveRoomId, - Uid: int64(baseMsg.Data.Uid), - Uname: baseMsg.Data.Uname, - Avatar: "", - GiftId: baseMsg.Data.GiftId, - GiftName: baseMsg.Data.GiftName, - GiftNum: baseMsg.Data.Num, - Price: baseMsg.Data.Price, - IsPaid: IsPaidGift(baseMsg.Data.CoinType), - MsgId: "", - Timestamp: baseMsg.Data.Timestamp, - NobilityLevel: 0, - FansMedalWearingStatus: false, - FansMedalName: "", - FansMedalLevel: 0, + Platform: pbVars.Platform_name[int32(pbVars.Platform_Bilibili)], + LiveRoomId: h.liveRoomId, + MsgId: "", + Timestamp: baseMsg.Data.Timestamp, + Uid: baseMsg.Data.Uid, + Uname: baseMsg.Data.Uname, + Avatar: baseMsg.Data.Face, + NobilityLevel: int64(baseMsg.Data.GuardLevel), + GiftId: baseMsg.Data.GiftId, + GiftName: baseMsg.Data.GiftName, + GiftNum: baseMsg.Data.Num, + Price: baseMsg.Data.Price, + IsPaid: IsPaidGift(baseMsg.Data.CoinType), + Type: pbMq.MqGift_NORMAL, + PackGift: nil, + + FansMedalWearingStatus: baseMsg.Data.MedalInfo.AnchorRoomId == h.liveRoomId, + FansMedalName: baseMsg.Data.MedalInfo.MedalName, + FansMedalLevel: baseMsg.Data.MedalInfo.MedalLevel, + } + // type - pack + if baseMsg.Data.BlindGift != nil { + dmMsg.Type = pbMq.MqGift_PACK + dmMsg.PackGift = &pbMq.MqGift_PackGift{ + GiftId: baseMsg.Data.BlindGift.OriginalGiftId, + GiftName: baseMsg.Data.BlindGift.OriginalGiftName, + } } _ = h.producer.SendMessageAsync(dmMsg, strconv.FormatInt(dmMsg.Uid, 10)) diff --git a/config-dev-sy.yml b/config-dev-sy.yml new file mode 100644 index 0000000..f6f592f --- /dev/null +++ b/config-dev-sy.yml @@ -0,0 +1,37 @@ +Bilibili: + Enabled: true + Type: custom + Official: + Api: https://live-open.biliapi.com + AkId: 1rVL1YRSoii28LJ1O7KIQqqQ + AkSecret: 5USwZt2bygTIE8a2cXahZrzsdKtbxd + Custom: + Url: wss://broadcastlv.chat.bilibili.com:2245/sub + GetRoomUrl: https://api.live.bilibili.com/room/v1/Room/room_init?id= + HeartbeatInterval: 30 + UserId: 111222 + RoomId: 6925399 +Log: + Console: + Level: debug + Format: console + File: + Enabled: true + Level: debug + Format: console + Path: ./logs + Filename: live-gateway.log + FileMaxSize: 10 # 10mb + FileMaxBackups: 30 # + MaxAge: 7 # 保留7天 + Compress: true # 压缩日志 +Kafka: + Danmaku: + Addr: [ "127.0.0.1:9093" ] + Topic: "danmaku-dev" + Gift: + Addr: [ "127.0.0.1:9093" ] + Topic: "gift-dev" + GuardBuy: + Addr: [ "127.0.0.1:9093" ] + Topic: "guardBuy-dev" diff --git a/config-dev.yml b/config-dev.yml index 1326e22..9b720ff 100644 --- a/config-dev.yml +++ b/config-dev.yml @@ -1,6 +1,6 @@ Bilibili: Enabled: true - Type: official + Type: custom Official: Api: https://live-open.biliapi.com AkId: 1rVL1YRSoii28LJ1O7KIQqqQ @@ -10,15 +10,15 @@ Bilibili: GetRoomUrl: https://api.live.bilibili.com/room/v1/Room/room_init?id= HeartbeatInterval: 30 UserId: 111222 - RoomId: 6925399 + RoomId: 8722013 Log: Console: Level: debug Format: console File: Enabled: true - Level: info - Format: json + Level: debug + Format: console Path: ./logs Filename: live-gateway.log FileMaxSize: 10 # 10mb diff --git a/config/config.go b/config/config.go index d4d4aca..f6dcfe0 100644 --- a/config/config.go +++ b/config/config.go @@ -34,6 +34,7 @@ type ( Custom struct { Url string // 弹幕服务器url } + ResetInterval time.Duration // 重连间隔 GetRoomUrl string // 获取房间信息url RoomId int64 // 待连接roomId UserId int64 // 用于连接的userId,0则随机生成 diff --git a/live/live.go b/live/live.go index afea7aa..5a66718 100644 --- a/live/live.go +++ b/live/live.go @@ -118,3 +118,7 @@ func (l *Live) Serve() error { } } } + +func (l *Live) ReConnect() { + l.Nws.CloseAndReConnect() +} diff --git a/main.go b/main.go index a8e86e1..b4a79e8 100644 --- a/main.go +++ b/main.go @@ -7,6 +7,7 @@ import ( "live-gateway/bilibili" "live-gateway/config" "sync" + "time" ) var configFile = flag.String("f", "./config.yml", "the config file") @@ -24,14 +25,25 @@ func main() { var wg sync.WaitGroup if config.Config.Bilibili.Enabled { - wg.Add(1) bLive := bilibili.NewLiveBilibili() + wg.Add(1) go func() { if err := bLive.Serve(); err != nil { logger.SLog.Error("err: ", err) wg.Done() } }() + + go func() { + // timer + timer := time.NewTimer(time.Second * config.Config.Bilibili.ResetInterval) + for { + select { + case <-timer.C: + bLive.ReConnect() + } + } + }() } wg.Wait() } diff --git a/pb/gen.bat b/pb/gen.bat index a9eb2ba..dcd3e70 100644 --- a/pb/gen.bat +++ b/pb/gen.bat @@ -1 +1,5 @@ -protoc --go_opt=paths=source_relative --go-grpc_opt=paths=source_relative --go-grpc_opt=require_unimplemented_servers=false --go_out=. --go-grpc_out=. --proto_path=. *.proto \ No newline at end of file +protoc --go_opt=paths=source_relative ^ + --go-grpc_opt=paths=source_relative ^ + --go-grpc_opt=require_unimplemented_servers=false ^ + --go_out=. --go-grpc_out=. --proto_path=. ^ + ./vars/*.proto ./mq/*.proto \ No newline at end of file diff --git a/pb/mq.pb.go b/pb/mq.pb.go deleted file mode 100644 index 62dab5d..0000000 --- a/pb/mq.pb.go +++ /dev/null @@ -1,701 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.27.1 -// protoc v3.19.4 -// source: mq.proto - -package pbMq - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type Platform int32 - -const ( - Platform_bilibili Platform = 0 // B站 - Platform_huya Platform = 1 // 虎牙 - Platform_douyu Platform = 2 // 斗鱼 - Platform_douyin Platform = 3 // 抖音 -) - -// Enum value maps for Platform. -var ( - Platform_name = map[int32]string{ - 0: "bilibili", - 1: "huya", - 2: "douyu", - 3: "douyin", - } - Platform_value = map[string]int32{ - "bilibili": 0, - "huya": 1, - "douyu": 2, - "douyin": 3, - } -) - -func (x Platform) Enum() *Platform { - p := new(Platform) - *p = x - return p -} - -func (x Platform) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (Platform) Descriptor() protoreflect.EnumDescriptor { - return file_mq_proto_enumTypes[0].Descriptor() -} - -func (Platform) Type() protoreflect.EnumType { - return &file_mq_proto_enumTypes[0] -} - -func (x Platform) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use Platform.Descriptor instead. -func (Platform) EnumDescriptor() ([]byte, []int) { - return file_mq_proto_rawDescGZIP(), []int{0} -} - -type MqNobilityBuy struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Platform string `protobuf:"bytes,1,opt,name=platform,proto3" json:"platform,omitempty"` // 平台 - LiveRoomId int64 `protobuf:"varint,2,opt,name=liveRoomId,proto3" json:"liveRoomId,omitempty"` // 直播间ID - Uid int64 `protobuf:"varint,3,opt,name=uid,proto3" json:"uid,omitempty"` // 用户ID - Uname string `protobuf:"bytes,4,opt,name=uname,proto3" json:"uname,omitempty"` // 用户名 - Avatar string `protobuf:"bytes,5,opt,name=avatar,proto3" json:"avatar,omitempty"` // 头像 - MsgId string `protobuf:"bytes,6,opt,name=msgId,proto3" json:"msgId,omitempty"` // 消息唯一ID - NobilityLevel int64 `protobuf:"varint,7,opt,name=nobilityLevel,proto3" json:"nobilityLevel,omitempty"` // 贵族等级 - Price int64 `protobuf:"varint,8,opt,name=price,proto3" json:"price,omitempty"` // 平台price - StartTime int64 `protobuf:"varint,9,opt,name=startTime,proto3" json:"startTime,omitempty"` // 开始时间 - EndTime int64 `protobuf:"varint,10,opt,name=endTime,proto3" json:"endTime,omitempty"` // 过期时间 - FansMedalWearingStatus bool `protobuf:"varint,11,opt,name=fansMedalWearingStatus,proto3" json:"fansMedalWearingStatus,omitempty"` // 牌子佩戴状态 - FansMedalName string `protobuf:"bytes,12,opt,name=fansMedalName,proto3" json:"fansMedalName,omitempty"` // 粉丝牌子名 - FansMedalLevel int64 `protobuf:"varint,13,opt,name=fansMedalLevel,proto3" json:"fansMedalLevel,omitempty"` // 粉丝牌子等级 -} - -func (x *MqNobilityBuy) Reset() { - *x = MqNobilityBuy{} - if protoimpl.UnsafeEnabled { - mi := &file_mq_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MqNobilityBuy) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MqNobilityBuy) ProtoMessage() {} - -func (x *MqNobilityBuy) ProtoReflect() protoreflect.Message { - mi := &file_mq_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MqNobilityBuy.ProtoReflect.Descriptor instead. -func (*MqNobilityBuy) Descriptor() ([]byte, []int) { - return file_mq_proto_rawDescGZIP(), []int{0} -} - -func (x *MqNobilityBuy) GetPlatform() string { - if x != nil { - return x.Platform - } - return "" -} - -func (x *MqNobilityBuy) GetLiveRoomId() int64 { - if x != nil { - return x.LiveRoomId - } - return 0 -} - -func (x *MqNobilityBuy) GetUid() int64 { - if x != nil { - return x.Uid - } - return 0 -} - -func (x *MqNobilityBuy) GetUname() string { - if x != nil { - return x.Uname - } - return "" -} - -func (x *MqNobilityBuy) GetAvatar() string { - if x != nil { - return x.Avatar - } - return "" -} - -func (x *MqNobilityBuy) GetMsgId() string { - if x != nil { - return x.MsgId - } - return "" -} - -func (x *MqNobilityBuy) GetNobilityLevel() int64 { - if x != nil { - return x.NobilityLevel - } - return 0 -} - -func (x *MqNobilityBuy) GetPrice() int64 { - if x != nil { - return x.Price - } - return 0 -} - -func (x *MqNobilityBuy) GetStartTime() int64 { - if x != nil { - return x.StartTime - } - return 0 -} - -func (x *MqNobilityBuy) GetEndTime() int64 { - if x != nil { - return x.EndTime - } - return 0 -} - -func (x *MqNobilityBuy) GetFansMedalWearingStatus() bool { - if x != nil { - return x.FansMedalWearingStatus - } - return false -} - -func (x *MqNobilityBuy) GetFansMedalName() string { - if x != nil { - return x.FansMedalName - } - return "" -} - -func (x *MqNobilityBuy) GetFansMedalLevel() int64 { - if x != nil { - return x.FansMedalLevel - } - return 0 -} - -type MqDanmaku struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Platform string `protobuf:"bytes,1,opt,name=platform,proto3" json:"platform,omitempty"` // 平台 - LiveRoomId int64 `protobuf:"varint,2,opt,name=liveRoomId,proto3" json:"liveRoomId,omitempty"` // 直播间ID - Uid int64 `protobuf:"varint,3,opt,name=uid,proto3" json:"uid,omitempty"` // 用户ID - Uname string `protobuf:"bytes,4,opt,name=uname,proto3" json:"uname,omitempty"` // 用户名 - Avatar string `protobuf:"bytes,5,opt,name=avatar,proto3" json:"avatar,omitempty"` // 头像 - Msg string `protobuf:"bytes,6,opt,name=msg,proto3" json:"msg,omitempty"` // 内容 - MsgId string `protobuf:"bytes,7,opt,name=msgId,proto3" json:"msgId,omitempty"` // 消息唯一ID - Timestamp int64 `protobuf:"varint,8,opt,name=timestamp,proto3" json:"timestamp,omitempty"` // 发送时间 - NobilityLevel int64 `protobuf:"varint,9,opt,name=nobilityLevel,proto3" json:"nobilityLevel,omitempty"` // 贵族等级 - FansMedalWearingStatus bool `protobuf:"varint,10,opt,name=fansMedalWearingStatus,proto3" json:"fansMedalWearingStatus,omitempty"` // 牌子佩戴状态 - FansMedalName string `protobuf:"bytes,11,opt,name=fansMedalName,proto3" json:"fansMedalName,omitempty"` // 粉丝牌子名 - FansMedalLevel int64 `protobuf:"varint,12,opt,name=fansMedalLevel,proto3" json:"fansMedalLevel,omitempty"` // 粉丝牌子等级 -} - -func (x *MqDanmaku) Reset() { - *x = MqDanmaku{} - if protoimpl.UnsafeEnabled { - mi := &file_mq_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MqDanmaku) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MqDanmaku) ProtoMessage() {} - -func (x *MqDanmaku) ProtoReflect() protoreflect.Message { - mi := &file_mq_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MqDanmaku.ProtoReflect.Descriptor instead. -func (*MqDanmaku) Descriptor() ([]byte, []int) { - return file_mq_proto_rawDescGZIP(), []int{1} -} - -func (x *MqDanmaku) GetPlatform() string { - if x != nil { - return x.Platform - } - return "" -} - -func (x *MqDanmaku) GetLiveRoomId() int64 { - if x != nil { - return x.LiveRoomId - } - return 0 -} - -func (x *MqDanmaku) GetUid() int64 { - if x != nil { - return x.Uid - } - return 0 -} - -func (x *MqDanmaku) GetUname() string { - if x != nil { - return x.Uname - } - return "" -} - -func (x *MqDanmaku) GetAvatar() string { - if x != nil { - return x.Avatar - } - return "" -} - -func (x *MqDanmaku) GetMsg() string { - if x != nil { - return x.Msg - } - return "" -} - -func (x *MqDanmaku) GetMsgId() string { - if x != nil { - return x.MsgId - } - return "" -} - -func (x *MqDanmaku) GetTimestamp() int64 { - if x != nil { - return x.Timestamp - } - return 0 -} - -func (x *MqDanmaku) GetNobilityLevel() int64 { - if x != nil { - return x.NobilityLevel - } - return 0 -} - -func (x *MqDanmaku) GetFansMedalWearingStatus() bool { - if x != nil { - return x.FansMedalWearingStatus - } - return false -} - -func (x *MqDanmaku) GetFansMedalName() string { - if x != nil { - return x.FansMedalName - } - return "" -} - -func (x *MqDanmaku) GetFansMedalLevel() int64 { - if x != nil { - return x.FansMedalLevel - } - return 0 -} - -type MqGift struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Platform string `protobuf:"bytes,1,opt,name=platform,proto3" json:"platform,omitempty"` - LiveRoomId int64 `protobuf:"varint,2,opt,name=liveRoomId,proto3" json:"liveRoomId,omitempty"` - Uid int64 `protobuf:"varint,3,opt,name=uid,proto3" json:"uid,omitempty"` - Uname string `protobuf:"bytes,4,opt,name=uname,proto3" json:"uname,omitempty"` - Avatar string `protobuf:"bytes,5,opt,name=avatar,proto3" json:"avatar,omitempty"` // 头像 - GiftId int64 `protobuf:"varint,6,opt,name=giftId,proto3" json:"giftId,omitempty"` - GiftName string `protobuf:"bytes,7,opt,name=giftName,proto3" json:"giftName,omitempty"` - GiftNum int64 `protobuf:"varint,8,opt,name=giftNum,proto3" json:"giftNum,omitempty"` - Price int64 `protobuf:"varint,9,opt,name=price,proto3" json:"price,omitempty"` - IsPaid bool `protobuf:"varint,10,opt,name=isPaid,proto3" json:"isPaid,omitempty"` - MsgId string `protobuf:"bytes,11,opt,name=msgId,proto3" json:"msgId,omitempty"` // 消息唯一ID - Timestamp int64 `protobuf:"varint,12,opt,name=timestamp,proto3" json:"timestamp,omitempty"` // 收礼时间 - NobilityLevel int64 `protobuf:"varint,13,opt,name=nobilityLevel,proto3" json:"nobilityLevel,omitempty"` // 贵族等级 - FansMedalWearingStatus bool `protobuf:"varint,14,opt,name=fansMedalWearingStatus,proto3" json:"fansMedalWearingStatus,omitempty"` // 牌子佩戴状态 - FansMedalName string `protobuf:"bytes,15,opt,name=fansMedalName,proto3" json:"fansMedalName,omitempty"` // 粉丝牌子名 - FansMedalLevel int64 `protobuf:"varint,16,opt,name=fansMedalLevel,proto3" json:"fansMedalLevel,omitempty"` // 粉丝牌子等级 -} - -func (x *MqGift) Reset() { - *x = MqGift{} - if protoimpl.UnsafeEnabled { - mi := &file_mq_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MqGift) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MqGift) ProtoMessage() {} - -func (x *MqGift) ProtoReflect() protoreflect.Message { - mi := &file_mq_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MqGift.ProtoReflect.Descriptor instead. -func (*MqGift) Descriptor() ([]byte, []int) { - return file_mq_proto_rawDescGZIP(), []int{2} -} - -func (x *MqGift) GetPlatform() string { - if x != nil { - return x.Platform - } - return "" -} - -func (x *MqGift) GetLiveRoomId() int64 { - if x != nil { - return x.LiveRoomId - } - return 0 -} - -func (x *MqGift) GetUid() int64 { - if x != nil { - return x.Uid - } - return 0 -} - -func (x *MqGift) GetUname() string { - if x != nil { - return x.Uname - } - return "" -} - -func (x *MqGift) GetAvatar() string { - if x != nil { - return x.Avatar - } - return "" -} - -func (x *MqGift) GetGiftId() int64 { - if x != nil { - return x.GiftId - } - return 0 -} - -func (x *MqGift) GetGiftName() string { - if x != nil { - return x.GiftName - } - return "" -} - -func (x *MqGift) GetGiftNum() int64 { - if x != nil { - return x.GiftNum - } - return 0 -} - -func (x *MqGift) GetPrice() int64 { - if x != nil { - return x.Price - } - return 0 -} - -func (x *MqGift) GetIsPaid() bool { - if x != nil { - return x.IsPaid - } - return false -} - -func (x *MqGift) GetMsgId() string { - if x != nil { - return x.MsgId - } - return "" -} - -func (x *MqGift) GetTimestamp() int64 { - if x != nil { - return x.Timestamp - } - return 0 -} - -func (x *MqGift) GetNobilityLevel() int64 { - if x != nil { - return x.NobilityLevel - } - return 0 -} - -func (x *MqGift) GetFansMedalWearingStatus() bool { - if x != nil { - return x.FansMedalWearingStatus - } - return false -} - -func (x *MqGift) GetFansMedalName() string { - if x != nil { - return x.FansMedalName - } - return "" -} - -func (x *MqGift) GetFansMedalLevel() int64 { - if x != nil { - return x.FansMedalLevel - } - return 0 -} - -var File_mq_proto protoreflect.FileDescriptor - -var file_mq_proto_rawDesc = []byte{ - 0x0a, 0x08, 0x6d, 0x71, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0x9b, - 0x03, 0x0a, 0x0d, 0x4d, 0x71, 0x4e, 0x6f, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x42, 0x75, 0x79, - 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x08, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x1e, 0x0a, 0x0a, - 0x6c, 0x69, 0x76, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x0a, 0x6c, 0x69, 0x76, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, - 0x75, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x14, - 0x0a, 0x05, 0x75, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x75, - 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x05, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x12, 0x14, 0x0a, 0x05, - 0x6d, 0x73, 0x67, 0x49, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6d, 0x73, 0x67, - 0x49, 0x64, 0x12, 0x24, 0x0a, 0x0d, 0x6e, 0x6f, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x4c, 0x65, - 0x76, 0x65, 0x6c, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x6e, 0x6f, 0x62, 0x69, 0x6c, - 0x69, 0x74, 0x79, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x72, 0x69, 0x63, - 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x12, 0x1c, - 0x0a, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, - 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x65, - 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x36, 0x0a, 0x16, 0x66, 0x61, 0x6e, 0x73, 0x4d, 0x65, - 0x64, 0x61, 0x6c, 0x57, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, 0x16, 0x66, 0x61, 0x6e, 0x73, 0x4d, 0x65, 0x64, 0x61, - 0x6c, 0x57, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x24, - 0x0a, 0x0d, 0x66, 0x61, 0x6e, 0x73, 0x4d, 0x65, 0x64, 0x61, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x18, - 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x66, 0x61, 0x6e, 0x73, 0x4d, 0x65, 0x64, 0x61, 0x6c, - 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x26, 0x0a, 0x0e, 0x66, 0x61, 0x6e, 0x73, 0x4d, 0x65, 0x64, 0x61, - 0x6c, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x66, 0x61, - 0x6e, 0x73, 0x4d, 0x65, 0x64, 0x61, 0x6c, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x22, 0xf9, 0x02, 0x0a, - 0x09, 0x4d, 0x71, 0x44, 0x61, 0x6e, 0x6d, 0x61, 0x6b, 0x75, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6c, - 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x6c, - 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x1e, 0x0a, 0x0a, 0x6c, 0x69, 0x76, 0x65, 0x52, 0x6f, - 0x6f, 0x6d, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x6c, 0x69, 0x76, 0x65, - 0x52, 0x6f, 0x6f, 0x6d, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x75, 0x6e, 0x61, 0x6d, - 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x75, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, - 0x0a, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, - 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x18, 0x06, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73, 0x67, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x73, 0x67, 0x49, - 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6d, 0x73, 0x67, 0x49, 0x64, 0x12, 0x1c, - 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x08, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x24, 0x0a, 0x0d, - 0x6e, 0x6f, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x09, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x0d, 0x6e, 0x6f, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x4c, 0x65, 0x76, - 0x65, 0x6c, 0x12, 0x36, 0x0a, 0x16, 0x66, 0x61, 0x6e, 0x73, 0x4d, 0x65, 0x64, 0x61, 0x6c, 0x57, - 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x0a, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x16, 0x66, 0x61, 0x6e, 0x73, 0x4d, 0x65, 0x64, 0x61, 0x6c, 0x57, 0x65, 0x61, - 0x72, 0x69, 0x6e, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x24, 0x0a, 0x0d, 0x66, 0x61, - 0x6e, 0x73, 0x4d, 0x65, 0x64, 0x61, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0d, 0x66, 0x61, 0x6e, 0x73, 0x4d, 0x65, 0x64, 0x61, 0x6c, 0x4e, 0x61, 0x6d, 0x65, - 0x12, 0x26, 0x0a, 0x0e, 0x66, 0x61, 0x6e, 0x73, 0x4d, 0x65, 0x64, 0x61, 0x6c, 0x4c, 0x65, 0x76, - 0x65, 0x6c, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x66, 0x61, 0x6e, 0x73, 0x4d, 0x65, - 0x64, 0x61, 0x6c, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x22, 0xe0, 0x03, 0x0a, 0x06, 0x4d, 0x71, 0x47, - 0x69, 0x66, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, - 0x1e, 0x0a, 0x0a, 0x6c, 0x69, 0x76, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x49, 0x64, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x0a, 0x6c, 0x69, 0x76, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x49, 0x64, 0x12, - 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x75, 0x69, - 0x64, 0x12, 0x14, 0x0a, 0x05, 0x75, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x05, 0x75, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, - 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x12, - 0x16, 0x0a, 0x06, 0x67, 0x69, 0x66, 0x74, 0x49, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x06, 0x67, 0x69, 0x66, 0x74, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x67, 0x69, 0x66, 0x74, 0x4e, - 0x61, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x67, 0x69, 0x66, 0x74, 0x4e, - 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x67, 0x69, 0x66, 0x74, 0x4e, 0x75, 0x6d, 0x18, 0x08, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x67, 0x69, 0x66, 0x74, 0x4e, 0x75, 0x6d, 0x12, 0x14, 0x0a, - 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x70, 0x72, - 0x69, 0x63, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x50, 0x61, 0x69, 0x64, 0x18, 0x0a, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x73, 0x50, 0x61, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x6d, - 0x73, 0x67, 0x49, 0x64, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6d, 0x73, 0x67, 0x49, - 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x0c, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, - 0x24, 0x0a, 0x0d, 0x6e, 0x6f, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x4c, 0x65, 0x76, 0x65, 0x6c, - 0x18, 0x0d, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x6e, 0x6f, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, - 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x36, 0x0a, 0x16, 0x66, 0x61, 0x6e, 0x73, 0x4d, 0x65, 0x64, - 0x61, 0x6c, 0x57, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, - 0x0e, 0x20, 0x01, 0x28, 0x08, 0x52, 0x16, 0x66, 0x61, 0x6e, 0x73, 0x4d, 0x65, 0x64, 0x61, 0x6c, - 0x57, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x24, 0x0a, - 0x0d, 0x66, 0x61, 0x6e, 0x73, 0x4d, 0x65, 0x64, 0x61, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x0f, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x66, 0x61, 0x6e, 0x73, 0x4d, 0x65, 0x64, 0x61, 0x6c, 0x4e, - 0x61, 0x6d, 0x65, 0x12, 0x26, 0x0a, 0x0e, 0x66, 0x61, 0x6e, 0x73, 0x4d, 0x65, 0x64, 0x61, 0x6c, - 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x10, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x66, 0x61, 0x6e, - 0x73, 0x4d, 0x65, 0x64, 0x61, 0x6c, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x2a, 0x39, 0x0a, 0x08, 0x50, - 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x0c, 0x0a, 0x08, 0x62, 0x69, 0x6c, 0x69, 0x62, - 0x69, 0x6c, 0x69, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x68, 0x75, 0x79, 0x61, 0x10, 0x01, 0x12, - 0x09, 0x0a, 0x05, 0x64, 0x6f, 0x75, 0x79, 0x75, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x64, 0x6f, - 0x75, 0x79, 0x69, 0x6e, 0x10, 0x03, 0x42, 0x07, 0x5a, 0x05, 0x2f, 0x70, 0x62, 0x4d, 0x71, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_mq_proto_rawDescOnce sync.Once - file_mq_proto_rawDescData = file_mq_proto_rawDesc -) - -func file_mq_proto_rawDescGZIP() []byte { - file_mq_proto_rawDescOnce.Do(func() { - file_mq_proto_rawDescData = protoimpl.X.CompressGZIP(file_mq_proto_rawDescData) - }) - return file_mq_proto_rawDescData -} - -var file_mq_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_mq_proto_msgTypes = make([]protoimpl.MessageInfo, 3) -var file_mq_proto_goTypes = []interface{}{ - (Platform)(0), // 0: pb.Platform - (*MqNobilityBuy)(nil), // 1: pb.MqNobilityBuy - (*MqDanmaku)(nil), // 2: pb.MqDanmaku - (*MqGift)(nil), // 3: pb.MqGift -} -var file_mq_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_mq_proto_init() } -func file_mq_proto_init() { - if File_mq_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_mq_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MqNobilityBuy); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_mq_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MqDanmaku); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_mq_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MqGift); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_mq_proto_rawDesc, - NumEnums: 1, - NumMessages: 3, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_mq_proto_goTypes, - DependencyIndexes: file_mq_proto_depIdxs, - EnumInfos: file_mq_proto_enumTypes, - MessageInfos: file_mq_proto_msgTypes, - }.Build() - File_mq_proto = out.File - file_mq_proto_rawDesc = nil - file_mq_proto_goTypes = nil - file_mq_proto_depIdxs = nil -} diff --git a/pb/mq/mq.pb.go b/pb/mq/mq.pb.go new file mode 100644 index 0000000..1ca9a5a --- /dev/null +++ b/pb/mq/mq.pb.go @@ -0,0 +1,794 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.27.1 +// protoc v3.19.4 +// source: mq/mq.proto + +package pbMq + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type MqGift_Type int32 + +const ( + MqGift_NORMAL MqGift_Type = 0 + MqGift_PACK MqGift_Type = 1 // 包裹类,白银宝箱一类的礼物 + MqGift_RED_PACK MqGift_Type = 2 // 红包类,抽放给观众的礼物 +) + +// Enum value maps for MqGift_Type. +var ( + MqGift_Type_name = map[int32]string{ + 0: "NORMAL", + 1: "PACK", + 2: "RED_PACK", + } + MqGift_Type_value = map[string]int32{ + "NORMAL": 0, + "PACK": 1, + "RED_PACK": 2, + } +) + +func (x MqGift_Type) Enum() *MqGift_Type { + p := new(MqGift_Type) + *p = x + return p +} + +func (x MqGift_Type) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (MqGift_Type) Descriptor() protoreflect.EnumDescriptor { + return file_mq_mq_proto_enumTypes[0].Descriptor() +} + +func (MqGift_Type) Type() protoreflect.EnumType { + return &file_mq_mq_proto_enumTypes[0] +} + +func (x MqGift_Type) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use MqGift_Type.Descriptor instead. +func (MqGift_Type) EnumDescriptor() ([]byte, []int) { + return file_mq_mq_proto_rawDescGZIP(), []int{2, 0} +} + +type MqNobilityBuy struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Platform string `protobuf:"bytes,1,opt,name=platform,proto3" json:"platform,omitempty"` // 平台 + LiveRoomId int64 `protobuf:"varint,2,opt,name=liveRoomId,proto3" json:"liveRoomId,omitempty"` // 直播间ID + Uid int64 `protobuf:"varint,3,opt,name=uid,proto3" json:"uid,omitempty"` // 用户ID + Uname string `protobuf:"bytes,4,opt,name=uname,proto3" json:"uname,omitempty"` // 用户名 + Avatar string `protobuf:"bytes,5,opt,name=avatar,proto3" json:"avatar,omitempty"` // 头像 + MsgId string `protobuf:"bytes,6,opt,name=msgId,proto3" json:"msgId,omitempty"` // 消息唯一ID + NobilityLevel int64 `protobuf:"varint,7,opt,name=nobilityLevel,proto3" json:"nobilityLevel,omitempty"` // 贵族等级 + Price int64 `protobuf:"varint,8,opt,name=price,proto3" json:"price,omitempty"` // 平台price + StartTime int64 `protobuf:"varint,9,opt,name=startTime,proto3" json:"startTime,omitempty"` // 开始时间 + EndTime int64 `protobuf:"varint,10,opt,name=endTime,proto3" json:"endTime,omitempty"` // 过期时间 + FansMedalWearingStatus bool `protobuf:"varint,11,opt,name=fansMedalWearingStatus,proto3" json:"fansMedalWearingStatus,omitempty"` // 牌子佩戴状态 + FansMedalName string `protobuf:"bytes,12,opt,name=fansMedalName,proto3" json:"fansMedalName,omitempty"` // 粉丝牌子名 + FansMedalLevel int64 `protobuf:"varint,13,opt,name=fansMedalLevel,proto3" json:"fansMedalLevel,omitempty"` // 粉丝牌子等级 +} + +func (x *MqNobilityBuy) Reset() { + *x = MqNobilityBuy{} + if protoimpl.UnsafeEnabled { + mi := &file_mq_mq_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MqNobilityBuy) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MqNobilityBuy) ProtoMessage() {} + +func (x *MqNobilityBuy) ProtoReflect() protoreflect.Message { + mi := &file_mq_mq_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MqNobilityBuy.ProtoReflect.Descriptor instead. +func (*MqNobilityBuy) Descriptor() ([]byte, []int) { + return file_mq_mq_proto_rawDescGZIP(), []int{0} +} + +func (x *MqNobilityBuy) GetPlatform() string { + if x != nil { + return x.Platform + } + return "" +} + +func (x *MqNobilityBuy) GetLiveRoomId() int64 { + if x != nil { + return x.LiveRoomId + } + return 0 +} + +func (x *MqNobilityBuy) GetUid() int64 { + if x != nil { + return x.Uid + } + return 0 +} + +func (x *MqNobilityBuy) GetUname() string { + if x != nil { + return x.Uname + } + return "" +} + +func (x *MqNobilityBuy) GetAvatar() string { + if x != nil { + return x.Avatar + } + return "" +} + +func (x *MqNobilityBuy) GetMsgId() string { + if x != nil { + return x.MsgId + } + return "" +} + +func (x *MqNobilityBuy) GetNobilityLevel() int64 { + if x != nil { + return x.NobilityLevel + } + return 0 +} + +func (x *MqNobilityBuy) GetPrice() int64 { + if x != nil { + return x.Price + } + return 0 +} + +func (x *MqNobilityBuy) GetStartTime() int64 { + if x != nil { + return x.StartTime + } + return 0 +} + +func (x *MqNobilityBuy) GetEndTime() int64 { + if x != nil { + return x.EndTime + } + return 0 +} + +func (x *MqNobilityBuy) GetFansMedalWearingStatus() bool { + if x != nil { + return x.FansMedalWearingStatus + } + return false +} + +func (x *MqNobilityBuy) GetFansMedalName() string { + if x != nil { + return x.FansMedalName + } + return "" +} + +func (x *MqNobilityBuy) GetFansMedalLevel() int64 { + if x != nil { + return x.FansMedalLevel + } + return 0 +} + +type MqDanmaku struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Platform string `protobuf:"bytes,1,opt,name=platform,proto3" json:"platform,omitempty"` // 平台 + LiveRoomId int64 `protobuf:"varint,2,opt,name=liveRoomId,proto3" json:"liveRoomId,omitempty"` // 直播间ID + Uid int64 `protobuf:"varint,3,opt,name=uid,proto3" json:"uid,omitempty"` // 用户ID + Uname string `protobuf:"bytes,4,opt,name=uname,proto3" json:"uname,omitempty"` // 用户名 + Avatar string `protobuf:"bytes,5,opt,name=avatar,proto3" json:"avatar,omitempty"` // 头像 + Msg string `protobuf:"bytes,6,opt,name=msg,proto3" json:"msg,omitempty"` // 内容 + MsgId string `protobuf:"bytes,7,opt,name=msgId,proto3" json:"msgId,omitempty"` // 消息唯一ID + Timestamp int64 `protobuf:"varint,8,opt,name=timestamp,proto3" json:"timestamp,omitempty"` // 发送时间 + NobilityLevel int64 `protobuf:"varint,9,opt,name=nobilityLevel,proto3" json:"nobilityLevel,omitempty"` // 贵族等级 + FansMedalWearingStatus bool `protobuf:"varint,10,opt,name=fansMedalWearingStatus,proto3" json:"fansMedalWearingStatus,omitempty"` // 牌子佩戴状态 + FansMedalName string `protobuf:"bytes,11,opt,name=fansMedalName,proto3" json:"fansMedalName,omitempty"` // 粉丝牌子名 + FansMedalLevel int64 `protobuf:"varint,12,opt,name=fansMedalLevel,proto3" json:"fansMedalLevel,omitempty"` // 粉丝牌子等级 +} + +func (x *MqDanmaku) Reset() { + *x = MqDanmaku{} + if protoimpl.UnsafeEnabled { + mi := &file_mq_mq_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MqDanmaku) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MqDanmaku) ProtoMessage() {} + +func (x *MqDanmaku) ProtoReflect() protoreflect.Message { + mi := &file_mq_mq_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MqDanmaku.ProtoReflect.Descriptor instead. +func (*MqDanmaku) Descriptor() ([]byte, []int) { + return file_mq_mq_proto_rawDescGZIP(), []int{1} +} + +func (x *MqDanmaku) GetPlatform() string { + if x != nil { + return x.Platform + } + return "" +} + +func (x *MqDanmaku) GetLiveRoomId() int64 { + if x != nil { + return x.LiveRoomId + } + return 0 +} + +func (x *MqDanmaku) GetUid() int64 { + if x != nil { + return x.Uid + } + return 0 +} + +func (x *MqDanmaku) GetUname() string { + if x != nil { + return x.Uname + } + return "" +} + +func (x *MqDanmaku) GetAvatar() string { + if x != nil { + return x.Avatar + } + return "" +} + +func (x *MqDanmaku) GetMsg() string { + if x != nil { + return x.Msg + } + return "" +} + +func (x *MqDanmaku) GetMsgId() string { + if x != nil { + return x.MsgId + } + return "" +} + +func (x *MqDanmaku) GetTimestamp() int64 { + if x != nil { + return x.Timestamp + } + return 0 +} + +func (x *MqDanmaku) GetNobilityLevel() int64 { + if x != nil { + return x.NobilityLevel + } + return 0 +} + +func (x *MqDanmaku) GetFansMedalWearingStatus() bool { + if x != nil { + return x.FansMedalWearingStatus + } + return false +} + +func (x *MqDanmaku) GetFansMedalName() string { + if x != nil { + return x.FansMedalName + } + return "" +} + +func (x *MqDanmaku) GetFansMedalLevel() int64 { + if x != nil { + return x.FansMedalLevel + } + return 0 +} + +type MqGift struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Platform string `protobuf:"bytes,1,opt,name=platform,proto3" json:"platform,omitempty"` + LiveRoomId int64 `protobuf:"varint,2,opt,name=liveRoomId,proto3" json:"liveRoomId,omitempty"` + MsgId string `protobuf:"bytes,3,opt,name=msgId,proto3" json:"msgId,omitempty"` // 消息唯一ID + Timestamp int64 `protobuf:"varint,4,opt,name=timestamp,proto3" json:"timestamp,omitempty"` // 送礼时间 + Uid int64 `protobuf:"varint,5,opt,name=uid,proto3" json:"uid,omitempty"` + Uname string `protobuf:"bytes,6,opt,name=uname,proto3" json:"uname,omitempty"` + Avatar string `protobuf:"bytes,7,opt,name=avatar,proto3" json:"avatar,omitempty"` // 头像 + NobilityLevel int64 `protobuf:"varint,8,opt,name=nobilityLevel,proto3" json:"nobilityLevel,omitempty"` // 贵族等级 + GiftId int64 `protobuf:"varint,9,opt,name=giftId,proto3" json:"giftId,omitempty"` // 礼物ID + GiftName string `protobuf:"bytes,10,opt,name=giftName,proto3" json:"giftName,omitempty"` // 礼物名称 + GiftNum int64 `protobuf:"varint,11,opt,name=giftNum,proto3" json:"giftNum,omitempty"` // 单次送礼数量 + Price int64 `protobuf:"varint,12,opt,name=price,proto3" json:"price,omitempty"` // 平台礼物价值(平台货币) + IsPaid bool `protobuf:"varint,13,opt,name=isPaid,proto3" json:"isPaid,omitempty"` // 是否付费 + Type MqGift_Type `protobuf:"varint,14,opt,name=type,proto3,enum=pb.MqGift_Type" json:"type,omitempty"` // 礼物类型 + PackGift *MqGift_PackGift `protobuf:"bytes,15,opt,name=packGift,proto3" json:"packGift,omitempty"` + FansMedalWearingStatus bool `protobuf:"varint,20,opt,name=fansMedalWearingStatus,proto3" json:"fansMedalWearingStatus,omitempty"` // 牌子佩戴状态 + FansMedalName string `protobuf:"bytes,21,opt,name=fansMedalName,proto3" json:"fansMedalName,omitempty"` // 粉丝牌子名 + FansMedalLevel int64 `protobuf:"varint,22,opt,name=fansMedalLevel,proto3" json:"fansMedalLevel,omitempty"` // 粉丝牌子等级 +} + +func (x *MqGift) Reset() { + *x = MqGift{} + if protoimpl.UnsafeEnabled { + mi := &file_mq_mq_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MqGift) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MqGift) ProtoMessage() {} + +func (x *MqGift) ProtoReflect() protoreflect.Message { + mi := &file_mq_mq_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MqGift.ProtoReflect.Descriptor instead. +func (*MqGift) Descriptor() ([]byte, []int) { + return file_mq_mq_proto_rawDescGZIP(), []int{2} +} + +func (x *MqGift) GetPlatform() string { + if x != nil { + return x.Platform + } + return "" +} + +func (x *MqGift) GetLiveRoomId() int64 { + if x != nil { + return x.LiveRoomId + } + return 0 +} + +func (x *MqGift) GetMsgId() string { + if x != nil { + return x.MsgId + } + return "" +} + +func (x *MqGift) GetTimestamp() int64 { + if x != nil { + return x.Timestamp + } + return 0 +} + +func (x *MqGift) GetUid() int64 { + if x != nil { + return x.Uid + } + return 0 +} + +func (x *MqGift) GetUname() string { + if x != nil { + return x.Uname + } + return "" +} + +func (x *MqGift) GetAvatar() string { + if x != nil { + return x.Avatar + } + return "" +} + +func (x *MqGift) GetNobilityLevel() int64 { + if x != nil { + return x.NobilityLevel + } + return 0 +} + +func (x *MqGift) GetGiftId() int64 { + if x != nil { + return x.GiftId + } + return 0 +} + +func (x *MqGift) GetGiftName() string { + if x != nil { + return x.GiftName + } + return "" +} + +func (x *MqGift) GetGiftNum() int64 { + if x != nil { + return x.GiftNum + } + return 0 +} + +func (x *MqGift) GetPrice() int64 { + if x != nil { + return x.Price + } + return 0 +} + +func (x *MqGift) GetIsPaid() bool { + if x != nil { + return x.IsPaid + } + return false +} + +func (x *MqGift) GetType() MqGift_Type { + if x != nil { + return x.Type + } + return MqGift_NORMAL +} + +func (x *MqGift) GetPackGift() *MqGift_PackGift { + if x != nil { + return x.PackGift + } + return nil +} + +func (x *MqGift) GetFansMedalWearingStatus() bool { + if x != nil { + return x.FansMedalWearingStatus + } + return false +} + +func (x *MqGift) GetFansMedalName() string { + if x != nil { + return x.FansMedalName + } + return "" +} + +func (x *MqGift) GetFansMedalLevel() int64 { + if x != nil { + return x.FansMedalLevel + } + return 0 +} + +// 礼物(包裹) +type MqGift_PackGift struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + GiftId int64 `protobuf:"varint,1,opt,name=giftId,proto3" json:"giftId,omitempty"` + GiftName string `protobuf:"bytes,2,opt,name=giftName,proto3" json:"giftName,omitempty"` // 礼物名称 +} + +func (x *MqGift_PackGift) Reset() { + *x = MqGift_PackGift{} + if protoimpl.UnsafeEnabled { + mi := &file_mq_mq_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MqGift_PackGift) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MqGift_PackGift) ProtoMessage() {} + +func (x *MqGift_PackGift) ProtoReflect() protoreflect.Message { + mi := &file_mq_mq_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MqGift_PackGift.ProtoReflect.Descriptor instead. +func (*MqGift_PackGift) Descriptor() ([]byte, []int) { + return file_mq_mq_proto_rawDescGZIP(), []int{2, 0} +} + +func (x *MqGift_PackGift) GetGiftId() int64 { + if x != nil { + return x.GiftId + } + return 0 +} + +func (x *MqGift_PackGift) GetGiftName() string { + if x != nil { + return x.GiftName + } + return "" +} + +var File_mq_mq_proto protoreflect.FileDescriptor + +var file_mq_mq_proto_rawDesc = []byte{ + 0x0a, 0x0b, 0x6d, 0x71, 0x2f, 0x6d, 0x71, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, + 0x62, 0x22, 0x9b, 0x03, 0x0a, 0x0d, 0x4d, 0x71, 0x4e, 0x6f, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, + 0x42, 0x75, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, + 0x1e, 0x0a, 0x0a, 0x6c, 0x69, 0x76, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x49, 0x64, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x0a, 0x6c, 0x69, 0x76, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x49, 0x64, 0x12, + 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x75, 0x69, + 0x64, 0x12, 0x14, 0x0a, 0x05, 0x75, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x05, 0x75, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, + 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x12, + 0x14, 0x0a, 0x05, 0x6d, 0x73, 0x67, 0x49, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, + 0x6d, 0x73, 0x67, 0x49, 0x64, 0x12, 0x24, 0x0a, 0x0d, 0x6e, 0x6f, 0x62, 0x69, 0x6c, 0x69, 0x74, + 0x79, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x6e, 0x6f, + 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x70, + 0x72, 0x69, 0x63, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x70, 0x72, 0x69, 0x63, + 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x09, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, + 0x18, 0x0a, 0x07, 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x07, 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x36, 0x0a, 0x16, 0x66, 0x61, 0x6e, + 0x73, 0x4d, 0x65, 0x64, 0x61, 0x6c, 0x57, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x53, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, 0x16, 0x66, 0x61, 0x6e, 0x73, 0x4d, + 0x65, 0x64, 0x61, 0x6c, 0x57, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x12, 0x24, 0x0a, 0x0d, 0x66, 0x61, 0x6e, 0x73, 0x4d, 0x65, 0x64, 0x61, 0x6c, 0x4e, 0x61, + 0x6d, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x66, 0x61, 0x6e, 0x73, 0x4d, 0x65, + 0x64, 0x61, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x26, 0x0a, 0x0e, 0x66, 0x61, 0x6e, 0x73, 0x4d, + 0x65, 0x64, 0x61, 0x6c, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x0e, 0x66, 0x61, 0x6e, 0x73, 0x4d, 0x65, 0x64, 0x61, 0x6c, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x22, + 0xf9, 0x02, 0x0a, 0x09, 0x4d, 0x71, 0x44, 0x61, 0x6e, 0x6d, 0x61, 0x6b, 0x75, 0x12, 0x1a, 0x0a, + 0x08, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x1e, 0x0a, 0x0a, 0x6c, 0x69, 0x76, + 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x6c, + 0x69, 0x76, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x75, + 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x75, 0x6e, 0x61, 0x6d, + 0x65, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x73, 0x67, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73, 0x67, 0x12, 0x14, 0x0a, 0x05, 0x6d, + 0x73, 0x67, 0x49, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6d, 0x73, 0x67, 0x49, + 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x08, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, + 0x24, 0x0a, 0x0d, 0x6e, 0x6f, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x4c, 0x65, 0x76, 0x65, 0x6c, + 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x6e, 0x6f, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, + 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x36, 0x0a, 0x16, 0x66, 0x61, 0x6e, 0x73, 0x4d, 0x65, 0x64, + 0x61, 0x6c, 0x57, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, + 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x16, 0x66, 0x61, 0x6e, 0x73, 0x4d, 0x65, 0x64, 0x61, 0x6c, + 0x57, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x24, 0x0a, + 0x0d, 0x66, 0x61, 0x6e, 0x73, 0x4d, 0x65, 0x64, 0x61, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x0b, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x66, 0x61, 0x6e, 0x73, 0x4d, 0x65, 0x64, 0x61, 0x6c, 0x4e, + 0x61, 0x6d, 0x65, 0x12, 0x26, 0x0a, 0x0e, 0x66, 0x61, 0x6e, 0x73, 0x4d, 0x65, 0x64, 0x61, 0x6c, + 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x66, 0x61, 0x6e, + 0x73, 0x4d, 0x65, 0x64, 0x61, 0x6c, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x22, 0xa2, 0x05, 0x0a, 0x06, + 0x4d, 0x71, 0x47, 0x69, 0x66, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, + 0x72, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, + 0x72, 0x6d, 0x12, 0x1e, 0x0a, 0x0a, 0x6c, 0x69, 0x76, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x49, 0x64, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x6c, 0x69, 0x76, 0x65, 0x52, 0x6f, 0x6f, 0x6d, + 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x73, 0x67, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x05, 0x6d, 0x73, 0x67, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, + 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, + 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x75, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x75, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, + 0x0a, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, + 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x12, 0x24, 0x0a, 0x0d, 0x6e, 0x6f, 0x62, 0x69, 0x6c, 0x69, + 0x74, 0x79, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x6e, + 0x6f, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x16, 0x0a, 0x06, + 0x67, 0x69, 0x66, 0x74, 0x49, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x67, 0x69, + 0x66, 0x74, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x67, 0x69, 0x66, 0x74, 0x4e, 0x61, 0x6d, 0x65, + 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x67, 0x69, 0x66, 0x74, 0x4e, 0x61, 0x6d, 0x65, + 0x12, 0x18, 0x0a, 0x07, 0x67, 0x69, 0x66, 0x74, 0x4e, 0x75, 0x6d, 0x18, 0x0b, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x07, 0x67, 0x69, 0x66, 0x74, 0x4e, 0x75, 0x6d, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x72, + 0x69, 0x63, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, + 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x50, 0x61, 0x69, 0x64, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x06, 0x69, 0x73, 0x50, 0x61, 0x69, 0x64, 0x12, 0x23, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, + 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x4d, 0x71, 0x47, 0x69, + 0x66, 0x74, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x2f, 0x0a, + 0x08, 0x70, 0x61, 0x63, 0x6b, 0x47, 0x69, 0x66, 0x74, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x13, 0x2e, 0x70, 0x62, 0x2e, 0x4d, 0x71, 0x47, 0x69, 0x66, 0x74, 0x2e, 0x50, 0x61, 0x63, 0x6b, + 0x47, 0x69, 0x66, 0x74, 0x52, 0x08, 0x70, 0x61, 0x63, 0x6b, 0x47, 0x69, 0x66, 0x74, 0x12, 0x36, + 0x0a, 0x16, 0x66, 0x61, 0x6e, 0x73, 0x4d, 0x65, 0x64, 0x61, 0x6c, 0x57, 0x65, 0x61, 0x72, 0x69, + 0x6e, 0x67, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x14, 0x20, 0x01, 0x28, 0x08, 0x52, 0x16, + 0x66, 0x61, 0x6e, 0x73, 0x4d, 0x65, 0x64, 0x61, 0x6c, 0x57, 0x65, 0x61, 0x72, 0x69, 0x6e, 0x67, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x24, 0x0a, 0x0d, 0x66, 0x61, 0x6e, 0x73, 0x4d, 0x65, + 0x64, 0x61, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x15, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x66, + 0x61, 0x6e, 0x73, 0x4d, 0x65, 0x64, 0x61, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x26, 0x0a, 0x0e, + 0x66, 0x61, 0x6e, 0x73, 0x4d, 0x65, 0x64, 0x61, 0x6c, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x16, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x66, 0x61, 0x6e, 0x73, 0x4d, 0x65, 0x64, 0x61, 0x6c, 0x4c, + 0x65, 0x76, 0x65, 0x6c, 0x1a, 0x3e, 0x0a, 0x08, 0x50, 0x61, 0x63, 0x6b, 0x47, 0x69, 0x66, 0x74, + 0x12, 0x16, 0x0a, 0x06, 0x67, 0x69, 0x66, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x06, 0x67, 0x69, 0x66, 0x74, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x67, 0x69, 0x66, 0x74, + 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x67, 0x69, 0x66, 0x74, + 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x2a, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0a, 0x0a, 0x06, + 0x4e, 0x4f, 0x52, 0x4d, 0x41, 0x4c, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x50, 0x41, 0x43, 0x4b, + 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x52, 0x45, 0x44, 0x5f, 0x50, 0x41, 0x43, 0x4b, 0x10, 0x02, + 0x42, 0x07, 0x5a, 0x05, 0x2f, 0x70, 0x62, 0x4d, 0x71, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, +} + +var ( + file_mq_mq_proto_rawDescOnce sync.Once + file_mq_mq_proto_rawDescData = file_mq_mq_proto_rawDesc +) + +func file_mq_mq_proto_rawDescGZIP() []byte { + file_mq_mq_proto_rawDescOnce.Do(func() { + file_mq_mq_proto_rawDescData = protoimpl.X.CompressGZIP(file_mq_mq_proto_rawDescData) + }) + return file_mq_mq_proto_rawDescData +} + +var file_mq_mq_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_mq_mq_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_mq_mq_proto_goTypes = []interface{}{ + (MqGift_Type)(0), // 0: pb.MqGift.Type + (*MqNobilityBuy)(nil), // 1: pb.MqNobilityBuy + (*MqDanmaku)(nil), // 2: pb.MqDanmaku + (*MqGift)(nil), // 3: pb.MqGift + (*MqGift_PackGift)(nil), // 4: pb.MqGift.PackGift +} +var file_mq_mq_proto_depIdxs = []int32{ + 0, // 0: pb.MqGift.type:type_name -> pb.MqGift.Type + 4, // 1: pb.MqGift.packGift:type_name -> pb.MqGift.PackGift + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_mq_mq_proto_init() } +func file_mq_mq_proto_init() { + if File_mq_mq_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_mq_mq_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MqNobilityBuy); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_mq_mq_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MqDanmaku); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_mq_mq_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MqGift); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_mq_mq_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MqGift_PackGift); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_mq_mq_proto_rawDesc, + NumEnums: 1, + NumMessages: 4, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_mq_mq_proto_goTypes, + DependencyIndexes: file_mq_mq_proto_depIdxs, + EnumInfos: file_mq_mq_proto_enumTypes, + MessageInfos: file_mq_mq_proto_msgTypes, + }.Build() + File_mq_mq_proto = out.File + file_mq_mq_proto_rawDesc = nil + file_mq_mq_proto_goTypes = nil + file_mq_mq_proto_depIdxs = nil +} diff --git a/pb/mq.proto b/pb/mq/mq.proto similarity index 57% rename from pb/mq.proto rename to pb/mq/mq.proto index aa90997..54b87c3 100644 --- a/pb/mq.proto +++ b/pb/mq/mq.proto @@ -4,13 +4,6 @@ package pb; option go_package = "/pbMq"; -enum Platform { - bilibili = 0; // B站 - huya = 1; // 虎牙 - douyu = 2; // 斗鱼 - douyin = 3; // 抖音 -} - message MqNobilityBuy { string platform = 1; // 平台 int64 liveRoomId = 2; // 直播间ID @@ -38,28 +31,41 @@ message MqDanmaku { string msgId = 7; // 消息唯一ID int64 timestamp = 8; // 发送时间 int64 nobilityLevel = 9; // 贵族等级 + bool fansMedalWearingStatus = 10; // 牌子佩戴状态 string fansMedalName = 11; // 粉丝牌子名 int64 fansMedalLevel = 12; // 粉丝牌子等级 } message MqGift { + enum Type { + NORMAL = 0; + PACK = 1; // 包裹类,白银宝箱一类的礼物 + RED_PACK = 2; // 红包类,抽放给观众的礼物 + } + // 礼物(包裹) + message PackGift { + int64 giftId = 1; + string giftName = 2; // 礼物名称 + } string platform = 1; int64 liveRoomId = 2; - int64 uid = 3; - string uname = 4; - string avatar = 5; // 头像 + string msgId = 3; // 消息唯一ID + int64 timestamp = 4; // 送礼时间 + int64 uid = 5; + string uname = 6; + string avatar = 7; // 头像 + int64 nobilityLevel = 8; // 贵族等级 - int64 giftId = 6; - string giftName = 7; - int64 giftNum = 8; - int64 price = 9; - bool isPaid = 10; + int64 giftId = 9; // 礼物ID + string giftName = 10; // 礼物名称 + int64 giftNum = 11; // 单次送礼数量 + int64 price = 12; // 平台礼物价值(平台货币) + bool isPaid = 13; // 是否付费 + Type type = 14; // 礼物类型 + PackGift packGift = 15; - string msgId = 11; // 消息唯一ID - int64 timestamp = 12; // 收礼时间 - int64 nobilityLevel = 13; // 贵族等级 - bool fansMedalWearingStatus = 14; // 牌子佩戴状态 - string fansMedalName = 15; // 粉丝牌子名 - int64 fansMedalLevel = 16; // 粉丝牌子等级 + bool fansMedalWearingStatus = 20; // 牌子佩戴状态 + string fansMedalName = 21; // 粉丝牌子名 + int64 fansMedalLevel = 22; // 粉丝牌子等级 } \ No newline at end of file diff --git a/pb/vars/vars.proto b/pb/vars/vars.proto new file mode 100644 index 0000000..75eccca --- /dev/null +++ b/pb/vars/vars.proto @@ -0,0 +1,52 @@ +syntax = "proto3"; + +package pb.vars; + +option go_package = "dcg/game/pb/vars;pbVars"; + +enum Platform { + Bilibili = 0; // B站 + Huya = 1; // 虎牙 + Douyu = 2; // 斗鱼 + Tiktok = 3; // 抖音 +} + +enum UserCoinChangedReason { + ///// 消费 + Pay = 0; // 通用消费 + BuyBattleFood = 1; // 购买粮草 + BuyEliteUnit = 2; // 购买精英单位 + BuyTitle = 3; // 购买称号 + ///// 礼物 + SendGift = 4; // 赠送礼物 + BuyNobility = 5; // 购买贵族 + ///// 领取 + DrawGiftPack = 10; // 领取礼包 + CheckIn = 11; // 签到打卡 + ///// 游戏事件 + EventRankSubmit = 20; // 排行榜结算变动 + EventBattleEnd = 21; // 战局结束奖励 + ///// 其它事件 + Transfer = 30; // 转账 +} + +enum Goods { + Title = 0; // 称号 + Elite = 1; // 精英单位 +} + +enum RankType { + Unknown = 0; + Damage = 1; // 伤害榜 + DeDamage = 2; // 受伤榜 + General = 3; // 名将榜 + DeGeneral = 4; // 落马榜 + KillUnit = 5; // 小兵击杀 + DeKillUnit = 6; // 小兵被杀 + KillPlayer = 7; // 击杀玩家 + DeKillPlayer = 8; // 被杀榜 + Win = 9; // 获胜榜 + Lost = 10; // 战败榜 + FirstBlood = 11; // 一血榜 + DeFirstBlood = 12; // 被拿一血榜 +} \ No newline at end of file diff --git a/ws/connection.go b/ws/connection.go index 06596bb..1922f16 100644 --- a/ws/connection.go +++ b/ws/connection.go @@ -387,8 +387,8 @@ func (c *NWebsocket) wrapSendMessage(v interface{}) (*Entry, error) { return msg, nil } -// closeAndReConnect 断线重连 -func (c *NWebsocket) closeAndReConnect() { +// CloseAndReConnect 断线重连 +func (c *NWebsocket) CloseAndReConnect() { if c.Closed() { return } @@ -407,7 +407,7 @@ func (c *NWebsocket) readInternalLoop() { c.onDisconnected(err) } // 断线重连 - c.closeAndReConnect() + c.CloseAndReConnect() return } entry := &Entry{