feat: gift添加数量

main
NorthLan 3 years ago
parent c17423c37b
commit 617273fb86

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

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

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

@ -2,6 +2,7 @@ package main
import (
"flag"
"fmt"
"git.noahlan.cn/northlan/ntools-go/logger"
"live-gateway/bilibili"
"live-gateway/config"
@ -15,7 +16,9 @@ func main() {
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()
var wg sync.WaitGroup
@ -25,8 +28,8 @@ func main() {
bLive := bilibili.NewLiveBilibili()
go func() {
if err := bLive.Serve(); err != nil {
logger.SLog.Error("err", err)
wg.Done()
panic(err)
}
}()
}

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc-gen-go v1.27.1
// protoc v3.19.4
// source: mq.proto
@ -168,10 +168,11 @@ type MqGift struct {
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"`
GiftId int32 `protobuf:"varint,5,opt,name=giftId,proto3" json:"giftId,omitempty"`
GiftName string `protobuf:"bytes,6,opt,name=giftName,proto3" json:"giftName,omitempty"`
TotalCoin int64 `protobuf:"varint,7,opt,name=totalCoin,proto3" json:"totalCoin,omitempty"`
SendTime int64 `protobuf:"varint,8,opt,name=sendTime,proto3" json:"sendTime,omitempty"`
GiftId int64 `protobuf:"varint,5,opt,name=giftId,proto3" json:"giftId,omitempty"`
Num int64 `protobuf:"varint,6,opt,name=num,proto3" json:"num,omitempty"`
GiftName string `protobuf:"bytes,7,opt,name=giftName,proto3" json:"giftName,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() {
@ -234,13 +235,20 @@ func (x *MqGift) GetUname() string {
return ""
}
func (x *MqGift) GetGiftId() int32 {
func (x *MqGift) GetGiftId() int64 {
if x != nil {
return x.GiftId
}
return 0
}
func (x *MqGift) GetNum() int64 {
if x != nil {
return x.Num
}
return 0
}
func (x *MqGift) GetGiftName() string {
if x != nil {
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,
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, 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,
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,
@ -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,
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, 0x05, 0x52, 0x06, 0x67, 0x69, 0x66, 0x74, 0x49, 0x64, 0x12, 0x1a, 0x0a,
0x08, 0x67, 0x69, 0x66, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52,
0x08, 0x67, 0x69, 0x66, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x6f, 0x74,
0x61, 0x6c, 0x43, 0x6f, 0x69, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x6f,
0x74, 0x61, 0x6c, 0x43, 0x6f, 0x69, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x6e, 0x64, 0x54,
0x69, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x73, 0x65, 0x6e, 0x64, 0x54,
0x69, 0x6d, 0x65, 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,
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, 0x1c, 0x0a, 0x09, 0x74,
0x6f, 0x74, 0x61, 0x6c, 0x43, 0x6f, 0x69, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09,
0x74, 0x6f, 0x74, 0x61, 0x6c, 0x43, 0x6f, 0x69, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x6e,
0x64, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x73, 0x65, 0x6e,
0x64, 0x54, 0x69, 0x6d, 0x65, 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 (

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