add 红包活动

This commit is contained in:
sk 2025-01-02 09:51:44 +08:00
parent a95c6b6c90
commit c00b794dc3
4 changed files with 53 additions and 51 deletions

View File

@ -9867,7 +9867,8 @@ type RedPacketConfig struct {
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"` // 活动列表
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,6 +9917,13 @@ 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
@ -9931,7 +9939,6 @@ type RedPacketInfo struct {
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无限制
}
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,

View File

@ -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{

View File

@ -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())

View File

@ -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
}