79 lines
1.5 KiB
Go
79 lines
1.5 KiB
Go
package model
|
|
|
|
import webapiproto "mongo.games.com/game/protocol/webapi"
|
|
|
|
/*
|
|
通用模型定义在这里,如果需要自定义可以内嵌在新结构体中
|
|
*/
|
|
|
|
const (
|
|
OpAll = 0
|
|
OpTurnplate = 1
|
|
OpBlindBox = 2
|
|
OpFirstPay = 3
|
|
OpContinuousPay = 4
|
|
OpPhoneLottery = 5
|
|
OpCollect = 6
|
|
)
|
|
|
|
const (
|
|
WelfareNil = 0 // 不处理
|
|
WelfareOpen = 1 // 开启
|
|
WelfareClose = 2 // 关闭
|
|
)
|
|
|
|
func NewConfigMgr() *ConfigMgr {
|
|
return &ConfigMgr{
|
|
Platform: make(map[string]*AllConfig),
|
|
Global: new(GlobalConfig),
|
|
}
|
|
}
|
|
|
|
type AllConfig struct {
|
|
// 七日签到
|
|
*webapiproto.Welfare7SignDateList
|
|
// 转盘
|
|
*webapiproto.WelfareTurnplateDateList
|
|
// 盲盒
|
|
*webapiproto.WelfareBlindBoxDataList
|
|
BlindBoxCycle int32
|
|
// 首充
|
|
*webapiproto.WelfareFirstPayDataList
|
|
FirstPayCycle int32
|
|
// 连续充值
|
|
*webapiproto.WelfareContinuousPayDataList
|
|
ContinuousPayCycle int32
|
|
// 积分换手机
|
|
*webapiproto.WelfarePhoneLotteryStatus
|
|
// 集卡活动
|
|
*webapiproto.WelfareCollectConfig
|
|
// 个人水池
|
|
*webapiproto.PlayerPool
|
|
// 游戏调控全局配置
|
|
*webapiproto.GameConfig
|
|
}
|
|
|
|
type GlobalConfig struct {
|
|
}
|
|
|
|
type ConfigMgr struct {
|
|
Platform map[string]*AllConfig
|
|
Global *GlobalConfig
|
|
}
|
|
|
|
func (cm *ConfigMgr) GetAllConfig(platform string) *AllConfig {
|
|
c, ok := cm.Platform[platform]
|
|
if !ok {
|
|
c = &AllConfig{}
|
|
cm.Platform[platform] = c
|
|
}
|
|
return c
|
|
}
|
|
|
|
func (cm *ConfigMgr) GetGlobalConfig() *GlobalConfig {
|
|
if cm.Global == nil {
|
|
cm.Global = new(GlobalConfig)
|
|
}
|
|
return cm.Global
|
|
}
|