|
|
|
@ -17,46 +17,17 @@ import (
|
|
|
|
|
"mongo.games.com/game/srvdata"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
OpAll = 0
|
|
|
|
|
OpTurnplate = 1
|
|
|
|
|
OpBlindBox = 2
|
|
|
|
|
OpFirstPay = 3
|
|
|
|
|
OpContinuousPay = 4
|
|
|
|
|
OpPhoneLottery = 5
|
|
|
|
|
OpCollect = 6
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
WelfareNil = 0 // 不处理
|
|
|
|
|
WelfareOpen = 1 // 开启
|
|
|
|
|
WelfareClose = 2 // 关闭
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
GameSubsidyid = 1 //救济金id
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
var WelfareMgrSington = &WelfareMgr{
|
|
|
|
|
Activity: make(map[string]*ActivityInfos),
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type ActivityInfos struct {
|
|
|
|
|
*webapi_proto.Welfare7SignDateList
|
|
|
|
|
*webapi_proto.WelfareTurnplateDateList
|
|
|
|
|
*webapi_proto.WelfareBlindBoxDataList
|
|
|
|
|
*webapi_proto.WelfareFirstPayDataList
|
|
|
|
|
*webapi_proto.WelfareContinuousPayDataList
|
|
|
|
|
*webapi_proto.WelfarePhoneLotteryStatus
|
|
|
|
|
*webapi_proto.WelfareCollectConfig
|
|
|
|
|
BlindBoxCycle int32
|
|
|
|
|
FirstPayCycle int32
|
|
|
|
|
ContinuousPayCycle int32
|
|
|
|
|
ConfigMgr: model.NewConfigMgr(),
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type WelfareMgr struct {
|
|
|
|
|
BaseClockSinker
|
|
|
|
|
Activity map[string]*ActivityInfos
|
|
|
|
|
*model.ConfigMgr
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (this *WelfareMgr) Init() {
|
|
|
|
@ -72,15 +43,6 @@ func (this *WelfareMgr) ModuleName() string {
|
|
|
|
|
return "WelfareMgr"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (this *WelfareMgr) getConfig(plt string) *ActivityInfos {
|
|
|
|
|
info, ok := this.Activity[plt]
|
|
|
|
|
if !ok {
|
|
|
|
|
info = new(ActivityInfos)
|
|
|
|
|
this.Activity[plt] = info
|
|
|
|
|
}
|
|
|
|
|
return info
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// SetWelfData 设置救济金领取次数
|
|
|
|
|
func (this *WelfareMgr) SetWelfData(p *Player, n int32) {
|
|
|
|
|
if n > 0 {
|
|
|
|
@ -158,16 +120,17 @@ func (this *WelfareMgr) GetReliefFund(p *Player, isVideo bool) {
|
|
|
|
|
|
|
|
|
|
func (this *WelfareMgr) UpdateSign7(cfg *webapi_proto.Welfare7SignDateList) {
|
|
|
|
|
if model.GameParamData.TestActSwitch {
|
|
|
|
|
cfg.Switch = WelfareOpen
|
|
|
|
|
cfg.Switch = model.WelfareOpen
|
|
|
|
|
}
|
|
|
|
|
this.getConfig(cfg.Platform).Welfare7SignDateList = cfg
|
|
|
|
|
this.GetAllConfig(cfg.Platform).Welfare7SignDateList = cfg
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (this *WelfareMgr) UpdateTurnplate(cfg *webapi_proto.WelfareTurnplateDateList) {
|
|
|
|
|
if model.GameParamData.TestActSwitch {
|
|
|
|
|
cfg.Switch = WelfareOpen
|
|
|
|
|
cfg.Switch = model.WelfareOpen
|
|
|
|
|
}
|
|
|
|
|
s := int32(0)
|
|
|
|
|
info := this.getConfig(cfg.Platform)
|
|
|
|
|
info := this.GetAllConfig(cfg.Platform)
|
|
|
|
|
if info.WelfareTurnplateDateList != nil {
|
|
|
|
|
s = info.WelfareTurnplateDateList.Switch
|
|
|
|
|
}
|
|
|
|
@ -175,113 +138,113 @@ func (this *WelfareMgr) UpdateTurnplate(cfg *webapi_proto.WelfareTurnplateDateLi
|
|
|
|
|
|
|
|
|
|
// 打开关闭要广播给客户端
|
|
|
|
|
if s != 0 && s != cfg.Switch {
|
|
|
|
|
this.WelfareSwitch(nil, cfg.Platform, OpTurnplate)
|
|
|
|
|
this.WelfareSwitch(nil, cfg.Platform, model.OpTurnplate)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (this *WelfareMgr) UpdateBlindBox(cfg *webapi_proto.WelfareBlindBoxDataList) {
|
|
|
|
|
if model.GameParamData.TestActSwitch {
|
|
|
|
|
cfg.Switch = WelfareOpen
|
|
|
|
|
cfg.Switch = model.WelfareOpen
|
|
|
|
|
}
|
|
|
|
|
s := int32(0)
|
|
|
|
|
info := this.getConfig(cfg.Platform)
|
|
|
|
|
info := this.GetAllConfig(cfg.Platform)
|
|
|
|
|
if info.WelfareBlindBoxDataList != nil {
|
|
|
|
|
s = info.WelfareBlindBoxDataList.Switch
|
|
|
|
|
}
|
|
|
|
|
info.WelfareBlindBoxDataList = cfg
|
|
|
|
|
if cfg.Cycle == WelfareOpen {
|
|
|
|
|
if cfg.Cycle == model.WelfareOpen {
|
|
|
|
|
info.BlindBoxCycle = 1
|
|
|
|
|
}
|
|
|
|
|
// 打开关闭要广播给客户端
|
|
|
|
|
if s != 0 && s != cfg.Switch {
|
|
|
|
|
this.WelfareSwitch(nil, cfg.Platform, OpBlindBox)
|
|
|
|
|
this.WelfareSwitch(nil, cfg.Platform, model.OpBlindBox)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (this *WelfareMgr) UpdateFirstPay(cfg *webapi_proto.WelfareFirstPayDataList) {
|
|
|
|
|
if model.GameParamData.TestActSwitch {
|
|
|
|
|
cfg.Switch = WelfareOpen
|
|
|
|
|
cfg.Switch = model.WelfareOpen
|
|
|
|
|
}
|
|
|
|
|
s := int32(0)
|
|
|
|
|
info := this.getConfig(cfg.Platform)
|
|
|
|
|
info := this.GetAllConfig(cfg.Platform)
|
|
|
|
|
if info.WelfareFirstPayDataList != nil {
|
|
|
|
|
s = info.WelfareFirstPayDataList.Switch
|
|
|
|
|
}
|
|
|
|
|
info.WelfareFirstPayDataList = cfg
|
|
|
|
|
if cfg.Cycle == WelfareOpen {
|
|
|
|
|
if cfg.Cycle == model.WelfareOpen {
|
|
|
|
|
info.FirstPayCycle = 1
|
|
|
|
|
}
|
|
|
|
|
// 打开关闭要广播给客户端
|
|
|
|
|
if s != 0 && s != cfg.Switch {
|
|
|
|
|
this.WelfareSwitch(nil, cfg.Platform, OpFirstPay)
|
|
|
|
|
this.WelfareSwitch(nil, cfg.Platform, model.OpFirstPay)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (this *WelfareMgr) UpdateContinuousPay(cfg *webapi_proto.WelfareContinuousPayDataList) {
|
|
|
|
|
if model.GameParamData.TestActSwitch {
|
|
|
|
|
cfg.Switch = WelfareOpen
|
|
|
|
|
cfg.Switch = model.WelfareOpen
|
|
|
|
|
}
|
|
|
|
|
s := int32(0)
|
|
|
|
|
info := this.getConfig(cfg.Platform)
|
|
|
|
|
info := this.GetAllConfig(cfg.Platform)
|
|
|
|
|
if info.WelfareContinuousPayDataList != nil {
|
|
|
|
|
s = info.WelfareContinuousPayDataList.Switch
|
|
|
|
|
}
|
|
|
|
|
info.WelfareContinuousPayDataList = cfg
|
|
|
|
|
if cfg.Cycle == WelfareOpen {
|
|
|
|
|
if cfg.Cycle == model.WelfareOpen {
|
|
|
|
|
info.ContinuousPayCycle = 1
|
|
|
|
|
}
|
|
|
|
|
// 打开关闭要广播给客户端
|
|
|
|
|
if s != 0 && s != cfg.Switch {
|
|
|
|
|
this.WelfareSwitch(nil, cfg.Platform, OpContinuousPay)
|
|
|
|
|
this.WelfareSwitch(nil, cfg.Platform, model.OpContinuousPay)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (this *WelfareMgr) UpdatePhoneLotteryStatus(cfg *webapi_proto.WelfarePhoneLotteryStatus) {
|
|
|
|
|
if model.GameParamData.TestActSwitch {
|
|
|
|
|
cfg.Switch = WelfareOpen
|
|
|
|
|
cfg.Switch = model.WelfareOpen
|
|
|
|
|
}
|
|
|
|
|
s := int32(0)
|
|
|
|
|
info := this.getConfig(cfg.Platform)
|
|
|
|
|
info := this.GetAllConfig(cfg.Platform)
|
|
|
|
|
if info.WelfarePhoneLotteryStatus != nil {
|
|
|
|
|
s = info.WelfarePhoneLotteryStatus.Switch
|
|
|
|
|
}
|
|
|
|
|
info.WelfarePhoneLotteryStatus = cfg
|
|
|
|
|
// 打开关闭要广播给客户端
|
|
|
|
|
if s != 0 && s != cfg.Switch {
|
|
|
|
|
this.WelfareSwitch(nil, cfg.Platform, OpPhoneLottery)
|
|
|
|
|
this.WelfareSwitch(nil, cfg.Platform, model.OpPhoneLottery)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (this *WelfareMgr) GetPhoneLotteryStatus(platform string) int32 {
|
|
|
|
|
info := this.getConfig(platform)
|
|
|
|
|
info := this.GetAllConfig(platform)
|
|
|
|
|
if info.WelfarePhoneLotteryStatus != nil {
|
|
|
|
|
return info.WelfarePhoneLotteryStatus.Switch
|
|
|
|
|
}
|
|
|
|
|
return WelfareClose
|
|
|
|
|
return model.WelfareClose
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (this *WelfareMgr) UpdateCollectConfig(cfg *webapi_proto.WelfareCollectConfig) {
|
|
|
|
|
if model.GameParamData.TestActSwitch {
|
|
|
|
|
cfg.Switch = WelfareOpen
|
|
|
|
|
cfg.Switch = model.WelfareOpen
|
|
|
|
|
}
|
|
|
|
|
s := int32(0)
|
|
|
|
|
info := this.getConfig(cfg.Platform)
|
|
|
|
|
info := this.GetAllConfig(cfg.Platform)
|
|
|
|
|
if info.WelfareCollectConfig != nil {
|
|
|
|
|
s = info.WelfareCollectConfig.Switch
|
|
|
|
|
}
|
|
|
|
|
info.WelfareCollectConfig = cfg
|
|
|
|
|
// 打开关闭要广播给客户端
|
|
|
|
|
if s != 0 && s != cfg.Switch {
|
|
|
|
|
this.WelfareSwitch(nil, cfg.Platform, OpCollect)
|
|
|
|
|
this.WelfareSwitch(nil, cfg.Platform, model.OpCollect)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (this *WelfareMgr) GetCollectSwitch(platform string) int32 {
|
|
|
|
|
info := this.getConfig(platform)
|
|
|
|
|
info := this.GetAllConfig(platform)
|
|
|
|
|
if info.WelfareCollectConfig != nil {
|
|
|
|
|
return info.WelfareCollectConfig.Switch
|
|
|
|
|
}
|
|
|
|
|
return WelfareClose
|
|
|
|
|
return model.WelfareClose
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (this *WelfareMgr) OnDayChanged(player *Player) error {
|
|
|
|
@ -290,9 +253,9 @@ func (this *WelfareMgr) OnDayChanged(player *Player) error {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
player.WelfData.ReliefFundTimes = 0
|
|
|
|
|
blindBox := this.getConfig(player.Platform).WelfareBlindBoxDataList
|
|
|
|
|
blindBox := this.GetAllConfig(player.Platform).WelfareBlindBoxDataList
|
|
|
|
|
if blindBox != nil { // 关闭循环重置为-1
|
|
|
|
|
if blindBox.Cycle == WelfareClose && player.WelfData.BlindBoxId != 0 {
|
|
|
|
|
if blindBox.Cycle == model.WelfareClose && player.WelfData.BlindBoxId != 0 {
|
|
|
|
|
player.WelfData.BlindBoxId = -1
|
|
|
|
|
} else { // 循环
|
|
|
|
|
player.WelfData.BlindBoxId = 0
|
|
|
|
@ -330,11 +293,11 @@ func (this *WelfareMgr) GetTurnplate(p *Player) {
|
|
|
|
|
pack := &welfare.SCGetTurnplate{
|
|
|
|
|
OpRetCode: welfare.OpResultCode_OPRC_Error,
|
|
|
|
|
}
|
|
|
|
|
info := this.getConfig(p.Platform)
|
|
|
|
|
info := this.GetAllConfig(p.Platform)
|
|
|
|
|
turnplate := info.WelfareTurnplateDateList
|
|
|
|
|
sign7 := info.Welfare7SignDateList
|
|
|
|
|
if turnplate != nil && sign7 != nil {
|
|
|
|
|
if turnplate.Switch != WelfareOpen {
|
|
|
|
|
if turnplate.Switch != model.WelfareOpen {
|
|
|
|
|
logger.Logger.Tracef("GetTurnplate Switch err p.SnId = %v %v", p.SnId, turnplate.Switch)
|
|
|
|
|
p.SendToClient(int(welfare.SPacketID_PACKET_SC_WELF_GETTURNPLATE), pack)
|
|
|
|
|
return
|
|
|
|
@ -436,7 +399,7 @@ func (this *WelfareMgr) GetTurnplteVideo(p *Player) {
|
|
|
|
|
p.SendToClient(int(welfare.SPacketID_PACKET_SC_WELF_GETTURNPLATE), pack)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
info := this.getConfig(p.Platform)
|
|
|
|
|
info := this.GetAllConfig(p.Platform)
|
|
|
|
|
turn := info.WelfareTurnplateDateList // 转盘
|
|
|
|
|
sign7 := info.Welfare7SignDateList // 签到
|
|
|
|
|
if turn == nil || sign7 == nil {
|
|
|
|
@ -444,7 +407,7 @@ func (this *WelfareMgr) GetTurnplteVideo(p *Player) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if turn.Switch != WelfareOpen {
|
|
|
|
|
if turn.Switch != model.WelfareOpen {
|
|
|
|
|
logger.Logger.Tracef("GetTurnplate Switch err p.SnId = %v %v", p.SnId, turn.Switch)
|
|
|
|
|
p.SendToClient(int(welfare.SPacketID_PACKET_SC_WELF_GETTURNPLATE), pack)
|
|
|
|
|
return
|
|
|
|
@ -615,11 +578,11 @@ func (this *WelfareMgr) GetAddupSign(p *Player, addupday int32) {
|
|
|
|
|
pack := &welfare.SCGetAddupSign{
|
|
|
|
|
OpRetCode: welfare.OpResultCode_OPRC_Error,
|
|
|
|
|
}
|
|
|
|
|
info := this.getConfig(p.Platform)
|
|
|
|
|
info := this.GetAllConfig(p.Platform)
|
|
|
|
|
turnplate := info.WelfareTurnplateDateList
|
|
|
|
|
sign7 := info.Welfare7SignDateList
|
|
|
|
|
if turnplate != nil && sign7 != nil {
|
|
|
|
|
if turnplate.Switch != WelfareOpen {
|
|
|
|
|
if turnplate.Switch != model.WelfareOpen {
|
|
|
|
|
logger.Logger.Tracef("Get7Sign Switch err p.SnId = %v %v", p.SnId, turnplate.Switch)
|
|
|
|
|
p.SendToClient(int(welfare.SPacketID_PACKET_SC_WELF_GETADDUPSIGN), pack)
|
|
|
|
|
return
|
|
|
|
@ -681,12 +644,12 @@ func (this *WelfareMgr) WelfaredInfo(p *Player) {
|
|
|
|
|
pack := &welfare.SCWelfaredInfo{}
|
|
|
|
|
diff := 0
|
|
|
|
|
ts := time.Now().Unix()
|
|
|
|
|
info := this.getConfig(p.Platform)
|
|
|
|
|
info := this.GetAllConfig(p.Platform)
|
|
|
|
|
turnplate := info.WelfareTurnplateDateList
|
|
|
|
|
sign7 := info.Welfare7SignDateList
|
|
|
|
|
if turnplate != nil && sign7 != nil {
|
|
|
|
|
pack.Switch = turnplate.Switch
|
|
|
|
|
if turnplate.Switch != WelfareClose {
|
|
|
|
|
if turnplate.Switch != model.WelfareClose {
|
|
|
|
|
pack.DrawTurnplate = 2
|
|
|
|
|
signIndex := p.WelfData.Sign7.SignIndex % int32(len(turnplate.RateList))
|
|
|
|
|
|
|
|
|
@ -757,90 +720,90 @@ func (this *WelfareMgr) WelfaredInfo(p *Player) {
|
|
|
|
|
func (this *WelfareMgr) WelfareSwitch(p *Player, platform string, op int) {
|
|
|
|
|
pack := &player_proto.SCEasyWelfaredInfo{}
|
|
|
|
|
// 0转盘1盲盒2首冲3连续充值
|
|
|
|
|
info := this.getConfig(platform)
|
|
|
|
|
info := this.GetAllConfig(platform)
|
|
|
|
|
|
|
|
|
|
// 转盘
|
|
|
|
|
turnplate := info.WelfareTurnplateDateList
|
|
|
|
|
if turnplate != nil {
|
|
|
|
|
if op == OpAll || op == OpTurnplate {
|
|
|
|
|
if turnplate.Switch == WelfareOpen && p != nil && this.Welfareturnplate(p, 1) { // 没有关闭且所有奖励已经领取
|
|
|
|
|
pack.WelfareSwitch = append(pack.WelfareSwitch, WelfareClose) //关闭
|
|
|
|
|
if op == model.OpAll || op == model.OpTurnplate {
|
|
|
|
|
if turnplate.Switch == model.WelfareOpen && p != nil && this.Welfareturnplate(p, 1) { // 没有关闭且所有奖励已经领取
|
|
|
|
|
pack.WelfareSwitch = append(pack.WelfareSwitch, model.WelfareClose) //关闭
|
|
|
|
|
} else {
|
|
|
|
|
pack.WelfareSwitch = append(pack.WelfareSwitch, turnplate.Switch)
|
|
|
|
|
}
|
|
|
|
|
} else { // 不更新
|
|
|
|
|
pack.WelfareSwitch = append(pack.WelfareSwitch, WelfareNil)
|
|
|
|
|
pack.WelfareSwitch = append(pack.WelfareSwitch, model.WelfareNil)
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
pack.WelfareSwitch = append(pack.WelfareSwitch, WelfareClose) // 配置nil就是关闭
|
|
|
|
|
pack.WelfareSwitch = append(pack.WelfareSwitch, model.WelfareClose) // 配置nil就是关闭
|
|
|
|
|
}
|
|
|
|
|
// 盲盒
|
|
|
|
|
blindBox := info.WelfareBlindBoxDataList
|
|
|
|
|
if blindBox != nil {
|
|
|
|
|
if op == OpAll || op == OpBlindBox {
|
|
|
|
|
if blindBox.Switch == WelfareOpen && blindBox.Cycle == WelfareClose && p != nil && p.WelfData.BlindBoxId != 0 { // 没有关闭且所有奖励已经领取
|
|
|
|
|
pack.WelfareSwitch = append(pack.WelfareSwitch, WelfareClose) //关闭
|
|
|
|
|
if op == model.OpAll || op == model.OpBlindBox {
|
|
|
|
|
if blindBox.Switch == model.WelfareOpen && blindBox.Cycle == model.WelfareClose && p != nil && p.WelfData.BlindBoxId != 0 { // 没有关闭且所有奖励已经领取
|
|
|
|
|
pack.WelfareSwitch = append(pack.WelfareSwitch, model.WelfareClose) //关闭
|
|
|
|
|
} else {
|
|
|
|
|
pack.WelfareSwitch = append(pack.WelfareSwitch, blindBox.Switch)
|
|
|
|
|
}
|
|
|
|
|
} else { // 不更新
|
|
|
|
|
pack.WelfareSwitch = append(pack.WelfareSwitch, WelfareNil)
|
|
|
|
|
pack.WelfareSwitch = append(pack.WelfareSwitch, model.WelfareNil)
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
pack.WelfareSwitch = append(pack.WelfareSwitch, WelfareClose) // 配置nil就是关闭
|
|
|
|
|
pack.WelfareSwitch = append(pack.WelfareSwitch, model.WelfareClose) // 配置nil就是关闭
|
|
|
|
|
}
|
|
|
|
|
// 首充
|
|
|
|
|
firstPay := info.WelfareFirstPayDataList
|
|
|
|
|
if firstPay != nil {
|
|
|
|
|
if op == OpAll || op == OpFirstPay {
|
|
|
|
|
if op == model.OpAll || op == model.OpFirstPay {
|
|
|
|
|
ln := len(firstPay.List)
|
|
|
|
|
max := firstPay.List[ln-1].Day // 正序
|
|
|
|
|
if firstPay.Switch == WelfareOpen && firstPay.Cycle == WelfareClose && p != nil && p.WelfData.FirstPayDay >= max { // 没有关闭且所有奖励已经领取
|
|
|
|
|
pack.WelfareSwitch = append(pack.WelfareSwitch, WelfareClose) //关闭
|
|
|
|
|
max := firstPay.List[ln-1].Day // 正序
|
|
|
|
|
if firstPay.Switch == model.WelfareOpen && firstPay.Cycle == model.WelfareClose && p != nil && p.WelfData.FirstPayDay >= max { // 没有关闭且所有奖励已经领取
|
|
|
|
|
pack.WelfareSwitch = append(pack.WelfareSwitch, model.WelfareClose) //关闭
|
|
|
|
|
} else {
|
|
|
|
|
pack.WelfareSwitch = append(pack.WelfareSwitch, firstPay.Switch)
|
|
|
|
|
}
|
|
|
|
|
} else { // 不更新
|
|
|
|
|
pack.WelfareSwitch = append(pack.WelfareSwitch, WelfareNil)
|
|
|
|
|
pack.WelfareSwitch = append(pack.WelfareSwitch, model.WelfareNil)
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
pack.WelfareSwitch = append(pack.WelfareSwitch, WelfareClose) // 配置nil就是关闭
|
|
|
|
|
pack.WelfareSwitch = append(pack.WelfareSwitch, model.WelfareClose) // 配置nil就是关闭
|
|
|
|
|
}
|
|
|
|
|
// 连充
|
|
|
|
|
continuousPay := info.WelfareContinuousPayDataList
|
|
|
|
|
if continuousPay != nil {
|
|
|
|
|
if op == OpAll || op == OpContinuousPay {
|
|
|
|
|
if op == model.OpAll || op == model.OpContinuousPay {
|
|
|
|
|
ln := len(continuousPay.List)
|
|
|
|
|
max := continuousPay.List[ln-1].Day // 正序
|
|
|
|
|
if continuousPay.Switch == WelfareOpen && continuousPay.Cycle == WelfareClose && p != nil && p.WelfData.ContinuousPayDay >= max { // 没有关闭且所有奖励已经领取
|
|
|
|
|
pack.WelfareSwitch = append(pack.WelfareSwitch, WelfareClose) //关闭
|
|
|
|
|
max := continuousPay.List[ln-1].Day // 正序
|
|
|
|
|
if continuousPay.Switch == model.WelfareOpen && continuousPay.Cycle == model.WelfareClose && p != nil && p.WelfData.ContinuousPayDay >= max { // 没有关闭且所有奖励已经领取
|
|
|
|
|
pack.WelfareSwitch = append(pack.WelfareSwitch, model.WelfareClose) //关闭
|
|
|
|
|
} else {
|
|
|
|
|
pack.WelfareSwitch = append(pack.WelfareSwitch, continuousPay.Switch)
|
|
|
|
|
}
|
|
|
|
|
} else { // 不更新
|
|
|
|
|
pack.WelfareSwitch = append(pack.WelfareSwitch, WelfareNil)
|
|
|
|
|
pack.WelfareSwitch = append(pack.WelfareSwitch, model.WelfareNil)
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
pack.WelfareSwitch = append(pack.WelfareSwitch, WelfareClose) // 配置nil就是关闭
|
|
|
|
|
pack.WelfareSwitch = append(pack.WelfareSwitch, model.WelfareClose) // 配置nil就是关闭
|
|
|
|
|
}
|
|
|
|
|
// 抽手机活动开关
|
|
|
|
|
phoneConfig := info.WelfarePhoneLotteryStatus
|
|
|
|
|
if phoneConfig != nil {
|
|
|
|
|
pack.WelfareSwitch = append(pack.WelfareSwitch, phoneConfig.Switch) //抽手机活动开关
|
|
|
|
|
} else {
|
|
|
|
|
pack.WelfareSwitch = append(pack.WelfareSwitch, WelfareClose)
|
|
|
|
|
pack.WelfareSwitch = append(pack.WelfareSwitch, model.WelfareClose)
|
|
|
|
|
}
|
|
|
|
|
// 集卡活动
|
|
|
|
|
collectConfig := info.WelfareCollectConfig
|
|
|
|
|
if collectConfig != nil {
|
|
|
|
|
pack.WelfareSwitch = append(pack.WelfareSwitch, collectConfig.Switch) //集卡活动开关
|
|
|
|
|
} else {
|
|
|
|
|
pack.WelfareSwitch = append(pack.WelfareSwitch, WelfareClose)
|
|
|
|
|
pack.WelfareSwitch = append(pack.WelfareSwitch, model.WelfareClose)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if model.GameParamData.TestActSwitch {
|
|
|
|
|
for k := range pack.WelfareSwitch {
|
|
|
|
|
pack.WelfareSwitch[k] = WelfareOpen
|
|
|
|
|
pack.WelfareSwitch[k] = model.WelfareOpen
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -856,11 +819,11 @@ func (this *WelfareMgr) WelfareSwitch(p *Player, platform string, op int) {
|
|
|
|
|
// Welfareturnplate 转盘红点
|
|
|
|
|
func (this *WelfareMgr) Welfareturnplate(p *Player, op int32) bool { // 0 红点提示 1全部领取
|
|
|
|
|
var isShow bool
|
|
|
|
|
info := this.getConfig(p.Platform)
|
|
|
|
|
info := this.GetAllConfig(p.Platform)
|
|
|
|
|
turnplate := info.WelfareTurnplateDateList
|
|
|
|
|
sign7 := info.Welfare7SignDateList
|
|
|
|
|
if turnplate != nil && sign7 != nil {
|
|
|
|
|
if turnplate.Switch == WelfareClose {
|
|
|
|
|
if turnplate.Switch == model.WelfareClose {
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
diff := 0
|
|
|
|
@ -910,7 +873,7 @@ func (this *WelfareMgr) WelfareShowRed(p *Player) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
this.MonitorWelfData(p) // 登录检测
|
|
|
|
|
this.WelfareSwitch(p, p.Platform, OpAll)
|
|
|
|
|
this.WelfareSwitch(p, p.Platform, model.OpAll)
|
|
|
|
|
|
|
|
|
|
if !this.Welfareturnplate(p, 0) {
|
|
|
|
|
p.SendShowRed(hall_proto.ShowRedCode_Welfare, 0, 1) // 0 轮盘红点
|
|
|
|
@ -921,10 +884,10 @@ func (this *WelfareMgr) BlindBoxInfo(p *Player, bid int32) {
|
|
|
|
|
pack := &welfare.SCBlindBoxInfo{
|
|
|
|
|
OpRetCode: welfare.OpResultCode_OPRC_Error,
|
|
|
|
|
}
|
|
|
|
|
info := this.getConfig(p.Platform)
|
|
|
|
|
info := this.GetAllConfig(p.Platform)
|
|
|
|
|
blindBox := info.WelfareBlindBoxDataList
|
|
|
|
|
if blindBox != nil {
|
|
|
|
|
if blindBox.Switch != WelfareOpen {
|
|
|
|
|
if blindBox.Switch != model.WelfareOpen {
|
|
|
|
|
logger.Logger.Tracef("BlindBoxInfo Switch err p.SnId = %v %v", p.SnId, blindBox.Switch)
|
|
|
|
|
p.SendToClient(int(welfare.SPacketID_PACKET_SC_WELF_BLINBOXINFO), pack)
|
|
|
|
|
return
|
|
|
|
@ -940,7 +903,7 @@ func (this *WelfareMgr) BlindBoxInfo(p *Player, bid int32) {
|
|
|
|
|
pack.Draw = 1
|
|
|
|
|
cyc := info.BlindBoxCycle
|
|
|
|
|
if p.WelfData.BlindBoxId == -1 {
|
|
|
|
|
if cyc == 1 || blindBox.Cycle == WelfareOpen {
|
|
|
|
|
if cyc == 1 || blindBox.Cycle == model.WelfareOpen {
|
|
|
|
|
p.WelfData.BlindBoxId = 0
|
|
|
|
|
}
|
|
|
|
|
} // == 1代表当日循环
|
|
|
|
@ -997,13 +960,13 @@ func (this *WelfareMgr) BuyBlindBox(p *Player, buyid, ConfigPayId int32) {
|
|
|
|
|
pack := &shop.SCPayInfo{
|
|
|
|
|
RetCode: shop.OpResultCode_OPRC_Error,
|
|
|
|
|
}
|
|
|
|
|
blindBox := this.getConfig(p.Platform).WelfareBlindBoxDataList
|
|
|
|
|
blindBox := this.GetAllConfig(p.Platform).WelfareBlindBoxDataList
|
|
|
|
|
if blindBox == nil {
|
|
|
|
|
logger.Logger.Tracef("BuyBlindBox blindBox==nil snid: %v pack: %v", p.SnId, pack)
|
|
|
|
|
p.SendToClient(int(shop.SPacketID_PACKET_SCPAYINFO), pack)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if blindBox.Switch != WelfareOpen {
|
|
|
|
|
if blindBox.Switch != model.WelfareOpen {
|
|
|
|
|
logger.Logger.Tracef("BuyBlindBox Switch err p.SnId = %v %v", p.SnId, blindBox.Switch)
|
|
|
|
|
p.SendToClient(int(shop.SPacketID_PACKET_SCPAYINFO), pack)
|
|
|
|
|
return
|
|
|
|
@ -1099,11 +1062,11 @@ func (this *WelfareMgr) FirstPayInfo(p *Player) {
|
|
|
|
|
pack := &welfare.SCWelfareFirstPayData{
|
|
|
|
|
OpRetCode: welfare.OpResultCode_OPRC_Error,
|
|
|
|
|
}
|
|
|
|
|
info := this.getConfig(p.Platform)
|
|
|
|
|
info := this.GetAllConfig(p.Platform)
|
|
|
|
|
firstPay := info.WelfareFirstPayDataList
|
|
|
|
|
if firstPay != nil {
|
|
|
|
|
pack.Switch = firstPay.Switch
|
|
|
|
|
if firstPay.Switch != WelfareClose {
|
|
|
|
|
if firstPay.Switch != model.WelfareClose {
|
|
|
|
|
ln := len(firstPay.List)
|
|
|
|
|
if ln == 0 { // 不能为空
|
|
|
|
|
logger.Logger.Tracef("FirstPayInfo firstPay.List err p.SnId = %v %v", p.SnId, ln)
|
|
|
|
@ -1125,7 +1088,7 @@ func (this *WelfareMgr) FirstPayInfo(p *Player) {
|
|
|
|
|
cyc := info.FirstPayCycle
|
|
|
|
|
if pack.Draw == 2 { // 当天未领取判断
|
|
|
|
|
if day >= max {
|
|
|
|
|
if firstPay.Cycle != WelfareOpen && cyc != 1 { // 全部领取完就发最后一天
|
|
|
|
|
if firstPay.Cycle != model.WelfareOpen && cyc != 1 { // 全部领取完就发最后一天
|
|
|
|
|
day = max
|
|
|
|
|
pack.Draw = 1 // 不循环 且今日无开启循环操作 领完不能再领取了
|
|
|
|
|
} else {
|
|
|
|
@ -1183,7 +1146,7 @@ func (this *WelfareMgr) BuyFirstPay(p *Player, ConfigPayId int32) {
|
|
|
|
|
pack := &shop.SCPayInfo{
|
|
|
|
|
RetCode: shop.OpResultCode_OPRC_Error,
|
|
|
|
|
}
|
|
|
|
|
info := this.getConfig(p.Platform)
|
|
|
|
|
info := this.GetAllConfig(p.Platform)
|
|
|
|
|
firstPay := info.WelfareFirstPayDataList
|
|
|
|
|
if firstPay == nil {
|
|
|
|
|
logger.Logger.Errorf("BuyFirstPay firstPay == nil snid: %v pack: %v", p.SnId, pack)
|
|
|
|
@ -1212,7 +1175,7 @@ func (this *WelfareMgr) BuyFirstPay(p *Player, ConfigPayId int32) {
|
|
|
|
|
|
|
|
|
|
if p.WelfData.FirstPayDay >= max {
|
|
|
|
|
cyc := info.FirstPayCycle
|
|
|
|
|
if firstPay.Cycle != WelfareOpen && cyc != 1 { // 全部领取完
|
|
|
|
|
if firstPay.Cycle != model.WelfareOpen && cyc != 1 { // 全部领取完
|
|
|
|
|
//pack.OpRetCode = welfare.OpResultCode_OPRC_NoTimes
|
|
|
|
|
logger.Logger.Tracef("BuyFirstPay Cycle p.WelfData.FirstPayDay max p.SnId = %v %v", p.SnId, firstPay.Cycle, p.WelfData.FirstPayDay, max)
|
|
|
|
|
p.SendToClient(int(shop.SPacketID_PACKET_SCPAYINFO), pack)
|
|
|
|
@ -1308,11 +1271,11 @@ func (this *WelfareMgr) ContinuousPayInfo(p *Player) {
|
|
|
|
|
pack := &welfare.SCWelfareContinuousPayData{
|
|
|
|
|
OpRetCode: welfare.OpResultCode_OPRC_Error,
|
|
|
|
|
}
|
|
|
|
|
info := this.getConfig(p.Platform)
|
|
|
|
|
info := this.GetAllConfig(p.Platform)
|
|
|
|
|
continuousPay := info.WelfareContinuousPayDataList
|
|
|
|
|
if continuousPay != nil {
|
|
|
|
|
pack.Switch = continuousPay.Switch
|
|
|
|
|
if continuousPay.Switch != WelfareClose {
|
|
|
|
|
if continuousPay.Switch != model.WelfareClose {
|
|
|
|
|
ln := len(continuousPay.List)
|
|
|
|
|
if ln == 0 { // 不能为空
|
|
|
|
|
logger.Logger.Tracef("ContinuousPayInfo continuousPay.List err p.SnId = %v %v", p.SnId, ln)
|
|
|
|
@ -1328,7 +1291,7 @@ func (this *WelfareMgr) ContinuousPayInfo(p *Player) {
|
|
|
|
|
dif := common.DiffDaybyTs(ts, p.WelfData.ContinuousPayTickets)
|
|
|
|
|
if dif == 0 { // 当天已经领取
|
|
|
|
|
pack.Draw = 1
|
|
|
|
|
} else if continuousPay.Break == WelfareOpen && dif > 1 && p.WelfData.ContinuousPayDay < max { // 开启中断
|
|
|
|
|
} else if continuousPay.Break == model.WelfareOpen && dif > 1 && p.WelfData.ContinuousPayDay < max { // 开启中断
|
|
|
|
|
day = 0 //continuousPay.List[0].Day // 从头开始
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -1346,7 +1309,7 @@ func (this *WelfareMgr) ContinuousPayInfo(p *Player) {
|
|
|
|
|
if i < ln {
|
|
|
|
|
day = continuousPay.List[i].Day
|
|
|
|
|
} else {
|
|
|
|
|
if continuousPay.Cycle != WelfareOpen && cyc != 1 { // 全部领取完就发最后一天
|
|
|
|
|
if continuousPay.Cycle != model.WelfareOpen && cyc != 1 { // 全部领取完就发最后一天
|
|
|
|
|
day = max
|
|
|
|
|
pack.Draw = 1 // 不循环 领完不能再领取了
|
|
|
|
|
} else {
|
|
|
|
@ -1392,7 +1355,7 @@ func (this *WelfareMgr) BuyContinuousPay(p *Player, ConfigPayId int32) {
|
|
|
|
|
pack := &shop.SCPayInfo{
|
|
|
|
|
RetCode: shop.OpResultCode_OPRC_Error,
|
|
|
|
|
}
|
|
|
|
|
info := this.getConfig(p.Platform)
|
|
|
|
|
info := this.GetAllConfig(p.Platform)
|
|
|
|
|
continuousPay := info.WelfareContinuousPayDataList
|
|
|
|
|
if continuousPay == nil {
|
|
|
|
|
logger.Logger.Tracef("BuyContinuousPay continuousPay == nil snid: %v pack: %v", p.SnId, pack)
|
|
|
|
@ -1416,14 +1379,14 @@ func (this *WelfareMgr) BuyContinuousPay(p *Player, ConfigPayId int32) {
|
|
|
|
|
//pack.OpRetCode = welfare.OpResultCode_OPRC_NoTimes
|
|
|
|
|
p.SendToClient(int(shop.SPacketID_PACKET_SCPAYINFO), pack)
|
|
|
|
|
return
|
|
|
|
|
} else if continuousPay.Break == WelfareOpen && dif > 1 && p.WelfData.ContinuousPayDay < max { // 开启中断 且没有领取到最后一天
|
|
|
|
|
} else if continuousPay.Break == model.WelfareOpen && dif > 1 && p.WelfData.ContinuousPayDay < max { // 开启中断 且没有领取到最后一天
|
|
|
|
|
p.WelfData.ContinuousPayDay = 0 // 从第一天开始
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if p.WelfData.ContinuousPayDay >= max {
|
|
|
|
|
cyc := info.ContinuousPayCycle
|
|
|
|
|
if continuousPay.Cycle != WelfareOpen && cyc != 1 { // 全部领取完
|
|
|
|
|
if continuousPay.Cycle != model.WelfareOpen && cyc != 1 { // 全部领取完
|
|
|
|
|
//pack.OpRetCode = welfare.OpResultCode_OPRC_NoTimes
|
|
|
|
|
logger.Logger.Tracef("BuyContinuousPay Cycle p.WelfData.FirstPayDay max p.SnId = %v %v", p.SnId, continuousPay.Cycle, p.WelfData.ContinuousPayDay, max)
|
|
|
|
|
p.SendToClient(int(shop.SPacketID_PACKET_SCPAYINFO), pack)
|
|
|
|
@ -1520,7 +1483,7 @@ func (this *WelfareMgr) Shutdown() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (this *WelfareMgr) OnDayTimer() {
|
|
|
|
|
for _, v := range this.Activity {
|
|
|
|
|
for _, v := range this.ConfigMgr.Platform {
|
|
|
|
|
v.BlindBoxCycle = 0
|
|
|
|
|
v.FirstPayCycle = 0
|
|
|
|
|
v.ContinuousPayCycle = 0
|
|
|
|
|