增加赠送奖励记录

This commit is contained in:
sk 2024-07-09 11:35:15 +08:00
parent 0d33bf9fb4
commit e9b80f805e
5 changed files with 53 additions and 31 deletions

View File

@ -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 //金币

View File

@ -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)
//}

View File

@ -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)

View File

@ -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
}

View File

@ -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))
}
}
}
}