From d1e380d9bbe4020063253889f3edc1348c7221fe Mon Sep 17 00:00:00 2001 From: sk <123456@qq.com> Date: Mon, 14 Oct 2024 11:21:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=A2=E6=88=B7=E7=AB=AF=E5=8D=87=E7=BA=A7?= =?UTF-8?q?=E5=A5=96=E5=8A=B1=E8=AE=B0=E5=BD=95=E7=B3=BB=E7=BB=9F=E8=B5=A0?= =?UTF-8?q?=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/constant.go | 1 + model/message.go | 1 + model/player.go | 2 ++ model/rabbit_mq.go | 14 ++++++++++++++ worldsrv/addmail.go | 2 +- worldsrv/mq_coinlog.go | 1 + worldsrv/player.go | 34 ++++++++++++++++++++++++---------- 7 files changed, 44 insertions(+), 11 deletions(-) diff --git a/common/constant.go b/common/constant.go index 9798add..922a6b2 100644 --- a/common/constant.go +++ b/common/constant.go @@ -320,6 +320,7 @@ const ( GainWayClawdollCatch = 112 // 娃娃机抓取到娃娃获取卡 GainWayItemBagChangeDollRevocation = 113 //娃娃兑换后台撤销 GainWayPermitReset = 114 //赛季通行证积分重置 + GainWayClientUpgrade = 115 //客户端升级奖励 ) // 后台选择 金币变化类型 的充值 类型id号起始 diff --git a/model/message.go b/model/message.go index 53724a8..54bc381 100644 --- a/model/message.go +++ b/model/message.go @@ -39,6 +39,7 @@ const ( MSGTYPE_RANK_REWARD //排行榜奖励 MSGTYPE_ITEM_CHANGE //背包使用兑换 MSGTYPE_RANK_PermitReward // 通行证排行奖励 + MSGTYPE_ClientUpgrade // 客户端升级 ) const ( diff --git a/model/player.go b/model/player.go index d353cac..4089e74 100644 --- a/model/player.go +++ b/model/player.go @@ -108,10 +108,12 @@ const ( SystemFreeGive_PhoneLotterySwap // 手机积分兑换奖励 SystemFreeGive_CollectBox // 开启卡片礼盒奖励 SystemFreeGive_CollectBoxSwap // 卡片礼盒兑换奖励 + SystemFreeGive_ClientUpgrade // 客户端升级奖励 ) const ( SystemFreeGive_CoinType_Coin int32 = iota //金币 SystemFreeGive_CoinType_Diamond //钻石 + SystemFreeGive_CoinType_Tiem // 道具 ) type PlayerGameCtrlData struct { diff --git a/model/rabbit_mq.go b/model/rabbit_mq.go index 902c71e..99d432c 100644 --- a/model/rabbit_mq.go +++ b/model/rabbit_mq.go @@ -20,6 +20,20 @@ func GenerateLogin(o *PlayerLoginEvent) *mq.RabbitMQData { return NewRabbitMQData(mq.BackLogin, o) } +type SystemFreeGive struct { + Snid int32 `json:"snid,omitempty"` + Channel string `json:"Channel,omitempty"` + AppChannel string `json:"AppChannel,omitempty"` + ChannelId string `json:"ChannelId,omitempty"` + Platform string `json:"platform,omitempty"` + Name string `json:"name,omitempty"` + GiveWay int32 `json:"givetype,omitempty"` + GiveType int32 `json:"cointype,omitempty"` + Count int64 `json:"count,omitempty"` + Ts int64 `json:"ts,omitempty"` + ItemId int32 `json:"itemid,omitempty"` +} + // GenerateSystemFreeGive 系统免费赠送 func GenerateSystemFreeGive(snid int32, name, platform, channel string, givetype, cointype int32, count int64) *mq.RabbitMQData { params := make(map[string]string) diff --git a/worldsrv/addmail.go b/worldsrv/addmail.go index 6932630..5d6c8de 100644 --- a/worldsrv/addmail.go +++ b/worldsrv/addmail.go @@ -118,7 +118,7 @@ func AddMailClientUpgrade(snid int32, items []*webapi.ItemInfo) { content := i18n.Tr("languages", "Upgrade") AddMail(&AddMailParam{ - Tp: model.MSGTYPE_ITEM, + Tp: model.MSGTYPE_ClientUpgrade, SnId: snid, Title: title, Content: content, diff --git a/worldsrv/mq_coinlog.go b/worldsrv/mq_coinlog.go index 076c157..89dc1c6 100644 --- a/worldsrv/mq_coinlog.go +++ b/worldsrv/mq_coinlog.go @@ -31,6 +31,7 @@ func init() { mq.RegisterMessage(&mq.RegisterMessageParam{Name: mq.BackClientLog, Data: &model.ClientLogMysql{}}) mq.RegisterMessage(&mq.RegisterMessageParam{Name: mq.BackSystemJyb, Data: &model.JybLog{}}) mq.RegisterMessage(&mq.RegisterMessageParam{Name: mq.DBVipGiftLog, Data: &model.DbVip{}}) + mq.RegisterMessage(&mq.RegisterMessageParam{Name: mq.BackSystemFreeGive, Data: &model.SystemFreeGive{}}) } func init() { diff --git a/worldsrv/player.go b/worldsrv/player.go index ad5fd5b..52282dc 100644 --- a/worldsrv/player.go +++ b/worldsrv/player.go @@ -1110,17 +1110,27 @@ func (this *Player) GetMessageAttach(id string) { ItemNum: msg.Params[i+1], // 数量 ObtainTime: time.Now().Unix(), }) - if gainWay == common.GainWayItemPermitRank { - tp := int32(-1) - if msg.Params[i] == common.ItemIDCoin { - tp = model.SystemFreeGive_CoinType_Coin - } else if msg.Params[i] == common.ItemIDDiamond { - tp = model.SystemFreeGive_CoinType_Diamond - } - if tp != -1 { - mq.Write(model.GenerateSystemFreeGive(this.SnId, this.Name, this.Platform, this.Channel, - model.SystemFreeGive_GiveType_TaskPermitRank, tp, msg.Params[i+1])) + + tp := int32(-1) + switch msg.Params[i] { + case common.ItemIDCoin: + tp = model.SystemFreeGive_CoinType_Coin + case common.ItemIDDiamond: + tp = model.SystemFreeGive_CoinType_Diamond + default: + tp = model.SystemFreeGive_CoinType_Tiem + } + + if tp != -1 { + giveType := gainWay + switch gainWay { + case common.GainWayItemPermitRank: + giveType = model.SystemFreeGive_GiveType_TaskPermitRank + case common.GainWayClientUpgrade: + giveType = model.SystemFreeGive_ClientUpgrade } + mq.Write(model.GenerateSystemFreeGive(this.SnId, this.Name, this.Platform, this.Channel, + giveType, tp, msg.Params[i+1])) } } BagMgrSingleton.AddItems(&model.AddItemParam{ @@ -1196,6 +1206,10 @@ func (this *Player) GetMessageAttach(id string) { remark = "通行证排行奖励" gainWay = common.GainWayItemPermitRank addItem() + case model.MSGTYPE_ClientUpgrade: + remark = "客户端升级奖励" + gainWay = common.GainWayClientUpgrade + addItem() } if msg.Coin > 0 { this.AddCoin(msg.Coin, 0, gainWay, msg.Id.Hex(), remark)