local ActLotteryData = BaseClass("ActLotteryData")
local dataExpiredTime = 10
local __init = function(self)
  self.activityId = 0
  self.reward = {}
  self.firstSettlementTime = 0
  self.lastOpenDay = 0
  self.ticketHistory = {}
  self.ticketHistoryExpiredTime = 0
  self.ownerRecord = {}
  self.ownerRecordExpiredTime = 0
  self.giveLogs = {}
  self.giveLogsTotalNum = 0
  self.giveLogsExpiredTime = 0
end
local __delete = function(self)
  self.activityId = nil
  self.reward = nil
  self.firstSettlementTime = nil
  self.lastOpenDay = nil
  self.ticketHistory = nil
  self.ticketHistoryExpiredTime = nil
  self.ownerRecord = nil
  self.ownerRecordExpiredTime = nil
  self.giveLogs = nil
  self.giveLogsTotalNum = nil
  self.giveLogsExpiredTime = nil
end
local ParseData = function(self, message)
  if message == nil then
    return
  end
  if message.activityId ~= nil then
    self.activityId = message.activityId
  end
  if message.reward ~= nil then
    self.reward = message.reward
  end
  if message.firstSettlementTime ~= nil then
    self.firstSettlementTime = message.firstSettlementTime
  end
  if message.lastOpenDay ~= nil then
    self.lastOpenDay = message.lastOpenDay
  end
end
local GetRedNum = function(self)
  local num = 0
  return num
end
local RefreshGetActRewardData = function(self)
  self.reward = {}
end
local SetTicketHistory = function(self, message)
  local curTime = UITimeManager:GetInstance():GetServerTime()
  self.ticketHistory = message.playerArr
  self.ticketHistoryExpiredTime = curTime + dataExpiredTime * 1000
end
local CheckNeedReqTicketHistory = function(self)
  local curDayNumReal, nextOpenTimeReal = DataCenter.ActLotteryDataManager:GetRealBigRewardTimeData(self.activityId)
  local TicketHistory = self.ticketHistory
  local isNeed = true
  if 0 < curDayNumReal then
    if self.ticketHistory ~= nil then
      for k, v in ipairs(TicketHistory) do
        if v.dayNum == curDayNumReal then
          isNeed = false
          break
        end
      end
    else
    end
  else
    isNeed = false
  end
  return isNeed
end
local GetTicketHistory = function(self)
  return self.ticketHistory
end
local CheckTicketHistoryExpired = function(self)
  local curTime = UITimeManager:GetInstance():GetServerTime()
  if curTime > self.ticketHistoryExpiredTime then
    return true
  end
  return false
end
local SetOwnerRecord = function(self, message)
  local curTime = UITimeManager:GetInstance():GetServerTime()
  self.ownerRecord = message.historyArr
  self.ownerRecordExpiredTime = curTime + dataExpiredTime * 1000
end
local GetOwnerRecord = function(self)
  return self.ownerRecord
end
local CheckOwnerRecordExpired = function(self)
  local curTime = UITimeManager:GetInstance():GetServerTime()
  if curTime > self.ownerRecordExpiredTime then
    return true
  end
  return false
end
local SetGiveLogs = function(self, message)
  local curTime = UITimeManager:GetInstance():GetServerTime()
  local start = message.start
  if start == 1 then
    self.giveLogs = message.giveRecordArr
  elseif start == #self.giveLogs + 1 then
    for k, v in ipairs(message.giveRecordArr) do
      table.insert(self.giveLogs, v)
    end
  end
  self.giveLogsTotalNum = message.totalNum
  self.giveLogsExpiredTime = curTime + 3000
end
local GetGiveLogs = function(self)
  return self.giveLogs
end
local CheckGiveLogsExpired = function(self)
  local curTime = UITimeManager:GetInstance():GetServerTime()
  if curTime > self.giveLogsExpiredTime then
    return true
  end
  return false
end
local GetOpenMsg = function(self, message)
  if message.win and message.win == 0 then
    self.lastOpenDay = message.day
  end
end
local GetReceiveBigRewardMsg = function(self, message)
  self.lastOpenDay = message.day
end
ActLotteryData.__init = __init
ActLotteryData.__delete = __delete
ActLotteryData.ParseData = ParseData
ActLotteryData.GetRedNum = GetRedNum
ActLotteryData.RefreshGetActRewardData = RefreshGetActRewardData
ActLotteryData.SetTicketHistory = SetTicketHistory
ActLotteryData.GetTicketHistory = GetTicketHistory
ActLotteryData.CheckTicketHistoryExpired = CheckTicketHistoryExpired
ActLotteryData.SetOwnerRecord = SetOwnerRecord
ActLotteryData.GetOwnerRecord = GetOwnerRecord
ActLotteryData.CheckOwnerRecordExpired = CheckOwnerRecordExpired
ActLotteryData.SetGiveLogs = SetGiveLogs
ActLotteryData.GetGiveLogs = GetGiveLogs
ActLotteryData.CheckGiveLogsExpired = CheckGiveLogsExpired
ActLotteryData.GetOpenMsg = GetOpenMsg
ActLotteryData.GetReceiveBigRewardMsg = GetReceiveBigRewardMsg
ActLotteryData.CheckNeedReqTicketHistory = CheckNeedReqTicketHistory
return ActLotteryData
