diff --git a/protocol/webapi/common.pb.go b/protocol/webapi/common.pb.go index cbe90b3..6766cbc 100644 --- a/protocol/webapi/common.pb.go +++ b/protocol/webapi/common.pb.go @@ -9866,8 +9866,9 @@ type RedPacketConfig struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Platform string `protobuf:"bytes,1,opt,name=Platform,proto3" json:"Platform,omitempty"` // 平台 - List []*RedPacketInfo `protobuf:"bytes,4,rep,name=List,proto3" json:"List,omitempty"` // 活动列表 + Platform string `protobuf:"bytes,1,opt,name=Platform,proto3" json:"Platform,omitempty"` // 平台 + List []*RedPacketInfo `protobuf:"bytes,2,rep,name=List,proto3" json:"List,omitempty"` // 活动列表 + PlayerLimit int32 `protobuf:"varint,3,opt,name=PlayerLimit,proto3" json:"PlayerLimit,omitempty"` // 玩家最大领取红包次数 0无限制 } func (x *RedPacketConfig) Reset() { @@ -9916,22 +9917,28 @@ func (x *RedPacketConfig) GetList() []*RedPacketInfo { return nil } +func (x *RedPacketConfig) GetPlayerLimit() int32 { + if x != nil { + return x.PlayerLimit + } + return 0 +} + type RedPacketInfo struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id int64 `protobuf:"varint,1,opt,name=Id,proto3" json:"Id,omitempty"` // 配置id - On int32 `protobuf:"varint,2,opt,name=On,proto3" json:"On,omitempty"` // 开关 1开启 2关闭 - StartHMS int64 `protobuf:"varint,3,opt,name=StartHMS,proto3" json:"StartHMS,omitempty"` // 开始时间,时*10000 + 分*100 + 秒 - EndHMS int64 `protobuf:"varint,4,opt,name=EndHMS,proto3" json:"EndHMS,omitempty"` // 结束时间,时*10000 + 分*100 + 秒 - StayTs int64 `protobuf:"varint,5,opt,name=StayTs,proto3" json:"StayTs,omitempty"` // 持续时长,单位秒 - MaxCount int64 `protobuf:"varint,6,opt,name=MaxCount,proto3" json:"MaxCount,omitempty"` // 每人最大领取次数 0无限制 - LessCount int64 `protobuf:"varint,7,opt,name=LessCount,proto3" json:"LessCount,omitempty"` // 保底红包个数 - ItemId int32 `protobuf:"varint,8,opt,name=ItemId,proto3" json:"ItemId,omitempty"` // 奖励类型(道具id,100001金币 100002钻石) - TotalNum int64 `protobuf:"varint,9,opt,name=TotalNum,proto3" json:"TotalNum,omitempty"` // 总奖励数量 - RedList []*RedInfo `protobuf:"bytes,10,rep,name=RedList,proto3" json:"RedList,omitempty"` // 红包奖励列表 - PlayerLimit int32 `protobuf:"varint,11,opt,name=PlayerLimit,proto3" json:"PlayerLimit,omitempty"` // 玩家最大领取红包次数 0无限制 + Id int64 `protobuf:"varint,1,opt,name=Id,proto3" json:"Id,omitempty"` // 配置id + On int32 `protobuf:"varint,2,opt,name=On,proto3" json:"On,omitempty"` // 开关 1开启 2关闭 + StartHMS int64 `protobuf:"varint,3,opt,name=StartHMS,proto3" json:"StartHMS,omitempty"` // 开始时间,时*10000 + 分*100 + 秒 + EndHMS int64 `protobuf:"varint,4,opt,name=EndHMS,proto3" json:"EndHMS,omitempty"` // 结束时间,时*10000 + 分*100 + 秒 + StayTs int64 `protobuf:"varint,5,opt,name=StayTs,proto3" json:"StayTs,omitempty"` // 持续时长,单位秒 + MaxCount int64 `protobuf:"varint,6,opt,name=MaxCount,proto3" json:"MaxCount,omitempty"` // 每人最大领取次数 0无限制 + LessCount int64 `protobuf:"varint,7,opt,name=LessCount,proto3" json:"LessCount,omitempty"` // 保底红包个数 + ItemId int32 `protobuf:"varint,8,opt,name=ItemId,proto3" json:"ItemId,omitempty"` // 奖励类型(道具id,100001金币 100002钻石) + TotalNum int64 `protobuf:"varint,9,opt,name=TotalNum,proto3" json:"TotalNum,omitempty"` // 总奖励数量 + RedList []*RedInfo `protobuf:"bytes,10,rep,name=RedList,proto3" json:"RedList,omitempty"` // 红包奖励列表 } func (x *RedPacketInfo) Reset() { @@ -10036,13 +10043,6 @@ func (x *RedPacketInfo) GetRedList() []*RedInfo { return nil } -func (x *RedPacketInfo) GetPlayerLimit() int32 { - if x != nil { - return x.PlayerLimit - } - return 0 -} - type RedInfo struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -11625,32 +11625,32 @@ var file_protocol_webapi_common_proto_rawDesc = []byte{ 0x72, 0x6d, 0x12, 0x33, 0x0a, 0x08, 0x50, 0x72, 0x6f, 0x70, 0x49, 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x77, 0x65, 0x62, 0x61, 0x70, 0x69, 0x2e, 0x50, 0x69, 0x67, 0x42, 0x61, 0x6e, 0x6b, 0x50, 0x72, 0x6f, 0x70, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x50, - 0x72, 0x6f, 0x70, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x58, 0x0a, 0x0f, 0x52, 0x65, 0x64, 0x50, 0x61, + 0x72, 0x6f, 0x70, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x7a, 0x0a, 0x0f, 0x52, 0x65, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x50, 0x6c, - 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x29, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x04, + 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x29, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x77, 0x65, 0x62, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x65, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x4c, 0x69, 0x73, - 0x74, 0x22, 0xb6, 0x02, 0x0a, 0x0d, 0x52, 0x65, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x49, - 0x6e, 0x66, 0x6f, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x02, 0x49, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x4f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x02, 0x4f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x53, 0x74, 0x61, 0x72, 0x74, 0x48, 0x4d, 0x53, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x53, 0x74, 0x61, 0x72, 0x74, 0x48, 0x4d, 0x53, 0x12, - 0x16, 0x0a, 0x06, 0x45, 0x6e, 0x64, 0x48, 0x4d, 0x53, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x06, 0x45, 0x6e, 0x64, 0x48, 0x4d, 0x53, 0x12, 0x16, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x79, 0x54, - 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x53, 0x74, 0x61, 0x79, 0x54, 0x73, 0x12, - 0x1a, 0x0a, 0x08, 0x4d, 0x61, 0x78, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x08, 0x4d, 0x61, 0x78, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x4c, - 0x65, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, - 0x4c, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x49, 0x74, 0x65, - 0x6d, 0x49, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x49, 0x74, 0x65, 0x6d, 0x49, - 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x4e, 0x75, 0x6d, 0x18, 0x09, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x08, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x4e, 0x75, 0x6d, 0x12, 0x29, 0x0a, - 0x07, 0x52, 0x65, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, - 0x2e, 0x77, 0x65, 0x62, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x65, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x52, - 0x07, 0x52, 0x65, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x50, 0x6c, 0x61, 0x79, - 0x65, 0x72, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x50, - 0x6c, 0x61, 0x79, 0x65, 0x72, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x22, 0x2f, 0x0a, 0x07, 0x52, 0x65, + 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x4c, 0x69, 0x6d, 0x69, 0x74, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x4c, 0x69, + 0x6d, 0x69, 0x74, 0x22, 0x94, 0x02, 0x0a, 0x0d, 0x52, 0x65, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x65, + 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x02, 0x49, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x4f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x02, 0x4f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x53, 0x74, 0x61, 0x72, 0x74, 0x48, 0x4d, + 0x53, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x53, 0x74, 0x61, 0x72, 0x74, 0x48, 0x4d, + 0x53, 0x12, 0x16, 0x0a, 0x06, 0x45, 0x6e, 0x64, 0x48, 0x4d, 0x53, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x06, 0x45, 0x6e, 0x64, 0x48, 0x4d, 0x53, 0x12, 0x16, 0x0a, 0x06, 0x53, 0x74, 0x61, + 0x79, 0x54, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x53, 0x74, 0x61, 0x79, 0x54, + 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x4d, 0x61, 0x78, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x08, 0x4d, 0x61, 0x78, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1c, 0x0a, + 0x09, 0x4c, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x09, 0x4c, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x49, + 0x74, 0x65, 0x6d, 0x49, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x49, 0x74, 0x65, + 0x6d, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x4e, 0x75, 0x6d, 0x18, + 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x4e, 0x75, 0x6d, 0x12, + 0x29, 0x0a, 0x07, 0x52, 0x65, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x0f, 0x2e, 0x77, 0x65, 0x62, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x65, 0x64, 0x49, 0x6e, 0x66, + 0x6f, 0x52, 0x07, 0x52, 0x65, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x2f, 0x0a, 0x07, 0x52, 0x65, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x10, 0x0a, 0x03, 0x4e, 0x75, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x4e, 0x75, 0x6d, 0x12, 0x12, 0x0a, 0x04, 0x52, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x52, 0x61, 0x74, 0x65, 0x42, 0x26, 0x5a, 0x24, 0x6d, diff --git a/protocol/webapi/common.proto b/protocol/webapi/common.proto index 88ccb37..54c6b8d 100644 --- a/protocol/webapi/common.proto +++ b/protocol/webapi/common.proto @@ -1101,7 +1101,8 @@ message GamePigBankPropConfig{ // etcd /game/act_redpacket message RedPacketConfig{ string Platform = 1; // 平台 - repeated RedPacketInfo List = 4; // 活动列表 + repeated RedPacketInfo List = 2; // 活动列表 + int32 PlayerLimit = 3; // 玩家最大领取红包次数 0无限制 } message RedPacketInfo{ @@ -1115,7 +1116,6 @@ message RedPacketInfo{ int32 ItemId = 8; // 奖励类型(道具id,100001金币 100002钻石) int64 TotalNum = 9; // 总奖励数量 repeated RedInfo RedList = 10; // 红包奖励列表 - int32 PlayerLimit = 11; // 玩家最大领取红包次数 0无限制 } message RedInfo{ diff --git a/worldsrv/activity_redpacket.go b/worldsrv/activity_redpacket.go index 124d72d..d697b57 100644 --- a/worldsrv/activity_redpacket.go +++ b/worldsrv/activity_redpacket.go @@ -3,9 +3,9 @@ package main import ( "fmt" "golang.org/x/exp/maps" - "mongo.games.com/goserver/core/logger" "time" + "mongo.games.com/goserver/core/logger" "mongo.games.com/goserver/core/module" "mongo.games.com/game/common" @@ -134,15 +134,16 @@ func (m *RedPacketMgr) GetRemainTimesByConfig(p *Player, cfg *webapiproto.RedPac } var limit int32 - if cfg.GetPlayerLimit() > 0 && cfg.GetMaxCount() > 0 { - if cfg.GetPlayerLimit() < int32(cfg.GetMaxCount()) { - limit = cfg.GetPlayerLimit() + playerLimit := WelfareMgrSington.GetConfig(p.Platform).RedPacketConfig.GetPlayerLimit() + if playerLimit > 0 && cfg.GetMaxCount() > 0 { + if playerLimit < int32(cfg.GetMaxCount()) { + limit = playerLimit } else { limit = int32(cfg.GetMaxCount()) } } else { - if cfg.GetPlayerLimit() > 0 { - limit = cfg.GetPlayerLimit() + if playerLimit > 0 { + limit = playerLimit } if cfg.GetMaxCount() > 0 { limit = int32(cfg.GetMaxCount()) diff --git a/worldsrv/welfmgr.go b/worldsrv/welfmgr.go index 582b218..089edb7 100644 --- a/worldsrv/welfmgr.go +++ b/worldsrv/welfmgr.go @@ -2238,6 +2238,7 @@ func (this *WelfareMgr) GetRedPacket(p *Player, id int64) *welfare.SCRedPacketDr p.SendToClient(int(welfare.SPacketID_PACKET_SCRedPacketDraw), pack) } + playerLimit := this.GetConfig(p.Platform).RedPacketConfig.GetPlayerLimit() var cfg *webapi_proto.RedPacketInfo for _, v := range this.GetConfig(p.Platform).RedPacketConfig.GetList() { if v.GetId() == id { @@ -2261,7 +2262,7 @@ func (this *WelfareMgr) GetRedPacket(p *Player, id int64) *welfare.SCRedPacketDr } } - if cfg.GetPlayerLimit() > 0 && n >= int(cfg.GetPlayerLimit()) { + if playerLimit > 0 && n >= int(playerLimit) { Send(welfare.OpResultCode_OPRC_NoTimes) return pack }