From ee9878957a19b851785c00f54481605302f6a5c1 Mon Sep 17 00:00:00 2001 From: sk <123456@qq.com> Date: Mon, 6 Jan 2025 14:08:40 +0800 Subject: [PATCH] =?UTF-8?q?modify=20=E7=B4=AF=E6=B6=88=E6=B4=BB=E5=8A=A8?= =?UTF-8?q?=E5=BC=80=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model/config.go | 2 +- model/permit.go | 19 ++++++++++--------- worldsrv/action_task.go | 1 + worldsrv/welfmgr.go | 20 ++++++++++++++++++++ 4 files changed, 32 insertions(+), 10 deletions(-) diff --git a/model/config.go b/model/config.go index 0d00179..2080dbf 100644 --- a/model/config.go +++ b/model/config.go @@ -25,7 +25,7 @@ const ( OpPhoneLottery = 5 OpCollect = 6 OpNian = 7 - OpRedPacket = 8 // 红包活动 + OpConsume = 8 // 累计消耗活动 ) const ( diff --git a/model/permit.go b/model/permit.go index 70798d1..a1ca310 100644 --- a/model/permit.go +++ b/model/permit.go @@ -44,13 +44,14 @@ type BackendPermitJoin struct { // BackendPermitTask 通行证任务完成记录 type BackendPermitTask struct { - Platform string // 平台 - StartTs int64 // 活动开始时间 - SnId int32 // 玩家id - TaskId int32 // 任务id - TaskName string // 任务名称 - ActivityType int32 // 活动类型 - TaskType int32 // 任务类型 - Gain []AwardItem // 任务获得奖励 - Ts int64 // 时间戳 + Platform string // 平台 + StartTs int64 // 活动开始时间 + SnId int32 // 玩家id + TaskId int32 // 任务id + TaskName string // 任务名称 + ActivityType int32 // 活动类型 + TaskType int32 // 任务类型 + Gain []AwardItem // 任务获得奖励 + Ts int64 // 时间戳 + RemainDiamond int64 // 剩余钻石 } diff --git a/worldsrv/action_task.go b/worldsrv/action_task.go index fe0795f..ba9435e 100644 --- a/worldsrv/action_task.go +++ b/worldsrv/action_task.go @@ -136,6 +136,7 @@ func CSTaskReward(s *netlib.Session, packetId int, data interface{}, sid int64) taskLog.TaskName = data.GetDes() taskLog.ActivityType = data.GetActivityType() taskLog.TaskType = data.GetTaskType() + taskLog.RemainDiamond = p.Diamond } mq.Write(taskLog) ret.OpCode = taskproto.OpResultCode_OPRC_Success diff --git a/worldsrv/welfmgr.go b/worldsrv/welfmgr.go index 734e3fa..779cb51 100644 --- a/worldsrv/welfmgr.go +++ b/worldsrv/welfmgr.go @@ -1017,6 +1017,13 @@ func (this *WelfareMgr) WelfareSwitch(p *Player, platform string, op int) { } else { pack.WelfareSwitch = append(pack.WelfareSwitch, model.WelfareClose) } + // 累消活动 + consumeConfig := info.ConsumeConfig + if consumeConfig != nil { + pack.WelfareSwitch = append(pack.WelfareSwitch, consumeConfig.On) //累消活动开关 + } else { + pack.WelfareSwitch = append(pack.WelfareSwitch, model.WelfareClose) + } if model.GameParamData.TestActSwitch { for k := range pack.WelfareSwitch { @@ -2455,7 +2462,20 @@ func (this *WelfareMgr) GetRedPacket(p *Player, id int64) *welfare.SCRedPacketDr } func (this *WelfareMgr) UpdateConsumeConfig(conf *webapi_proto.ConsumeConfig) { + if model.GameParamData.TestActSwitch { + conf.On = model.WelfareOpen + } + s := int32(0) + info := this.GetConfig(conf.Platform) + if info.ConsumeConfig != nil { + s = info.ConsumeConfig.On + } this.GetConfig(conf.Platform).ConsumeConfig = conf + //更新活动时间 + // 打开关闭要广播给客户端 + if s != 0 && s != conf.On { + this.WelfareSwitch(nil, conf.Platform, model.OpConsume) + } } func (this *WelfareMgr) Update() {