【容错】登录容错添加,服务器发送不存在的活动时,不再卡死

dev_chengFeng
gaoxin 2021-07-22 19:35:22 +08:00
parent 3205cdf5d0
commit 9d7a51fd57
2 changed files with 73 additions and 63 deletions

View File

@ -137,48 +137,51 @@ function this.InitActivityServerData(msg, isUpdate)
this.mission = {}
end
for i, v in ipairs(msg.activityInfo) do
this.CheckMoneyProgress(v)
this.mission[v.activityId] = v
--LogYellow("刷新活动数据activityId" .. v.activityId .. " value" .. v.value)
for n, m in ipairs(v.mission) do
--LogGreen(" 刷新活动数据missionId" .. m.missionId .. " state" .. m.state .. " progress" .. m.progress)
if (v.activityId == ActivityTypeDef.OnlineGift) then
this.onlineOpen = true
this.onlineGetRewardState[m.missionId] = m.state
this.haveOnlineTime = m.progress
this.onlineTime= m.progress
------LogGreen("------------------------------------后端刷新在线时长2 "..m.progress.." "..TimeToHMS(m.progress))
this.cuOnLineTimestamp = GetTimeStamp() - m.progress
--this.StartOnlineUpdate()
elseif (v.activityId == ActivityTypeDef.EightDayGift) then
this.sevenDayOpen = true
this.sevenDayGetRewardState[n] = m.state
this.canRewardDay = m.progress
elseif (v.activityId == ActivityTypeDef.ChapterAward) then
this.chapterOpen = true
this.chapterGetRewardState[m.missionId] = m.state
if GlobalActivity[v.activityId] then
this.CheckMoneyProgress(v)
this.mission[v.activityId] = v
--LogYellow("刷新活动数据activityId" .. v.activityId .. " value" .. v.value)
for n, m in ipairs(v.mission) do
--LogGreen(" 刷新活动数据missionId" .. m.missionId .. " state" .. m.state .. " progress" .. m.progress)
if (v.activityId == ActivityTypeDef.OnlineGift) then
this.onlineOpen = true
this.onlineGetRewardState[m.missionId] = m.state
this.haveOnlineTime = m.progress
this.onlineTime= m.progress
------LogGreen("------------------------------------后端刷新在线时长2 "..m.progress.." "..TimeToHMS(m.progress))
this.cuOnLineTimestamp = GetTimeStamp() - m.progress
--this.StartOnlineUpdate()
elseif (v.activityId == ActivityTypeDef.EightDayGift) then
this.sevenDayOpen = true
this.sevenDayGetRewardState[n] = m.state
this.canRewardDay = m.progress
elseif (v.activityId == ActivityTypeDef.ChapterAward) then
this.chapterOpen = true
this.chapterGetRewardState[m.missionId] = m.state
end
if GlobalActivity[v.activityId].Type == ActivityTypeDef.FifteenDayGift then
Game.GlobalEvent:DispatchEvent(GameEvent.EightDay.FifteenDayGift)
end
end
if GlobalActivity[v.activityId].Type == ActivityTypeDef.FifteenDayGift then
Game.GlobalEvent:DispatchEvent(GameEvent.EightDay.FifteenDayGift)
if (v.activityId == ActivityTypeDef.EightDayGift) then
this.sevenDayTime = v.endTime - GetTimeStamp()
this.dayTime = GetTimeStamp() - v.startTime
end
end
if (v.activityId == ActivityTypeDef.EightDayGift) then
this.sevenDayTime = v.endTime - GetTimeStamp()
this.dayTime = GetTimeStamp() - v.startTime
end
if v.choiceRewardId then
this.choiceId=v.choiceRewardId
end
for m, n in ConfigPairs(luckyCatConfig) do
--Log(v.activityId.."活动ID")
if (v.activityId == n.ActivityId) then
LuckyCatManager.isOpenLuckyCat = true
LuckyCatManager.GetRewardProgress(v.mission, v.activityId, v.value)
if v.choiceRewardId then
this.choiceId=v.choiceRewardId
end
for m, n in ConfigPairs(luckyCatConfig) do
--Log(v.activityId.."活动ID")
if (v.activityId == n.ActivityId) then
LuckyCatManager.isOpenLuckyCat = true
LuckyCatManager.GetRewardProgress(v.mission, v.activityId, v.value)
end
end
this.CheckActiveIsOpen(v)
else
LogError("服务器发送了前端不存在的活动ID"..v.activityId)
end
this.CheckActiveIsOpen(v)
end
TreasureOfSomebodyManagerV2.SetTreasureLocalData()
this.OnlineStartCountDown()
@ -503,19 +506,22 @@ end
-- 检测进度
function this.CheckMoneyProgress(v)
local type = ConfigManager.GetConfigData(ConfigName.GlobalActivity,v.activityId).Type
if type == ActivityTypeDef.FirstRecharge
or type == ActivityTypeDef.LuckyCat
or type == ActivityTypeDef.DailyRecharge
-- or v.activityId == ActivityTypeDef.ContinuityRecharge
or type == ActivityTypeDef.AccumulativeRechargeExper
or type == ActivityTypeDef.DynamicAct_recharge
or type == ActivityTypeDef.FindFairyCeremony then
for n, m in ipairs(v.mission) do
m.progress = m.progress / 1000
end
v.value = v.value / 1000
local act = ConfigManager.TryGetConfigData(ConfigName.GlobalActivity, v.activityId)
if act then
local type = act.Type
if type == ActivityTypeDef.FirstRecharge
or type == ActivityTypeDef.LuckyCat
or type == ActivityTypeDef.DailyRecharge
-- or v.activityId == ActivityTypeDef.ContinuityRecharge
or type == ActivityTypeDef.AccumulativeRechargeExper
or type == ActivityTypeDef.DynamicAct_recharge
or type == ActivityTypeDef.FindFairyCeremony then
for n, m in ipairs(v.mission) do
m.progress = m.progress / 1000
end
v.value = v.value / 1000
end
end
end

View File

@ -36,18 +36,22 @@ function this.InitData(func)
end
function this.InitDataList(id)
local configs = ConfigManager.GetAllConfigsDataByKey(ConfigName.LingLongPool,"ActivityId",id)
for i = 1 ,#configs do
local data = {}
data.id = configs[i].Id
data.reward = configs[i].ItemId
data.rate = configs[i].FakeRate
data.typeIndex = configs[i].Position
data.address = configs[i].Address
data.sort = configs[i].Sort
data.state = 0
rewardList[configs[i].Id] = data
end
local configs = ConfigManager.TryGetConfigDataByKey(ConfigName.LingLongPool,"ActivityId",id)
if configs then
for i = 1 ,#configs do
local data = {}
data.id = configs[i].Id
data.reward = configs[i].ItemId
data.rate = configs[i].FakeRate
data.typeIndex = configs[i].Position
data.address = configs[i].Address
data.sort = configs[i].Sort
data.state = 0
rewardList[configs[i].Id] = data
end
else
LogError("LingLongPool 中未找到 ActivityId :".. id)
end
end
function this.GetRewardList()