diff --git a/model/player.go b/model/player.go index 50a84d8..546d9a2 100644 --- a/model/player.go +++ b/model/player.go @@ -113,6 +113,10 @@ const ( SystemFreeGive_GiveType_PermitAward // 赛季通行证奖励 SystemFreeGive_GiveType_TaskPermit // 赛季通行证任务奖励 SystemFreeGive_GiveType_TaskPermitRank // 赛季通行证排名奖励 + SystemFreeGive_PhoneLottery // 手机积分抽奖奖励 + SystemFreeGive_PhoneLotterySwap // 手机积分兑换奖励 + SystemFreeGive_CollectBox // 开启卡片礼盒奖励 + SystemFreeGive_CollectBoxSwap // 卡片礼盒兑换奖励 ) const ( SystemFreeGive_CoinType_Coin int32 = iota //金币 diff --git a/model/rabbit_mq.go b/model/rabbit_mq.go index 8bef4ff..697c52d 100644 --- a/model/rabbit_mq.go +++ b/model/rabbit_mq.go @@ -52,34 +52,3 @@ func GeneratePhoneLottery(snid int32, platform string, items string, lotteryType params["Ts"] = strconv.Itoa(int(time.Now().Unix())) return NewRabbitMQData(mq.BackPhoneLottery, params) } - -//type PlayerGameEntryEvent struct { -// RecordId string //游戏记录ID -// SnId int32 //用户ID -// Platform int32 //平台 -// OS int //0 Windows 1 Android 2 iOS -// GameId int //游戏id -// ModeId int //游戏模式 -// Time int64 //入场时间 RFC3339 -// Id int32 //游戏id -//} - -// GenerateEnterEvent 玩家或观众进场事件 -//func GenerateEnterEvent(recordId string, snId int32, platform, os string, gameId, modeId int, gameFreeId int32) *RabbitMQData { -// m := &PlayerGameEntryEvent{ -// RecordId: recordId, -// SnId: snId, -// GameId: gameId, -// ModeId: modeId, -// Time: time.Now().Unix(), -// Id: gameFreeId, -// } -// pf, err := strconv.Atoi(platform) -// if err != nil { -// logger.Error(err) -// return nil -// } -// m.Platform = int32(pf) -// m.OS = common.DeviceNum[os] -// return NewRabbitMQData(string(MqNameEnterEvent), m) -//} diff --git a/worldsrv/action_bag.go b/worldsrv/action_bag.go index 1c628f0..8244887 100644 --- a/worldsrv/action_bag.go +++ b/worldsrv/action_bag.go @@ -154,6 +154,20 @@ func CSUpBagInfo(s *netlib.Session, packetid int, data interface{}, sid int64) e ObtainTime: v.ObtainTime, }) } + if gainWay == common.GainWay_Collect { + for _, v := range items { + tp1 := int32(-1) + if v.ItemId == common.ItemIDCoin { + tp1 = model.SystemFreeGive_CoinType_Coin + } else if v.ItemId == common.ItemIDDiamond { + tp1 = model.SystemFreeGive_CoinType_Diamond + } + if !p.IsRob && tp1 >= 0 { + LogChannelSingleton.WriteMQData( + model.GenerateSystemFreeGive(p.SnId, p.Name, p.Platform, p.Channel, model.SystemFreeGive_CollectBox, tp1, v.ItemNum)) + } + } + } } } @@ -415,6 +429,17 @@ func CSPropExchange(s *netlib.Session, packetid int, data interface{}, sid int64 ItemId: v.ItemId, ItemNum: v.ItemNum, }) + + tp1 := int32(-1) + if v.ItemId == common.ItemIDCoin { + tp1 = model.SystemFreeGive_CoinType_Coin + } else if v.ItemId == common.ItemIDDiamond { + tp1 = model.SystemFreeGive_CoinType_Diamond + } + if !p.IsRob && tp1 >= 0 { + LogChannelSingleton.WriteMQData( + model.GenerateSystemFreeGive(p.SnId, p.Name, p.Platform, p.Channel, model.SystemFreeGive_CollectBoxSwap, tp1, v.ItemNum)) + } } send(bag.OpResultCode_OPRC_Sucess) diff --git a/worldsrv/action_phonelottery.go b/worldsrv/action_phonelottery.go index 6872433..9d627f7 100644 --- a/worldsrv/action_phonelottery.go +++ b/worldsrv/action_phonelottery.go @@ -193,6 +193,18 @@ func (this *CSPhoneLotteryHandler) Process(s *netlib.Session, packetid int, data return err } LogChannelSingleton.WriteMQData(model.GeneratePhoneLottery(p.SnId, p.Platform, string(jsonData), 1, 0, 0, 0)) + for _, v := range items { + tp1 := int32(-1) + if v.ItemId == common.ItemIDCoin { + tp1 = model.SystemFreeGive_CoinType_Coin + } else if v.ItemId == common.ItemIDDiamond { + tp1 = model.SystemFreeGive_CoinType_Diamond + } + if !p.IsRob && tp1 >= 0 { + LogChannelSingleton.WriteMQData( + model.GenerateSystemFreeGive(p.SnId, p.Name, p.Platform, p.Channel, model.SystemFreeGive_PhoneLottery, tp1, v.ItemNum)) + } + } } return nil } diff --git a/worldsrv/shopmgr.go b/worldsrv/shopmgr.go index 779e6c8..8b29cc6 100644 --- a/worldsrv/shopmgr.go +++ b/worldsrv/shopmgr.go @@ -576,6 +576,18 @@ func (this *ShopMgr) createPhoneScore(p *Player, shopInfo *model.ShopInfo, costN if err == nil { LogChannelSingleton.WriteMQData(model.GeneratePhoneLottery(p.SnId, p.Platform, string(jsonData), 2, 0, 0, int(costNum))) } + for _, v := range items { + tp1 := int32(-1) + if v.ItemId == common.ItemIDCoin { + tp1 = model.SystemFreeGive_CoinType_Coin + } else if v.ItemId == common.ItemIDDiamond { + tp1 = model.SystemFreeGive_CoinType_Diamond + } + if !p.IsRob && tp1 >= 0 { + LogChannelSingleton.WriteMQData( + model.GenerateSystemFreeGive(p.SnId, p.Name, p.Platform, p.Channel, model.SystemFreeGive_PhoneLotterySwap, tp1, v.ItemNum)) + } + } } }