package main import ( "mongo.games.com/goserver/core/logger" "mongo.games.com/goserver/core/netlib" "mongo.games.com/game/common" "mongo.games.com/game/protocol/welfare" ) func init() { common.Register(int(welfare.SPacketID_PACKET_CSLotteryInfo), &welfare.CSLotteryInfo{}, CSLotteryInfoHandler) } func CSLotteryInfoHandler(s *netlib.Session, packetid int, data interface{}, sid int64) error { logger.Logger.Tracef("CSLotteryInfo Process recv %v", data) _, ok := data.(*welfare.CSLotteryInfo) if !ok { return nil } p := PlayerMgrSington.GetPlayer(sid) if p == nil { return nil } pack := &welfare.SCLotteryInfo{} var list []*welfare.LotteryInfo cfg := PlatformMgrSingleton.GetConfig(p.Platform).LotteryConfig if cfg != nil { list = LotteryMgrInst.GetList(p.Platform) pack.Info = list } // player lottery info info := PlayerInfoMgrSingle.Players[p.SnId] if info != nil { // 当前开启中的抽奖活动id for _, v := range list { playerLottery := info.Lottery[v.GetId()] if playerLottery != nil && playerLottery.StartTs == v.GetStartTs() { v.CostRoomCard = playerLottery.CostCard v.Codes = playerLottery.Code } } } p.SendToClient(int(welfare.SPacketID_PACKET_SCLotteryInfo), pack) logger.Logger.Tracef("SCLotteryInfo: %v", pack) return nil }