From e476a7e74b0174e4f6d21b5962578d5b4c01f89e Mon Sep 17 00:00:00 2001 From: by <123456@qq.com> Date: Fri, 18 Oct 2024 13:32:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8E=E5=8F=B0=E6=B4=BB=E5=8A=A8=E8=AE=B0?= =?UTF-8?q?=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model/player.go | 8 ++++++++ model/rabbit_mq.go | 12 ++++++++++++ mq/keyconf.go | 1 + worldsrv/action_bag.go | 1 + worldsrv/action_phonelottery.go | 2 ++ worldsrv/action_task.go | 3 +++ worldsrv/action_welfare.go | 1 + worldsrv/player.go | 1 + worldsrv/shopmgr.go | 2 ++ worldsrv/welfmgr.go | 1 + 10 files changed, 32 insertions(+) diff --git a/model/player.go b/model/player.go index eb8f529..60b1b78 100644 --- a/model/player.go +++ b/model/player.go @@ -117,6 +117,14 @@ const ( SystemFreeGive_CoinType_Diamond //钻石 SystemFreeGive_CoinType_Tiem // 道具 ) +const ( + ActivityLog_Sign = iota + 1 // 签到 + ActivityLog_PhoneLottery //积分抽奖 + ActivityLog_DiamondLottery //钻石抽奖 + ActivityLog_CollectBox //开启礼盒集卡 + ActivityLog_WeekCard //领取周卡奖励 + ActivityLog_Permit //通行证 +) type PlayerGameCtrlData struct { CtrlData map[string]*PlayerGameStatics diff --git a/model/rabbit_mq.go b/model/rabbit_mq.go index 99d432c..f2a59a1 100644 --- a/model/rabbit_mq.go +++ b/model/rabbit_mq.go @@ -61,3 +61,15 @@ func GeneratePhoneLottery(snid int32, platform string, items string, lotteryType params["Ts"] = strconv.Itoa(int(time.Now().Unix())) return NewRabbitMQData(mq.BackPhoneLottery, params) } + +// GenerateActivityLog 活动参与log +// childType 1-点击行为 2-兑换行为 +func GenerateActivityLog(snid int32, platform string, typeId, childType int32) *mq.RabbitMQData { + params := make(map[string]string) + params["Snid"] = strconv.Itoa(int(snid)) + params["Platform"] = platform + params["TypeId"] = strconv.Itoa(int(typeId)) + params["ChildType"] = strconv.Itoa(int(childType)) + params["Ts"] = strconv.FormatInt(time.Now().Unix(), 10) + return NewRabbitMQData(mq.BackActivityLog, params) +} diff --git a/mq/keyconf.go b/mq/keyconf.go index 8ee8556..456bbcf 100644 --- a/mq/keyconf.go +++ b/mq/keyconf.go @@ -17,6 +17,7 @@ const ( BackSystemPermitJoin = "back_permitjoin" BackSystemPermitTask = "back_permittask" BackSystemJyb = "back_jyblog" + BackActivityLog = "back_activitylog" ) // mgrsrv diff --git a/worldsrv/action_bag.go b/worldsrv/action_bag.go index 4712c73..76a4dab 100644 --- a/worldsrv/action_bag.go +++ b/worldsrv/action_bag.go @@ -195,6 +195,7 @@ func CSUpBagInfo(s *netlib.Session, packetid int, data interface{}, sid int64) e } if !p.IsRob && tp1 >= 0 { mq.Write(model.GenerateSystemFreeGive(p.SnId, p.Name, p.Platform, p.Channel, model.SystemFreeGive_CollectBox, tp1, v.ItemNum)) + mq.Write(model.GenerateActivityLog(p.SnId, p.Platform, model.ActivityLog_CollectBox, 1)) } } } diff --git a/worldsrv/action_phonelottery.go b/worldsrv/action_phonelottery.go index d839959..c78d426 100644 --- a/worldsrv/action_phonelottery.go +++ b/worldsrv/action_phonelottery.go @@ -210,6 +210,7 @@ func (this *CSPhoneLotteryHandler) Process(s *netlib.Session, packetid int, data mq.Write(model.GenerateSystemFreeGive(p.SnId, p.Name, p.Platform, p.Channel, model.SystemFreeGive_PhoneLottery, tp1, v.ItemNum)) } } + mq.Write(model.GenerateActivityLog(p.SnId, p.Platform, model.ActivityLog_PhoneLottery, 1)) } return nil } @@ -419,6 +420,7 @@ func (this *CSDiamondLotteryHandler) Process(s *netlib.Session, packetid int, da p.SendToClient(int(player_proto.PlayerPacketID_PACKET_SC_DiamondLottery), pack) logger.Logger.Trace("返回钻石抽奖信息:", pack.String()) } + mq.Write(model.GenerateActivityLog(p.SnId, p.Platform, model.ActivityLog_DiamondLottery, 1)) } return nil } diff --git a/worldsrv/action_task.go b/worldsrv/action_task.go index 5fd0218..b399dd6 100644 --- a/worldsrv/action_task.go +++ b/worldsrv/action_task.go @@ -141,6 +141,9 @@ func SendReward(p *Player, m map[int64]int64, tp int32) { mq.Write(model.GenerateSystemFreeGive(p.SnId, p.Name, p.Platform, p.Channel, giveType, tp, v.ItemNum)) } } + if giveType == model.SystemFreeGive_GiveType_TaskPermit { + mq.Write(model.GenerateActivityLog(p.SnId, p.Platform, model.ActivityLog_Permit, 1)) + } } func CSTaskList(s *netlib.Session, packetId int, data interface{}, sid int64) error { diff --git a/worldsrv/action_welfare.go b/worldsrv/action_welfare.go index 1afccc6..5a7e2a5 100644 --- a/worldsrv/action_welfare.go +++ b/worldsrv/action_welfare.go @@ -1132,6 +1132,7 @@ func CSPermitExchange(s *netlib.Session, packetid int, data interface{}, sid int Gain: gain, Ts: now.Unix(), }) + mq.Write(model.GenerateActivityLog(p.SnId, p.Platform, model.ActivityLog_Permit, 2)) } } diff --git a/worldsrv/player.go b/worldsrv/player.go index 422de51..3950071 100644 --- a/worldsrv/player.go +++ b/worldsrv/player.go @@ -4466,6 +4466,7 @@ func (this *Player) GetWeekCardAwary(id int32) { } ret.WeekCard = info this.SendToClient(int(playerproto.PlayerPacketID_PACKET_SCGetWeekCardAwary), ret) + mq.Write(model.GenerateActivityLog(this.SnId, this.Platform, model.ActivityLog_WeekCard, 1)) return } diff --git a/worldsrv/shopmgr.go b/worldsrv/shopmgr.go index e5f8a1b..0fe111e 100644 --- a/worldsrv/shopmgr.go +++ b/worldsrv/shopmgr.go @@ -717,6 +717,7 @@ func (this *ShopMgr) GainShop(shopInfo *model.ShopInfo, p *Player, vipShopId, po p.AddDiamond(-costNum, 0, gainWay, "sys", shopName) case ShopConsumePhoneScore: p.AddPhoneScore(-costNum, 0, gainWay, "sys", shopName) + mq.Write(model.GenerateActivityLog(p.SnId, p.Platform, model.ActivityLog_PhoneLottery, 2)) case ShopConsumeDiamondScore: BagMgrSingleton.AddItems(&model.AddItemParam{ Platform: p.Platform, @@ -731,6 +732,7 @@ func (this *ShopMgr) GainShop(shopInfo *model.ShopInfo, p *Player, vipShopId, po Operator: "system", Remark: "商城购买消耗钻石积分", }) + mq.Write(model.GenerateActivityLog(p.SnId, p.Platform, model.ActivityLog_DiamondLottery, 2)) default: logger.Logger.Errorf("GainShop ConstType[%v] err", shopInfo.ConstType) return shop.OpResultCode_OPRC_Error diff --git a/worldsrv/welfmgr.go b/worldsrv/welfmgr.go index 43ce87f..1cb2fd8 100644 --- a/worldsrv/welfmgr.go +++ b/worldsrv/welfmgr.go @@ -404,6 +404,7 @@ func (this *WelfareMgr) GetTurnplate(p *Player) { } logger.Logger.Tracef("GetTurnplate snid: %v pack: %v", p.SnId, pack) p.SendToClient(int(welfare.SPacketID_PACKET_SC_WELF_GETTURNPLATE), pack) + mq.Write(model.GenerateActivityLog(p.SnId, p.Platform, model.ActivityLog_Sign, 1)) } // GetTurnplteVideo 转盘视频奖励