diff --git a/model/dataevent.go b/model/dataevent.go index 3a324e1..12b2d9c 100644 --- a/model/dataevent.go +++ b/model/dataevent.go @@ -133,10 +133,12 @@ type PlayerLoginEvent struct { IsNew int32 //是否是新用户,1是 0否 DeviceId string //设备id ChannelId string //渠道id + AppChannel string //包渠道 + ClientVer int32 // 客户端版本 } func CreatePlayerLoginEvent(snid int32, channel, promoter, platform, city, os, ip string, createTime, - upgradeTime time.Time, isBindPhone int32, telephonePromoter int32, deviceId, channelId string) *PlayerLoginEvent { + upgradeTime time.Time, isBindPhone int32, telephonePromoter int32, deviceId, channelId, appChannel string, clientVer int32) *PlayerLoginEvent { isNew := int32(0) if createTime.Local().YearDay() == time.Now().Local().YearDay() && createTime.Local().Year() == time.Now().Local().Year() { isNew = 1 @@ -158,25 +160,11 @@ func CreatePlayerLoginEvent(snid int32, channel, promoter, platform, city, os, i IsNew: isNew, DeviceId: deviceId, ChannelId: channelId, + AppChannel: appChannel, + ClientVer: clientVer, } } -func MarshalPlayerLoginEvent(source, snid int32, channel, promoter, platform, city, os, ip string, - createTime, upgradeTime time.Time, isBindPhone int32, telephonePromoter int32, deviceId, channelId string) (data string, err error) { - raw := &RabbitMQDataRaw{ - Source: source, - Data: CreatePlayerLoginEvent(snid, channel, promoter, platform, city, os, ip, createTime, - upgradeTime, isBindPhone, telephonePromoter, deviceId, channelId), - } - - d, e := json.Marshal(raw) - if e == nil { - data = string(d[:]) - } - err = e - return -} - // 用户升级账号 type PlayerBindPhoneEvent struct { SnId int32 //用户ID diff --git a/worldsrv/action_player.go b/worldsrv/action_player.go index e7791e2..23fbfbb 100644 --- a/worldsrv/action_player.go +++ b/worldsrv/action_player.go @@ -1983,18 +1983,18 @@ func CSPlayerData(s *netlib.Session, packetid int, data interface{}, sid int64) } } - // 老版本升级 + // 客户端升级奖励 clientUpgradeConfig := PlatformMgrSingleton.GetConfig(p.Platform).ClientUpgrade if clientUpgradeConfig != nil && clientUpgradeConfig.GetOn() == common.On && (len(model.GameParamData.ClientVersionChannel) == 0 || slices.Contains(model.GameParamData.ClientVersionChannel, p.LastChannel)) { - if p.ClientVer < model.GameParamData.ClientVersion { - if cspl.GetClientVer() == model.GameParamData.ClientVersion { - // 升级了 - p.ClientVer = model.GameParamData.ClientVersion - AddMailClientUpgrade(p.SnId, clientUpgradeConfig.GetReward()) - } + if p.ClientVer < model.GameParamData.ClientVersion && cspl.GetClientVer() == model.GameParamData.ClientVersion { + AddMailClientUpgrade(p.SnId, clientUpgradeConfig.GetReward()) } } + // 客户端升级 + if p.ClientVer < cspl.GetClientVer() && cspl.GetClientVer() <= model.GameParamData.ClientVersion { + p.ClientVer = cspl.GetClientVer() + } } // 有缓存数据 diff --git a/worldsrv/player.go b/worldsrv/player.go index f8f267a..ad5fd5b 100644 --- a/worldsrv/player.go +++ b/worldsrv/player.go @@ -2940,7 +2940,7 @@ func (this *Player) ReportLoginEvent() { } mq.Write(model.GenerateLogin(model.CreatePlayerLoginEvent(this.SnId, this.Channel, this.BeUnderAgentCode, this.Platform, this.City, this.DeviceOS, this.Ip, - this.CreateTime, this.UpgradeTime, isBindPhone, this.TelephonePromoter, this.DeviceId, this.ChannelId))) + this.CreateTime, this.UpgradeTime, isBindPhone, this.TelephonePromoter, this.DeviceId, this.ChannelId, this.AppChannel, this.ClientVer))) //登录通知 //ActMonitorMgrSington.SendActMonitorEvent(ActState_Login, this.SnId, this.Name, this.Platform, // 0, 0, "", 0)