add 红包活动
This commit is contained in:
parent
a95c6b6c90
commit
c00b794dc3
|
@ -9867,7 +9867,8 @@ type RedPacketConfig struct {
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
Platform string `protobuf:"bytes,1,opt,name=Platform,proto3" json:"Platform,omitempty"` // 平台
|
Platform string `protobuf:"bytes,1,opt,name=Platform,proto3" json:"Platform,omitempty"` // 平台
|
||||||
List []*RedPacketInfo `protobuf:"bytes,4,rep,name=List,proto3" json:"List,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() {
|
func (x *RedPacketConfig) Reset() {
|
||||||
|
@ -9916,6 +9917,13 @@ func (x *RedPacketConfig) GetList() []*RedPacketInfo {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *RedPacketConfig) GetPlayerLimit() int32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.PlayerLimit
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
type RedPacketInfo struct {
|
type RedPacketInfo struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
|
@ -9931,7 +9939,6 @@ type RedPacketInfo struct {
|
||||||
ItemId int32 `protobuf:"varint,8,opt,name=ItemId,proto3" json:"ItemId,omitempty"` // 奖励类型(道具id,100001金币 100002钻石)
|
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"` // 总奖励数量
|
TotalNum int64 `protobuf:"varint,9,opt,name=TotalNum,proto3" json:"TotalNum,omitempty"` // 总奖励数量
|
||||||
RedList []*RedInfo `protobuf:"bytes,10,rep,name=RedList,proto3" json:"RedList,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无限制
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *RedPacketInfo) Reset() {
|
func (x *RedPacketInfo) Reset() {
|
||||||
|
@ -10036,13 +10043,6 @@ func (x *RedPacketInfo) GetRedList() []*RedInfo {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *RedPacketInfo) GetPlayerLimit() int32 {
|
|
||||||
if x != nil {
|
|
||||||
return x.PlayerLimit
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
type RedInfo struct {
|
type RedInfo struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
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,
|
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,
|
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,
|
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,
|
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, 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,
|
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,
|
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,
|
0x74, 0x12, 0x20, 0x0a, 0x0b, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x4c, 0x69, 0x6d, 0x69, 0x74,
|
||||||
0x6e, 0x66, 0x6f, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52,
|
0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x50, 0x6c, 0x61, 0x79, 0x65, 0x72, 0x4c, 0x69,
|
||||||
0x02, 0x49, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x4f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52,
|
0x6d, 0x69, 0x74, 0x22, 0x94, 0x02, 0x0a, 0x0d, 0x52, 0x65, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x65,
|
||||||
0x02, 0x4f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x53, 0x74, 0x61, 0x72, 0x74, 0x48, 0x4d, 0x53, 0x18,
|
0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||||
0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x53, 0x74, 0x61, 0x72, 0x74, 0x48, 0x4d, 0x53, 0x12,
|
0x03, 0x52, 0x02, 0x49, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x4f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||||
0x16, 0x0a, 0x06, 0x45, 0x6e, 0x64, 0x48, 0x4d, 0x53, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52,
|
0x05, 0x52, 0x02, 0x4f, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x53, 0x74, 0x61, 0x72, 0x74, 0x48, 0x4d,
|
||||||
0x06, 0x45, 0x6e, 0x64, 0x48, 0x4d, 0x53, 0x12, 0x16, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x79, 0x54,
|
0x53, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x53, 0x74, 0x61, 0x72, 0x74, 0x48, 0x4d,
|
||||||
0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x53, 0x74, 0x61, 0x79, 0x54, 0x73, 0x12,
|
0x53, 0x12, 0x16, 0x0a, 0x06, 0x45, 0x6e, 0x64, 0x48, 0x4d, 0x53, 0x18, 0x04, 0x20, 0x01, 0x28,
|
||||||
0x1a, 0x0a, 0x08, 0x4d, 0x61, 0x78, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28,
|
0x03, 0x52, 0x06, 0x45, 0x6e, 0x64, 0x48, 0x4d, 0x53, 0x12, 0x16, 0x0a, 0x06, 0x53, 0x74, 0x61,
|
||||||
0x03, 0x52, 0x08, 0x4d, 0x61, 0x78, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x4c,
|
0x79, 0x54, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x53, 0x74, 0x61, 0x79, 0x54,
|
||||||
0x65, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09,
|
0x73, 0x12, 0x1a, 0x0a, 0x08, 0x4d, 0x61, 0x78, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x06, 0x20,
|
||||||
0x4c, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x49, 0x74, 0x65,
|
0x01, 0x28, 0x03, 0x52, 0x08, 0x4d, 0x61, 0x78, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1c, 0x0a,
|
||||||
0x6d, 0x49, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x49, 0x74, 0x65, 0x6d, 0x49,
|
0x09, 0x4c, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03,
|
||||||
0x64, 0x12, 0x1a, 0x0a, 0x08, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x4e, 0x75, 0x6d, 0x18, 0x09, 0x20,
|
0x52, 0x09, 0x4c, 0x65, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x49,
|
||||||
0x01, 0x28, 0x03, 0x52, 0x08, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x4e, 0x75, 0x6d, 0x12, 0x29, 0x0a,
|
0x74, 0x65, 0x6d, 0x49, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x49, 0x74, 0x65,
|
||||||
0x07, 0x52, 0x65, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f,
|
0x6d, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x4e, 0x75, 0x6d, 0x18,
|
||||||
0x2e, 0x77, 0x65, 0x62, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x65, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x52,
|
0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x4e, 0x75, 0x6d, 0x12,
|
||||||
0x07, 0x52, 0x65, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x50, 0x6c, 0x61, 0x79,
|
0x29, 0x0a, 0x07, 0x52, 0x65, 0x64, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b,
|
||||||
0x65, 0x72, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x50,
|
0x32, 0x0f, 0x2e, 0x77, 0x65, 0x62, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x65, 0x64, 0x49, 0x6e, 0x66,
|
||||||
0x6c, 0x61, 0x79, 0x65, 0x72, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x22, 0x2f, 0x0a, 0x07, 0x52, 0x65,
|
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,
|
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,
|
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,
|
0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x52, 0x61, 0x74, 0x65, 0x42, 0x26, 0x5a, 0x24, 0x6d,
|
||||||
|
|
|
@ -1101,7 +1101,8 @@ message GamePigBankPropConfig{
|
||||||
// etcd /game/act_redpacket
|
// etcd /game/act_redpacket
|
||||||
message RedPacketConfig{
|
message RedPacketConfig{
|
||||||
string Platform = 1; // 平台
|
string Platform = 1; // 平台
|
||||||
repeated RedPacketInfo List = 4; // 活动列表
|
repeated RedPacketInfo List = 2; // 活动列表
|
||||||
|
int32 PlayerLimit = 3; // 玩家最大领取红包次数 0无限制
|
||||||
}
|
}
|
||||||
|
|
||||||
message RedPacketInfo{
|
message RedPacketInfo{
|
||||||
|
@ -1115,7 +1116,6 @@ message RedPacketInfo{
|
||||||
int32 ItemId = 8; // 奖励类型(道具id,100001金币 100002钻石)
|
int32 ItemId = 8; // 奖励类型(道具id,100001金币 100002钻石)
|
||||||
int64 TotalNum = 9; // 总奖励数量
|
int64 TotalNum = 9; // 总奖励数量
|
||||||
repeated RedInfo RedList = 10; // 红包奖励列表
|
repeated RedInfo RedList = 10; // 红包奖励列表
|
||||||
int32 PlayerLimit = 11; // 玩家最大领取红包次数 0无限制
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message RedInfo{
|
message RedInfo{
|
||||||
|
|
|
@ -3,9 +3,9 @@ package main
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"golang.org/x/exp/maps"
|
"golang.org/x/exp/maps"
|
||||||
"mongo.games.com/goserver/core/logger"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"mongo.games.com/goserver/core/logger"
|
||||||
"mongo.games.com/goserver/core/module"
|
"mongo.games.com/goserver/core/module"
|
||||||
|
|
||||||
"mongo.games.com/game/common"
|
"mongo.games.com/game/common"
|
||||||
|
@ -134,15 +134,16 @@ func (m *RedPacketMgr) GetRemainTimesByConfig(p *Player, cfg *webapiproto.RedPac
|
||||||
}
|
}
|
||||||
|
|
||||||
var limit int32
|
var limit int32
|
||||||
if cfg.GetPlayerLimit() > 0 && cfg.GetMaxCount() > 0 {
|
playerLimit := WelfareMgrSington.GetConfig(p.Platform).RedPacketConfig.GetPlayerLimit()
|
||||||
if cfg.GetPlayerLimit() < int32(cfg.GetMaxCount()) {
|
if playerLimit > 0 && cfg.GetMaxCount() > 0 {
|
||||||
limit = cfg.GetPlayerLimit()
|
if playerLimit < int32(cfg.GetMaxCount()) {
|
||||||
|
limit = playerLimit
|
||||||
} else {
|
} else {
|
||||||
limit = int32(cfg.GetMaxCount())
|
limit = int32(cfg.GetMaxCount())
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if cfg.GetPlayerLimit() > 0 {
|
if playerLimit > 0 {
|
||||||
limit = cfg.GetPlayerLimit()
|
limit = playerLimit
|
||||||
}
|
}
|
||||||
if cfg.GetMaxCount() > 0 {
|
if cfg.GetMaxCount() > 0 {
|
||||||
limit = int32(cfg.GetMaxCount())
|
limit = int32(cfg.GetMaxCount())
|
||||||
|
|
|
@ -2238,6 +2238,7 @@ func (this *WelfareMgr) GetRedPacket(p *Player, id int64) *welfare.SCRedPacketDr
|
||||||
p.SendToClient(int(welfare.SPacketID_PACKET_SCRedPacketDraw), pack)
|
p.SendToClient(int(welfare.SPacketID_PACKET_SCRedPacketDraw), pack)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
playerLimit := this.GetConfig(p.Platform).RedPacketConfig.GetPlayerLimit()
|
||||||
var cfg *webapi_proto.RedPacketInfo
|
var cfg *webapi_proto.RedPacketInfo
|
||||||
for _, v := range this.GetConfig(p.Platform).RedPacketConfig.GetList() {
|
for _, v := range this.GetConfig(p.Platform).RedPacketConfig.GetList() {
|
||||||
if v.GetId() == id {
|
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)
|
Send(welfare.OpResultCode_OPRC_NoTimes)
|
||||||
return pack
|
return pack
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue