feat: gift添加数量

main
NorthLan 3 years ago
parent c17423c37b
commit 617273fb86

@ -30,7 +30,7 @@ type SendGift struct {
Effect int `json:"effect"` // ??? Effect int `json:"effect"` // ???
EffectBlock int `json:"effect_block"` // ??? EffectBlock int `json:"effect_block"` // ???
Face string `json:"face"` // 头像? Face string `json:"face"` // 头像?
GiftId int `json:"giftId"` // 礼物ID GiftId int64 `json:"giftId"` // 礼物ID
GiftName string `json:"giftName"` // 礼物名称 GiftName string `json:"giftName"` // 礼物名称
GiftType int `json:"giftType"` // 礼物类型 普通,弹幕,活动 GiftType int `json:"giftType"` // 礼物类型 普通,弹幕,活动
Gold int `json:"gold"` // 用户剩余金瓜子 Gold int `json:"gold"` // 用户剩余金瓜子
@ -40,7 +40,7 @@ type SendGift struct {
Magnification int `json:"magnification"` // 是否放大??? Magnification int `json:"magnification"` // 是否放大???
MedalInfo *FansMedal `json:"medal_info"` // 佩戴勋章的主播信息 MedalInfo *FansMedal `json:"medal_info"` // 佩戴勋章的主播信息
NameColor string `json:"name_color"` // 名 颜色 NameColor string `json:"name_color"` // 名 颜色
Num int `json:"num"` // 数量 Num int64 `json:"num"` // 数量
OriginalGiftName string `json:"original_gift_name"` // 原始礼物名称??? OriginalGiftName string `json:"original_gift_name"` // 原始礼物名称???
Price int `json:"price"` // 价格? 但不是电池 Price int `json:"price"` // 价格? 但不是电池
RCost int `json:"rcost"` // ??? RCost int `json:"rcost"` // ???
@ -93,7 +93,8 @@ func (h *SendGiftHandler) HandlerMessage(data []byte) {
LiveRoomId: h.liveRoomId, LiveRoomId: h.liveRoomId,
Uid: int64(baseMsg.Data.Uid), Uid: int64(baseMsg.Data.Uid),
Uname: baseMsg.Data.Uname, Uname: baseMsg.Data.Uname,
GiftId: int32(baseMsg.Data.GiftId), GiftId: baseMsg.Data.GiftId,
Num: baseMsg.Data.Num,
GiftName: baseMsg.Data.GiftName, GiftName: baseMsg.Data.GiftName,
TotalCoin: int64(baseMsg.Data.TotalCoin), TotalCoin: int64(baseMsg.Data.TotalCoin),
SendTime: int64(baseMsg.Data.Timestamp), SendTime: int64(baseMsg.Data.Timestamp),

@ -10,7 +10,7 @@ Log:
Level: info Level: info
Format: console Format: console
File: File:
Enabled: false Enabled: true
Level: info Level: info
Format: json Format: json
Path: ./logs Path: ./logs

@ -43,10 +43,12 @@ func Init(filepath string) {
err = c.LoadFiles(filepath) err = c.LoadFiles(filepath)
if err != nil { if err != nil {
fmt.Println("读取配置文件错误", err)
panic(err) panic(err)
} }
err = c.BindStruct("", &Config) err = c.BindStruct("", &Config)
if err != nil { if err != nil {
fmt.Println("解析配置文件错误", err)
panic(err) panic(err)
} }

@ -2,6 +2,7 @@ package main
import ( import (
"flag" "flag"
"fmt"
"git.noahlan.cn/northlan/ntools-go/logger" "git.noahlan.cn/northlan/ntools-go/logger"
"live-gateway/bilibili" "live-gateway/bilibili"
"live-gateway/config" "live-gateway/config"
@ -15,7 +16,9 @@ func main() {
config.Init(*configFile) config.Init(*configFile)
_ = logger.InitLogger(&config.Config.Log.File, &config.Config.Log.Console) if err := logger.InitLogger(&config.Config.Log.File, &config.Config.Log.Console); err != nil {
fmt.Println("初始化logger错误", err)
}
defer logger.Sync() defer logger.Sync()
var wg sync.WaitGroup var wg sync.WaitGroup
@ -25,8 +28,8 @@ func main() {
bLive := bilibili.NewLiveBilibili() bLive := bilibili.NewLiveBilibili()
go func() { go func() {
if err := bLive.Serve(); err != nil { if err := bLive.Serve(); err != nil {
logger.SLog.Error("err", err)
wg.Done() wg.Done()
panic(err)
} }
}() }()
} }

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.28.0 // protoc-gen-go v1.27.1
// protoc v3.19.4 // protoc v3.19.4
// source: mq.proto // source: mq.proto
@ -168,10 +168,11 @@ type MqGift struct {
LiveRoomId int64 `protobuf:"varint,2,opt,name=liveRoomId,proto3" json:"liveRoomId,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"` Uid int64 `protobuf:"varint,3,opt,name=uid,proto3" json:"uid,omitempty"`
Uname string `protobuf:"bytes,4,opt,name=uname,proto3" json:"uname,omitempty"` Uname string `protobuf:"bytes,4,opt,name=uname,proto3" json:"uname,omitempty"`
GiftId int32 `protobuf:"varint,5,opt,name=giftId,proto3" json:"giftId,omitempty"` GiftId int64 `protobuf:"varint,5,opt,name=giftId,proto3" json:"giftId,omitempty"`
GiftName string `protobuf:"bytes,6,opt,name=giftName,proto3" json:"giftName,omitempty"` Num int64 `protobuf:"varint,6,opt,name=num,proto3" json:"num,omitempty"`
TotalCoin int64 `protobuf:"varint,7,opt,name=totalCoin,proto3" json:"totalCoin,omitempty"` GiftName string `protobuf:"bytes,7,opt,name=giftName,proto3" json:"giftName,omitempty"`
SendTime int64 `protobuf:"varint,8,opt,name=sendTime,proto3" json:"sendTime,omitempty"` TotalCoin int64 `protobuf:"varint,8,opt,name=totalCoin,proto3" json:"totalCoin,omitempty"`
SendTime int64 `protobuf:"varint,9,opt,name=sendTime,proto3" json:"sendTime,omitempty"`
} }
func (x *MqGift) Reset() { func (x *MqGift) Reset() {
@ -234,13 +235,20 @@ func (x *MqGift) GetUname() string {
return "" return ""
} }
func (x *MqGift) GetGiftId() int32 { func (x *MqGift) GetGiftId() int64 {
if x != nil { if x != nil {
return x.GiftId return x.GiftId
} }
return 0 return 0
} }
func (x *MqGift) GetNum() int64 {
if x != nil {
return x.Num
}
return 0
}
func (x *MqGift) GetGiftName() string { func (x *MqGift) GetGiftName() string {
if x != nil { if x != nil {
return x.GiftName return x.GiftName
@ -276,7 +284,7 @@ var file_mq_proto_rawDesc = []byte{
0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 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, 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, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x73, 0x65,
0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x22, 0xda, 0x01, 0x0a, 0x06, 0x4d, 0x71, 0x47, 0x69, 0x66, 0x6e, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x22, 0xec, 0x01, 0x0a, 0x06, 0x4d, 0x71, 0x47, 0x69, 0x66,
0x74, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x18, 0x01, 0x20, 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, 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, 0x0a, 0x6c, 0x69, 0x76, 0x65, 0x52, 0x6f, 0x6f, 0x6d, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28,
@ -284,17 +292,19 @@ var file_mq_proto_rawDesc = []byte{
0x03, 0x75, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 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, 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, 0x75, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x67, 0x69, 0x66, 0x74, 0x49, 0x64, 0x18,
0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x67, 0x69, 0x66, 0x74, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x67, 0x69, 0x66, 0x74, 0x49, 0x64, 0x12, 0x10, 0x0a,
0x08, 0x67, 0x69, 0x66, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6e, 0x75, 0x6d, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x6e, 0x75, 0x6d, 0x12,
0x08, 0x67, 0x69, 0x66, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x6f, 0x74, 0x1a, 0x0a, 0x08, 0x67, 0x69, 0x66, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28,
0x61, 0x6c, 0x43, 0x6f, 0x69, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x6f, 0x09, 0x52, 0x08, 0x67, 0x69, 0x66, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x74,
0x74, 0x61, 0x6c, 0x43, 0x6f, 0x69, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x43, 0x6f, 0x69, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09,
0x69, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x73, 0x65, 0x6e, 0x64, 0x54, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x43, 0x6f, 0x69, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x6e,
0x69, 0x6d, 0x65, 0x2a, 0x39, 0x0a, 0x08, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x73, 0x65, 0x6e,
0x0c, 0x0a, 0x08, 0x62, 0x69, 0x6c, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x2a, 0x39, 0x0a, 0x08, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72,
0x04, 0x68, 0x75, 0x79, 0x61, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x64, 0x6f, 0x75, 0x79, 0x75, 0x6d, 0x12, 0x0c, 0x0a, 0x08, 0x62, 0x69, 0x6c, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x10, 0x00, 0x12,
0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x64, 0x6f, 0x75, 0x79, 0x69, 0x6e, 0x10, 0x03, 0x42, 0x07, 0x08, 0x0a, 0x04, 0x68, 0x75, 0x79, 0x61, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x64, 0x6f, 0x75,
0x5a, 0x05, 0x2f, 0x70, 0x62, 0x4d, 0x71, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 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 ( var (

@ -25,8 +25,9 @@ message MqGift {
int64 liveRoomId = 2; int64 liveRoomId = 2;
int64 uid = 3; int64 uid = 3;
string uname = 4; string uname = 4;
int32 giftId = 5; int64 giftId = 5;
string giftName = 6; int64 num = 6;
int64 totalCoin = 7; string giftName = 7;
int64 sendTime = 8; int64 totalCoin = 8;
int64 sendTime = 9;
} }
Loading…
Cancel
Save