From 657f3c800deb0d594c43efeff2d5068374adf3a2 Mon Sep 17 00:00:00 2001 From: NorthLan <6995syu@163.com> Date: Sat, 28 May 2022 01:09:31 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E8=88=B0=E9=95=BF?= =?UTF-8?q?=E8=B4=AD=E4=B9=B0=E8=A7=A3=E6=9E=90=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bilibili/live.go | 2 +- bilibili/msg_handler/guard_buy.go | 68 +++++++++ config-dev.yml | 5 +- config/config.go | 5 +- pb/mq.pb.go | 244 ++++++++++++++++++++++++------ pb/mq.proto | 14 ++ 6 files changed, 291 insertions(+), 47 deletions(-) create mode 100644 bilibili/msg_handler/guard_buy.go diff --git a/bilibili/live.go b/bilibili/live.go index 294a5e9..22828ea 100644 --- a/bilibili/live.go +++ b/bilibili/live.go @@ -101,8 +101,8 @@ func (l *LiveBilibili) PreConnect() (url string, err error) { l.AddMessageHandler( msg_handler.NewDanmakuHandler(l.RoomInfo.RoomId), msg_handler.NewSendGiftHandler(l.RoomInfo.RoomId), + msg_handler.NewGuardBuyHandler(l.RoomInfo.RoomId), //&msg_handler.InterActWordHandler{}, - //&msg_handler.SendGiftHandler{}, ) return } diff --git a/bilibili/msg_handler/guard_buy.go b/bilibili/msg_handler/guard_buy.go new file mode 100644 index 0000000..cfb2d32 --- /dev/null +++ b/bilibili/msg_handler/guard_buy.go @@ -0,0 +1,68 @@ +package msg_handler + +import ( + "encoding/json" + "git.noahlan.cn/northlan/ntools-go/kafka" + "git.noahlan.cn/northlan/ntools-go/logger" + "live-gateway/config" + "live-gateway/pb" + kfk "live-gateway/pkg/kafka" + "strconv" +) + +type GuardBuy struct { + Uid int64 `json:"uid"` // 用户ID + Uname string `json:"username"` // 用户名 + GuardLevel int32 `json:"guard_level"` // 等级(3舰长 1总督) + Num int32 `json:"num"` // 数量 + Price int64 `json:"price"` // 价格 金瓜子 + GiftId int64 `json:"gift_id"` // 礼物ID + GiftName string `json:"gift_name"` // 礼物名 + StartTime int64 `json:"start_time"` // 开始时间 + EndTime int64 `json:"end_time"` // 结束时间 +} + +type GuardBuyHandler struct { + producer *kafka.Producer + liveRoomId int64 +} + +func NewGuardBuyHandler(liveRoomId int64) *GuardBuyHandler { + cfg := config.Config.Kafka.GuardBuy + return &GuardBuyHandler{ + producer: kafka.NewKafkaProducer(kfk.DefaultProducerConfig, cfg.Addr, cfg.Topic), + liveRoomId: liveRoomId, + } +} + +func (h *GuardBuyHandler) CMD() string { + return "GUARD_BUY" +} + +func (h *GuardBuyHandler) HandlerMessage(data []byte) { + var baseMsg struct { + CMD string `json:"cmd"` + Data *GuardBuy `json:"data"` + } + if err := json.Unmarshal(data, &baseMsg); err != nil { + return + } + + logger.SLog.Infof("%s 购买 %s x %d", baseMsg.Data.Uname, baseMsg.Data.GiftName, baseMsg.Data.Num) + + dmMsg := &pbMq.MqGuardBuy{ + Platform: pbMq.Platform_name[int32(pbMq.Platform_bilibili)], + LiveRoomId: h.liveRoomId, + Uid: baseMsg.Data.Uid, + Uname: baseMsg.Data.Uname, + GuardLevel: baseMsg.Data.GuardLevel, + Num: baseMsg.Data.Num, + Price: baseMsg.Data.Price, + GiftId: baseMsg.Data.GiftId, + GiftName: baseMsg.Data.GiftName, + StartTime: baseMsg.Data.StartTime, + EndTime: baseMsg.Data.EndTime, + } + + _ = h.producer.SendMessageAsync(dmMsg, strconv.FormatInt(dmMsg.Uid, 10)) +} diff --git a/config-dev.yml b/config-dev.yml index 3e50bc6..835c712 100644 --- a/config-dev.yml +++ b/config-dev.yml @@ -21,8 +21,11 @@ Log: Compress: true # 压缩日志 Kafka: Danmaku: - Addr: ["127.0.0.1:9093"] + 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/config.go b/config/config.go index 37ba713..37e1309 100644 --- a/config/config.go +++ b/config/config.go @@ -31,8 +31,9 @@ type ( } // Kafka 队列配置 Kafka struct { - Danmaku Kafka - Gift Kafka + Danmaku Kafka + Gift Kafka + GuardBuy Kafka } } ) diff --git a/pb/mq.pb.go b/pb/mq.pb.go index 619471a..9cc6dc0 100644 --- a/pb/mq.pb.go +++ b/pb/mq.pb.go @@ -72,6 +72,133 @@ func (Platform) EnumDescriptor() ([]byte, []int) { return file_mq_proto_rawDescGZIP(), []int{0} } +type MqGuardBuy 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"` + GuardLevel int32 `protobuf:"varint,5,opt,name=guardLevel,proto3" json:"guardLevel,omitempty"` + Num int32 `protobuf:"varint,6,opt,name=num,proto3" json:"num,omitempty"` + Price int64 `protobuf:"varint,7,opt,name=price,proto3" json:"price,omitempty"` + GiftId int64 `protobuf:"varint,8,opt,name=giftId,proto3" json:"giftId,omitempty"` + GiftName string `protobuf:"bytes,9,opt,name=giftName,proto3" json:"giftName,omitempty"` + StartTime int64 `protobuf:"varint,10,opt,name=startTime,proto3" json:"startTime,omitempty"` + EndTime int64 `protobuf:"varint,11,opt,name=endTime,proto3" json:"endTime,omitempty"` +} + +func (x *MqGuardBuy) Reset() { + *x = MqGuardBuy{} + if protoimpl.UnsafeEnabled { + mi := &file_mq_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MqGuardBuy) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MqGuardBuy) ProtoMessage() {} + +func (x *MqGuardBuy) 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 MqGuardBuy.ProtoReflect.Descriptor instead. +func (*MqGuardBuy) Descriptor() ([]byte, []int) { + return file_mq_proto_rawDescGZIP(), []int{0} +} + +func (x *MqGuardBuy) GetPlatform() string { + if x != nil { + return x.Platform + } + return "" +} + +func (x *MqGuardBuy) GetLiveRoomId() int64 { + if x != nil { + return x.LiveRoomId + } + return 0 +} + +func (x *MqGuardBuy) GetUid() int64 { + if x != nil { + return x.Uid + } + return 0 +} + +func (x *MqGuardBuy) GetUname() string { + if x != nil { + return x.Uname + } + return "" +} + +func (x *MqGuardBuy) GetGuardLevel() int32 { + if x != nil { + return x.GuardLevel + } + return 0 +} + +func (x *MqGuardBuy) GetNum() int32 { + if x != nil { + return x.Num + } + return 0 +} + +func (x *MqGuardBuy) GetPrice() int64 { + if x != nil { + return x.Price + } + return 0 +} + +func (x *MqGuardBuy) GetGiftId() int64 { + if x != nil { + return x.GiftId + } + return 0 +} + +func (x *MqGuardBuy) GetGiftName() string { + if x != nil { + return x.GiftName + } + return "" +} + +func (x *MqGuardBuy) GetStartTime() int64 { + if x != nil { + return x.StartTime + } + return 0 +} + +func (x *MqGuardBuy) GetEndTime() int64 { + if x != nil { + return x.EndTime + } + return 0 +} + type MqDanmaku struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -88,7 +215,7 @@ type MqDanmaku struct { func (x *MqDanmaku) Reset() { *x = MqDanmaku{} if protoimpl.UnsafeEnabled { - mi := &file_mq_proto_msgTypes[0] + mi := &file_mq_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -101,7 +228,7 @@ func (x *MqDanmaku) String() string { func (*MqDanmaku) ProtoMessage() {} func (x *MqDanmaku) ProtoReflect() protoreflect.Message { - mi := &file_mq_proto_msgTypes[0] + mi := &file_mq_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -114,7 +241,7 @@ func (x *MqDanmaku) ProtoReflect() protoreflect.Message { // Deprecated: Use MqDanmaku.ProtoReflect.Descriptor instead. func (*MqDanmaku) Descriptor() ([]byte, []int) { - return file_mq_proto_rawDescGZIP(), []int{0} + return file_mq_proto_rawDescGZIP(), []int{1} } func (x *MqDanmaku) GetPlatform() string { @@ -178,7 +305,7 @@ type MqGift struct { func (x *MqGift) Reset() { *x = MqGift{} if protoimpl.UnsafeEnabled { - mi := &file_mq_proto_msgTypes[1] + mi := &file_mq_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -191,7 +318,7 @@ func (x *MqGift) String() string { func (*MqGift) ProtoMessage() {} func (x *MqGift) ProtoReflect() protoreflect.Message { - mi := &file_mq_proto_msgTypes[1] + mi := &file_mq_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -204,7 +331,7 @@ func (x *MqGift) ProtoReflect() protoreflect.Message { // Deprecated: Use MqGift.ProtoReflect.Descriptor instead. func (*MqGift) Descriptor() ([]byte, []int) { - return file_mq_proto_rawDescGZIP(), []int{1} + return file_mq_proto_rawDescGZIP(), []int{2} } func (x *MqGift) GetPlatform() string { @@ -273,37 +400,55 @@ func (x *MqGift) GetIsPaid() bool { 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, 0xa5, - 0x01, 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, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, - 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x73, 0x65, - 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x22, 0xe0, 0x01, 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, 0x67, 0x69, 0x66, 0x74, 0x49, 0x64, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x67, 0x69, 0x66, 0x74, 0x49, 0x64, 0x12, 0x10, 0x0a, - 0x03, 0x6e, 0x75, 0x6d, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6e, 0x75, 0x6d, 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, 0x14, 0x0a, 0x05, 0x70, - 0x72, 0x69, 0x63, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x70, 0x72, 0x69, 0x63, - 0x65, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x50, 0x61, 0x69, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, - 0x08, 0x52, 0x06, 0x69, 0x73, 0x50, 0x61, 0x69, 0x64, 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, + 0x0a, 0x08, 0x6d, 0x71, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0xa4, + 0x02, 0x0a, 0x0a, 0x4d, 0x71, 0x47, 0x75, 0x61, 0x72, 0x64, 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, 0x1e, 0x0a, 0x0a, 0x67, 0x75, 0x61, 0x72, 0x64, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x67, 0x75, 0x61, 0x72, 0x64, 0x4c, 0x65, 0x76, 0x65, + 0x6c, 0x12, 0x10, 0x0a, 0x03, 0x6e, 0x75, 0x6d, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, + 0x6e, 0x75, 0x6d, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x07, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x67, 0x69, 0x66, + 0x74, 0x49, 0x64, 0x18, 0x08, 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, 0x09, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x08, 0x67, 0x69, 0x66, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, + 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x0a, 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, 0x0b, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x65, 0x6e, + 0x64, 0x54, 0x69, 0x6d, 0x65, 0x22, 0xa5, 0x01, 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, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, + 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, + 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x08, 0x73, 0x65, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x22, 0xe0, 0x01, + 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, + 0x67, 0x69, 0x66, 0x74, 0x49, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x67, 0x69, + 0x66, 0x74, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x6e, 0x75, 0x6d, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x03, 0x6e, 0x75, 0x6d, 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, 0x14, 0x0a, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x50, 0x61, + 0x69, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x73, 0x50, 0x61, 0x69, 0x64, + 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 ( @@ -319,11 +464,12 @@ func file_mq_proto_rawDescGZIP() []byte { } var file_mq_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_mq_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_mq_proto_msgTypes = make([]protoimpl.MessageInfo, 3) var file_mq_proto_goTypes = []interface{}{ - (Platform)(0), // 0: pb.Platform - (*MqDanmaku)(nil), // 1: pb.MqDanmaku - (*MqGift)(nil), // 2: pb.MqGift + (Platform)(0), // 0: pb.Platform + (*MqGuardBuy)(nil), // 1: pb.MqGuardBuy + (*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 @@ -340,7 +486,7 @@ func file_mq_proto_init() { } if !protoimpl.UnsafeEnabled { file_mq_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MqDanmaku); i { + switch v := v.(*MqGuardBuy); i { case 0: return &v.state case 1: @@ -352,6 +498,18 @@ func file_mq_proto_init() { } } 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 @@ -370,7 +528,7 @@ func file_mq_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_mq_proto_rawDesc, NumEnums: 1, - NumMessages: 2, + NumMessages: 3, NumExtensions: 0, NumServices: 0, }, diff --git a/pb/mq.proto b/pb/mq.proto index ca33987..7a6931f 100644 --- a/pb/mq.proto +++ b/pb/mq.proto @@ -11,6 +11,20 @@ enum Platform { douyin = 3; // 抖音 } +message MqGuardBuy { + string platform = 1; + int64 liveRoomId = 2; + int64 uid = 3; + string uname = 4; + int32 guardLevel = 5; + int32 num = 6; + int64 price = 7; + int64 giftId = 8; + string giftName = 9; + int64 startTime = 10; + int64 endTime = 11; +} + message MqDanmaku { string platform = 1; int64 liveRoomId = 2;