优化一下性能
This commit is contained in:
parent
ed400f1b75
commit
a2ca40f00c
@ -445,28 +445,34 @@ function BIReport:postAdEvent()
|
||||
end
|
||||
CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_AdRewardAD", json.encode({}))
|
||||
CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_AdRewardAD", json.encode({}))
|
||||
local afPostAdCount = {
|
||||
[2] = true,
|
||||
[3] = true,
|
||||
[5] = true,
|
||||
[10] = true,
|
||||
[20] = true,
|
||||
[40] = true,
|
||||
[80] = true,
|
||||
}
|
||||
if afPostAdCount[adCount] then
|
||||
if not self.afPostAdCount then
|
||||
self.afPostAdCount = {
|
||||
[2] = true,
|
||||
[3] = true,
|
||||
[5] = true,
|
||||
[10] = true,
|
||||
[20] = true,
|
||||
[40] = true,
|
||||
[80] = true,
|
||||
}
|
||||
end
|
||||
|
||||
if self.afPostAdCount[adCount] then
|
||||
local args = {}
|
||||
CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_AdRewardAD_" .. adCount, json.encode(args))
|
||||
end
|
||||
|
||||
local fbPostAdCount = {
|
||||
[2] = true,
|
||||
[3] = true,
|
||||
[5] = true,
|
||||
[10] = true,
|
||||
[20] = true,
|
||||
}
|
||||
if fbPostAdCount[adCount] then
|
||||
if not self.fbPostAdCount then
|
||||
self.fbPostAdCount = {
|
||||
[2] = true,
|
||||
[3] = true,
|
||||
[5] = true,
|
||||
[10] = true,
|
||||
[20] = true,
|
||||
}
|
||||
end
|
||||
|
||||
if self.fbPostAdCount[adCount] then
|
||||
local args = {}
|
||||
CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_AdRewardAD_" .. adCount, json.encode(args))
|
||||
end
|
||||
@ -487,55 +493,59 @@ function BIReport:postChapterEvent(chapter)
|
||||
end
|
||||
CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_Level", json.encode({}))
|
||||
CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_Level", json.encode({}))
|
||||
local postChapter = {
|
||||
[1] = true,
|
||||
[2] = true,
|
||||
[3] = true,
|
||||
[4] = true,
|
||||
[5] = true,
|
||||
[6] = true,
|
||||
[7] = true,
|
||||
[8] = true,
|
||||
[9] = true,
|
||||
[10] = true,
|
||||
[11] = true,
|
||||
[12] = true,
|
||||
[13] = true,
|
||||
[14] = true,
|
||||
[15] = true,
|
||||
[16] = true,
|
||||
[17] = true,
|
||||
[18] = true,
|
||||
[19] = true,
|
||||
[20] = true,
|
||||
[30] = true,
|
||||
[40] = true,
|
||||
[50] = true,
|
||||
}
|
||||
if postChapter[chapter] then
|
||||
if not self.afPostChapter then
|
||||
self.afPostChapter = {
|
||||
[1] = true,
|
||||
[2] = true,
|
||||
[3] = true,
|
||||
[4] = true,
|
||||
[5] = true,
|
||||
[6] = true,
|
||||
[7] = true,
|
||||
[8] = true,
|
||||
[9] = true,
|
||||
[10] = true,
|
||||
[11] = true,
|
||||
[12] = true,
|
||||
[13] = true,
|
||||
[14] = true,
|
||||
[15] = true,
|
||||
[16] = true,
|
||||
[17] = true,
|
||||
[18] = true,
|
||||
[19] = true,
|
||||
[20] = true,
|
||||
[30] = true,
|
||||
[40] = true,
|
||||
[50] = true,
|
||||
}
|
||||
end
|
||||
if self.afPostChapter[chapter] then
|
||||
local args = {}
|
||||
CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_Chapter_" .. chapter, json.encode(args))
|
||||
end
|
||||
|
||||
local fbPostChapter = {
|
||||
[1] = true,
|
||||
[2] = true,
|
||||
[3] = true,
|
||||
[4] = true,
|
||||
[5] = true,
|
||||
[6] = true,
|
||||
[7] = true,
|
||||
[8] = true,
|
||||
[9] = true,
|
||||
[10] = true,
|
||||
[15] = true,
|
||||
[20] = true,
|
||||
[30] = true,
|
||||
[40] = true,
|
||||
[50] = true,
|
||||
}
|
||||
if not self.fbPostChapter then
|
||||
self.fbPostChapter = {
|
||||
[1] = true,
|
||||
[2] = true,
|
||||
[3] = true,
|
||||
[4] = true,
|
||||
[5] = true,
|
||||
[6] = true,
|
||||
[7] = true,
|
||||
[8] = true,
|
||||
[9] = true,
|
||||
[10] = true,
|
||||
[15] = true,
|
||||
[20] = true,
|
||||
[30] = true,
|
||||
[40] = true,
|
||||
[50] = true,
|
||||
}
|
||||
end
|
||||
|
||||
if fbPostChapter[chapter] then
|
||||
if self.fbPostChapter[chapter] then
|
||||
local args = {}
|
||||
CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_Chapter_" .. chapter, json.encode(args))
|
||||
end
|
||||
@ -551,18 +561,21 @@ function BIReport:postFirstGetHero(num)
|
||||
if CS.BF.BFMain.IsShenhe or CS.BF.BFMain.IsWhite then
|
||||
return
|
||||
end
|
||||
local postHeroNum = {
|
||||
[4] = true,
|
||||
[6] = true,
|
||||
[8] = true,
|
||||
[10] = true,
|
||||
[12] = true,
|
||||
[14] = true,
|
||||
[16] = true,
|
||||
[18] = true,
|
||||
[20] = true,
|
||||
}
|
||||
if not postHeroNum[num] then
|
||||
if not self.postHeroNum then
|
||||
self.postHeroNum = {
|
||||
[4] = true,
|
||||
[6] = true,
|
||||
[8] = true,
|
||||
[10] = true,
|
||||
[12] = true,
|
||||
[14] = true,
|
||||
[16] = true,
|
||||
[18] = true,
|
||||
[20] = true,
|
||||
}
|
||||
end
|
||||
|
||||
if not self.postHeroNum[num] then
|
||||
return
|
||||
end
|
||||
local args = {}
|
||||
@ -582,15 +595,18 @@ function BIReport:postHeroLev(beforeLv, lv)
|
||||
end
|
||||
|
||||
local allHeroes = DataManager.HeroData:getAllHeroes()
|
||||
local postHeroLevel = {
|
||||
[3] = true,
|
||||
[5] = true,
|
||||
[7] = true,
|
||||
[9] = true
|
||||
}
|
||||
if not self.postHeroLevel then
|
||||
self.postHeroLevel = {
|
||||
[3] = true,
|
||||
[5] = true,
|
||||
[7] = true,
|
||||
[9] = true
|
||||
}
|
||||
end
|
||||
|
||||
local temp = {}
|
||||
for heroid, heroEntity in pairs(allHeroes) do
|
||||
for heroLv, _ in pairs(postHeroLevel) do
|
||||
for heroLv, _ in pairs(self.postHeroLevel) do
|
||||
if heroEntity:getLv() >= heroLv then
|
||||
temp[heroLv] = (temp[heroLv] or 0) + 1
|
||||
end
|
||||
@ -618,25 +634,28 @@ function BIReport:postLvEvent(beforeLv, nowLv)
|
||||
if not nowLv then
|
||||
return
|
||||
end
|
||||
local postLV = {
|
||||
[1] = true,
|
||||
[2] = true,
|
||||
[3] = true,
|
||||
[5] = true,
|
||||
[10] = true,
|
||||
[15] = true,
|
||||
[20] = true,
|
||||
[30] = true,
|
||||
[40] = true,
|
||||
[50] = true,
|
||||
[60] = true,
|
||||
[70] = true,
|
||||
[80] = true,
|
||||
}
|
||||
if not self.postLV then
|
||||
self.postLV = {
|
||||
[1] = true,
|
||||
[2] = true,
|
||||
[3] = true,
|
||||
[5] = true,
|
||||
[10] = true,
|
||||
[15] = true,
|
||||
[20] = true,
|
||||
[30] = true,
|
||||
[40] = true,
|
||||
[50] = true,
|
||||
[60] = true,
|
||||
[70] = true,
|
||||
[80] = true,
|
||||
}
|
||||
end
|
||||
|
||||
-- CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_grade", json.encode({}))
|
||||
-- CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_grade", json.encode({}))
|
||||
local reportLv
|
||||
for lv, _ in pairs(postLV) do
|
||||
for lv, _ in pairs(self.postLV) do
|
||||
if beforeLv < lv and nowLv >= lv then
|
||||
reportLv = lv
|
||||
break
|
||||
@ -660,28 +679,31 @@ function BIReport:postFirstRechargeEvent(id)
|
||||
if CS.BF.BFMain.IsShenhe or CS.BF.BFMain.IsWhite then
|
||||
return
|
||||
end
|
||||
local postRechargeID = {
|
||||
[1] = false, -- 0.99
|
||||
[2] = false, -- 1.99
|
||||
[3] = true, -- 2.99
|
||||
[4] = false, -- 3.99
|
||||
[5] = true, -- 4.99
|
||||
[6] = false, -- 5.99
|
||||
[7] = false, -- 6.99
|
||||
[8] = false, -- 7.99
|
||||
[9] = false, -- 8.99
|
||||
[10] = true, -- 9.99
|
||||
[11] = false, -- 11.99
|
||||
[12] = false, -- 14.99
|
||||
[13] = true, -- 19.99
|
||||
[14] = false, -- 24.99
|
||||
[15] = true, -- 29.99
|
||||
[16] = true, -- 49.99
|
||||
[17] = false, -- 69.99
|
||||
[18] = false, -- 99.99
|
||||
[19] = false, -- 199.99
|
||||
}
|
||||
if not postRechargeID[id] then
|
||||
if not self.postRechargeID then
|
||||
self.postRechargeID = {
|
||||
[1] = false, -- 0.99
|
||||
[2] = false, -- 1.99
|
||||
[3] = true, -- 2.99
|
||||
[4] = false, -- 3.99
|
||||
[5] = true, -- 4.99
|
||||
[6] = false, -- 5.99
|
||||
[7] = false, -- 6.99
|
||||
[8] = false, -- 7.99
|
||||
[9] = false, -- 8.99
|
||||
[10] = true, -- 9.99
|
||||
[11] = false, -- 11.99
|
||||
[12] = false, -- 14.99
|
||||
[13] = true, -- 19.99
|
||||
[14] = false, -- 24.99
|
||||
[15] = true, -- 29.99
|
||||
[16] = true, -- 49.99
|
||||
[17] = false, -- 69.99
|
||||
[18] = false, -- 99.99
|
||||
[19] = false, -- 199.99
|
||||
}
|
||||
end
|
||||
|
||||
if not self.postRechargeID[id] then
|
||||
return
|
||||
end
|
||||
local cfg = ConfigManager:getConfig("recharge")[id]
|
||||
@ -706,13 +728,16 @@ function BIReport:post24GradeFailEvent(chapterId)
|
||||
if not DataManager:getIsInCreate24Hour() then
|
||||
return
|
||||
end
|
||||
local postChapterId = {
|
||||
[1] = true,
|
||||
[2] = true,
|
||||
[3] = true,
|
||||
[4] = true,
|
||||
}
|
||||
if not postChapterId[chapterId] then
|
||||
if not self.postChapterId then
|
||||
self.postChapterId = {
|
||||
[1] = true,
|
||||
[2] = true,
|
||||
[3] = true,
|
||||
[4] = true,
|
||||
}
|
||||
end
|
||||
|
||||
if not self.postChapterId[chapterId] then
|
||||
return
|
||||
end
|
||||
local args = {}
|
||||
@ -737,17 +762,20 @@ function BIReport:post24HeroLevel(heroId)
|
||||
if not heroEntity or heroEntity:getLv() > 2 then
|
||||
return
|
||||
end
|
||||
local postHeroId = {
|
||||
[22001] = "24_blade_levelup",
|
||||
[32001] = "24_onion_levelup",
|
||||
[42001] = "24_iceheart_levelup",
|
||||
}
|
||||
if not postHeroId[heroId] then
|
||||
if not self.postHeroId then
|
||||
self.postHeroId = {
|
||||
[22001] = "24_blade_levelup",
|
||||
[32001] = "24_onion_levelup",
|
||||
[42001] = "24_iceheart_levelup",
|
||||
}
|
||||
end
|
||||
|
||||
if not self.postHeroId[heroId] then
|
||||
return
|
||||
end
|
||||
local args = {}
|
||||
CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_" .. postHeroId[heroId], json.encode(args))
|
||||
CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_" .. postHeroId[heroId], json.encode(args))
|
||||
CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_" .. self.postHeroId[heroId], json.encode(args))
|
||||
CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_" .. self.postHeroId[heroId], json.encode(args))
|
||||
end
|
||||
|
||||
-- 上报24小时内开宝箱
|
||||
@ -763,10 +791,13 @@ function BIReport:post24OpenBox(count)
|
||||
if not DataManager:getIsInCreate24Hour() then
|
||||
return
|
||||
end
|
||||
local postCount = {
|
||||
[3] = true
|
||||
}
|
||||
if not postCount[count] then
|
||||
if not self.postBoxCount then
|
||||
self.postBoxCount = {
|
||||
[3] = true
|
||||
}
|
||||
end
|
||||
|
||||
if not self.postBoxCount[count] then
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user