Merge branch 'dev_20230725' into dungeon

This commit is contained in:
xiekaidong 2023-07-19 20:18:27 +08:00
commit c2dc577fc6
9 changed files with 498 additions and 5 deletions

View File

@ -262,6 +262,7 @@ local EVENT_NAME_PAY_UI_SHOW = "client_pay_ui_show" -- 内购相关界面展示
local EVENT_NAME_BOUNTY_OPT = "client_bounty_opt" -- 通用战令事件(包括常规,竞技场等) local EVENT_NAME_BOUNTY_OPT = "client_bounty_opt" -- 通用战令事件(包括常规,竞技场等)
local EVENT_NAME_NETWORK_OPT = "client_network_opt" -- 网络操作 local EVENT_NAME_NETWORK_OPT = "client_network_opt" -- 网络操作
local EVENT_NAME_APPLOVIN_AD_REVENUE = "client_applovin_ad_revenue" -- applovin广告收入 local EVENT_NAME_APPLOVIN_AD_REVENUE = "client_applovin_ad_revenue" -- applovin广告收入
local EVENT_NAME_IRONSOURCE_AD_REVENUE = "client_ironsource_ad_revenue" -- applovin广告收入
local EVENT_NAME_DAILY_CHALLENGE_OPT = "client_daily_challenge_opt" local EVENT_NAME_DAILY_CHALLENGE_OPT = "client_daily_challenge_opt"
local EVENT_NAME_ARENA_OPT = "client_arena_opt"-- 竞技场 local EVENT_NAME_ARENA_OPT = "client_arena_opt"-- 竞技场
local EVENT_NAME_MISCELLANEOUS_OPT = "event_name_miscellaneous_opt" -- 一些杂项 local EVENT_NAME_MISCELLANEOUS_OPT = "event_name_miscellaneous_opt" -- 一些杂项
@ -435,6 +436,406 @@ function BIReport:postFirstLoginEvent()
CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_first_login", json.encode({})) CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_first_login", json.encode({}))
end end
-- 上报广告播放提升事件,单独处理,只上报到AF和FB,不上报数数
function BIReport:postAdEvent()
-- 只有外网正式渠道真机包才上报
if not Platform:getIsPublishChannel() or EDITOR_MODE then
return
end
-- 审核/白名单模式不上报
if CS.BF.BFMain.IsShenhe or CS.BF.BFMain.IsWhite then
return
end
local adCount = DataManager.PlayerData:getAdCount()
if not adCount then
return
end
CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_AdRewardAD", json.encode({}))
CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_AdRewardAD", json.encode({}))
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
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
end
-- 上报进入章节事件,单独处理,只上报到AF和FB,不上报数数
function BIReport:postChapterEvent(chapter)
-- 只有外网正式渠道真机包才上报
if not Platform:getIsPublishChannel() or EDITOR_MODE then
return
end
-- 审核/白名单模式不上报
if CS.BF.BFMain.IsShenhe or CS.BF.BFMain.IsWhite then
return
end
if not chapter then
return
end
CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_Level", json.encode({}))
CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_Level", json.encode({}))
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
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 self.fbPostChapter[chapter] then
local args = {}
CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_Chapter_" .. chapter, json.encode(args))
end
end
-- 上报获取任意x个英雄
function BIReport:postFirstGetHero(num)
-- 只有外网正式渠道真机包才上报
if not Platform:getIsPublishChannel() or EDITOR_MODE then
return
end
-- 审核/白名单模式不上报
if CS.BF.BFMain.IsShenhe or CS.BF.BFMain.IsWhite then
return
end
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 = {}
CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_herosum_" .. num, json.encode(args))
CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_herosum_" .. num, json.encode(args))
end
-- 上报英雄等级
function BIReport:postHeroLev(beforeLv, lv)
-- 只有外网正式渠道真机包才上报
if not Platform:getIsPublishChannel() or EDITOR_MODE then
return
end
-- 审核/白名单模式不上报
if CS.BF.BFMain.IsShenhe or CS.BF.BFMain.IsWhite then
return
end
local allHeroes = DataManager.HeroData:getAllHeroes()
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(self.postHeroLevel) do
if heroEntity:getLv() >= heroLv then
temp[heroLv] = (temp[heroLv] or 0) + 1
end
end
end
for heroLv, count in pairs(temp) do
if heroLv > beforeLv and heroLv <= lv and count == 5 then
local args = {}
CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_hero4_lev" .. heroLv, json.encode(args))
CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_hero4_lev" .. heroLv, json.encode(args))
end
end
end
-- 上报等级提升事件,单独处理,只上报到AF和FB,不上报数数
function BIReport:postLvEvent(beforeLv, nowLv)
-- 只有外网正式渠道真机包才上报
if not Platform:getIsPublishChannel() or EDITOR_MODE then
return
end
-- 审核/白名单模式不上报
if CS.BF.BFMain.IsShenhe or CS.BF.BFMain.IsWhite then
return
end
if not nowLv then
return
end
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(self.postLV) do
if beforeLv < lv and nowLv >= lv then
reportLv = lv
break
end
end
if not reportLv then
return
end
local args = {}
CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_grade_" .. reportLv, json.encode(args))
CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_grade_" .. reportLv, json.encode(args))
end
-- 上报部分档位首次付费
function BIReport:postFirstRechargeEvent(id)
-- 只有外网正式渠道真机包才上报
if not Platform:getIsPublishChannel() or EDITOR_MODE then
return
end
-- 审核/白名单模式不上报
if CS.BF.BFMain.IsShenhe or CS.BF.BFMain.IsWhite then
return
end
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]
if not cfg then
return
end
local args = {}
CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_package_" .. cfg.price, json.encode(args))
CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_package_" .. cfg.price, json.encode(args))
end
-- 上报24小时内部分章节第一次失败的用户
function BIReport:postFirstDayGradeFailEvent(chapterId)
-- 只有外网正式渠道真机包才上报
if not Platform:getIsPublishChannel() or EDITOR_MODE then
return
end
-- 审核/白名单模式不上报
if CS.BF.BFMain.IsShenhe or CS.BF.BFMain.IsWhite then
return
end
if not DataManager:getIsInCreate24Hour() then
return
end
if not self.postChapterId then
self.postChapterId = {
[1] = true,
[2] = true,
[3] = true,
[5] = true,
}
end
if not self.postChapterId[chapterId] then
return
end
local args = {}
CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_24_grade_" .. chapterId .. "_fail", json.encode(args))
CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_24_grade_" .. chapterId .. "_fail", json.encode(args))
end
-- 上报24小时内部分英雄升级
function BIReport:postFirstDayHeroLevel(heroId)
-- 只有外网正式渠道真机包才上报
if not Platform:getIsPublishChannel() or EDITOR_MODE then
return
end
-- 审核/白名单模式不上报
if CS.BF.BFMain.IsShenhe or CS.BF.BFMain.IsWhite then
return
end
if not DataManager:getIsInCreate24Hour() then
return
end
local heroEntity = DataManager.HeroData:getHeroById(heroId)
if not heroEntity or heroEntity:getLv() > 2 then
return
end
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_" .. self.postHeroId[heroId], json.encode(args))
CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_" .. self.postHeroId[heroId], json.encode(args))
end
-- 上报24小时内开宝箱
function BIReport:postFirstDayOpenBox(count)
-- 只有外网正式渠道真机包才上报
if not Platform:getIsPublishChannel() or EDITOR_MODE then
return
end
-- 审核/白名单模式不上报
if CS.BF.BFMain.IsShenhe or CS.BF.BFMain.IsWhite then
return
end
if not DataManager:getIsInCreate24Hour() then
return
end
if not self.postBoxCount then
self.postBoxCount = {
[3] = true
}
end
if not self.postBoxCount[count] then
return
end
local args = {}
CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_24_boxopen_3", json.encode(args))
CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_24_boxopen_3", json.encode(args))
end
-- AF广告价值回传
function BIReport:logAppsFlyerAdRevenue(mediationNetwork, monetizationNetwork, eventRevenue, data)
if not Platform:getIsPublishChannel() or EDITOR_MODE then
return
end
if not mediationNetwork or not monetizationNetwork or not eventRevenue then
return
end
local jsonStr = data and json.encode(data) or "{}"
CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:LogAppsFlyerAdRevenue(mediationNetwork, monetizationNetwork, eventRevenue, jsonStr)
end
-- Firebase
function BIReport:postFirebaseLog(eventName, eventValue)
if not Platform:getIsPublishChannel() or EDITOR_MODE then
return
end
if not eventName or not eventValue then
return
end
CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostFireBaseEvent(eventName, json.encode(eventValue))
end
-- 以下为数数 -- 以下为数数
function BIReport:printArgsStr(eventName, args) function BIReport:printArgsStr(eventName, args)
if not EDITOR_MODE then if not EDITOR_MODE then
@ -1048,9 +1449,36 @@ function BIReport:postAppLovinAdRevenue(msg)
if args.revenue then if args.revenue then
args.revenue = tonumber(args.revenue) args.revenue = tonumber(args.revenue)
end end
self:report(EVENT_NAME_APPLOVIN_AD_REVENUE, args) if args.revenue then
if args.revenue and args.network_name and args.ad_unit_identifier and args.placement then if args.network_name and args.ad_unit_identifier and args.placement then
self:postAdjustAdRevenueAppLovinMAX(args.revenue, args.network_name, args.ad_unit_identifier, args.placement) self:postAdjustAdRevenueAppLovinMAX(args.revenue, args.network_name, args.ad_unit_identifier, args.placement)
end
local args2 = {
applovin_revenue = args.revenue
}
self:postFirebaseLog("ad_impression", args2)
self:logAppsFlyerAdRevenue(3, args.network_name, args.revenue, args)
-- 最后上报数数因为数数会给args里面增加一些字段
self:report(EVENT_NAME_APPLOVIN_AD_REVENUE, args)
end
end
function BIReport:postIronSourceAdRevenue(msg)
local args = json.decode(msg) or {}
if args.revenue then
args.revenue = tonumber(args.revenue)
end
if args.lifetime_revenue then
args.lifetime_revenue = tonumber(args.lifetime_revenue)
end
if args.revenue then
local args2 = {
ironsource_revenue = args.revenue
}
self:postFirebaseLog("ad_impression", args2)
self:logAppsFlyerAdRevenue(2, args.network_name, args.revenue, args)
-- 最后上报数数因为数数会给args里面增加一些字段
self:report(EVENT_NAME_IRONSOURCE_AD_REVENUE, args)
end end
end end

View File

@ -127,6 +127,8 @@ function DataManager:initWithServerData(data)
Logger.logHighlight("initWithServerData") Logger.logHighlight("initWithServerData")
Logger.printTable(data) Logger.printTable(data)
end end
self.registerTs = data.stat and data.stat.register_ts or Time:getServerTime()
self.registerTs = GFunc.formatTimeStep(self.registerTs or Time:getServerTime())
self.todayFirstLogin = data.today_first_login self.todayFirstLogin = data.today_first_login
self.PlayerData:init(data) self.PlayerData:init(data)
self.ChapterData:init(data.chapter) self.ChapterData:init(data.chapter)
@ -180,12 +182,20 @@ end
-- 是否首次登录 -- 是否首次登录
function DataManager:getIsFirstLogin() function DataManager:getIsFirstLogin()
local nowTime = Time:getServerTime() local nowTime = Time:getServerTime()
if self.registerTs%86400 == nowTime %8640 and self:getIsTodayFirstLogin() then local offset = nowTime - (self.registerTs or 0)
if math.abs(offset) <= 10 and self:getIsTodayFirstLogin() then -- 允许误差
return true return true
end end
return false return false
end end
-- 是否在新号24小时内
function DataManager:getIsInCreate24Hour()
local nowTime = Time:getServerTime()
local passTime = nowTime - (self.registerTs or 0)
return passTime < 86400
end
function DataManager:getIsTodayFirstLogin() function DataManager:getIsTodayFirstLogin()
return self.todayFirstLogin or false return self.todayFirstLogin or false
end end

View File

@ -175,6 +175,7 @@ function PayManager:requestRewards(purchaseToken, orderId, originOrderId, produc
local cfgName = PayManager.PURCHARSE_TYPE_CONFIG[gift.act_type] local cfgName = PayManager.PURCHARSE_TYPE_CONFIG[gift.act_type]
local cfgInfo = ConfigManager:getConfig(cfgName)[gift.id] local cfgInfo = ConfigManager:getConfig(cfgName)[gift.id]
local rechargeId = cfgInfo.recharge_id local rechargeId = cfgInfo.recharge_id
local beforCount = DataManager.PlayerData:getPayCounts(rechargeId)
DataManager.PlayerData:addPayment(rechargeId) DataManager.PlayerData:addPayment(rechargeId)
DataManager.ShopData:addPayment(rechargeId) -- 降档版本 DataManager.ShopData:addPayment(rechargeId) -- 降档版本
DataManager.ShopData:updateGiftInfo(gift) DataManager.ShopData:updateGiftInfo(gift)
@ -183,6 +184,9 @@ function PayManager:requestRewards(purchaseToken, orderId, originOrderId, produc
giftId = gift.id, giftId = gift.id,
rechargeId = cfgInfo.recharge_id rechargeId = cfgInfo.recharge_id
}) })
if beforCount <= 0 then
BIReport:postFirstRechargeEvent(rechargeId)
end
end) end)
for _, info in ipairs(biPayGetInfo) do for _, info in ipairs(biPayGetInfo) do

View File

@ -68,6 +68,8 @@ function SDKManager:init()
local SDKMgr = CS.BF.BFMain.Instance.SDKMgr local SDKMgr = CS.BF.BFMain.Instance.SDKMgr
self:initPay() self:initPay()
self:initPayListener() self:initPayListener()
-- 初始化AF的广告回传SDK
CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:InitAppsFlyerAdRevenue()
self:initAdsListener() self:initAdsListener()
-- 拿到firebasetoken -- 拿到firebasetoken
@ -275,6 +277,11 @@ function SDKManager:initAdsListener()
self.adCallback = nil self.adCallback = nil
end end
end) end)
CS.BF.BFMain.Instance.SDKMgr.BFIronSourceSDKMgr:SetAdRevenuePaidEventCallback(function (result)
if result and result ~= GConst.EMPTY_STRING then
BIReport:postIronSourceAdRevenue(result)
end
end)
elseif CS.UnityEngine.Application.platform == CS.UnityEngine.RuntimePlatform.IPhonePlayer then elseif CS.UnityEngine.Application.platform == CS.UnityEngine.RuntimePlatform.IPhonePlayer then
-- 初始化一下 -- 初始化一下
local adManager = CS.AdManager.Instance local adManager = CS.AdManager.Instance
@ -301,6 +308,12 @@ function SDKManager:showFullScreenAds(adsClickType, adCallback)
BIReport:postAdClick(adsClickType) BIReport:postAdClick(adsClickType)
if EDITOR_MODE then if EDITOR_MODE then
if DataManager.PlayerData then
DataManager.PlayerData:addAdCount()
local data = {}
data.ads_num = DataManager.PlayerData:getAdCount()
CS.ThinkingAnalytics.ThinkingAnalyticsAPI.UserSet(data)
end
self:adRewradAd() self:adRewradAd()
if adCallback then if adCallback then
adCallback() adCallback()
@ -364,7 +377,7 @@ end
function SDKManager:adRewradAd(noReport) function SDKManager:adRewradAd(noReport)
ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.X_WATCH_AD) ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.X_WATCH_AD)
if not noReport then if not noReport then
-- BIReport:postAdEvent() BIReport:postAdEvent()
end end
end end

View File

@ -58,6 +58,12 @@ function ChapterManager:startFightFinish(result)
end end
ModuleManager.BattleManager:playBattle(GConst.BattleConst.BATTLE_TYPE.STAGE, params) ModuleManager.BattleManager:playBattle(GConst.BattleConst.BATTLE_TYPE.STAGE, params)
-- 上报FB AF章节
local chapterId = DataManager.ChapterData:getChapterId()
if result.reqData.chapter_id then
chapterId = result.reqData.chapter_id
end
BIReport:postChapterEvent(chapterId)
end end
end end
@ -162,6 +168,9 @@ function ChapterManager:endFightFinish(result)
if not reqData.win then if not reqData.win then
DataManager.ShopData:markPopLastChapterActGift() DataManager.ShopData:markPopLastChapterActGift()
if DataManager.ChapterData:getChapterFightCount(fightChapterId) == 1 then -- 首次失败上报
BIReport:postFirstDayGradeFailEvent(fightChapterId)
end
end end
ModuleManager.TaskManager:addFightTaskProgress(reqData.task_stat) ModuleManager.TaskManager:addFightTaskProgress(reqData.task_stat)

View File

@ -173,6 +173,10 @@ function LoginManager:loginFinish(data)
local info = LocalData:getLastLoginInfo() local info = LocalData:getLastLoginInfo()
BIReport:postAccountLoginFinish(info.type) BIReport:postAccountLoginFinish(info.type)
if DataManager:getIsFirstLogin() then
BIReport:postLvEvent(0, 1)
end
else else
local info = LocalData:getLastLoginInfo() local info = LocalData:getLastLoginInfo()
BIReport:postAccountLoginFailed(info.type, data.err_code) BIReport:postAccountLoginFailed(info.type, data.err_code)

View File

@ -41,6 +41,13 @@ function SummonManager:summonFinish(result)
ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.X_OPEN_SHOP_BOX_LEVEL_3, 1) ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.X_OPEN_SHOP_BOX_LEVEL_3, 1)
end end
end end
if result.summon_info.count then
local totalCount = 0
for t, count in pairs(result.summon_info.count) do
totalCount = totalCount + count
end
BIReport:postFirstDayOpenBox(totalCount)
end
end end
end end

View File

@ -127,7 +127,9 @@ function HeroData:setHeroLv(id, lv)
ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.X_NEW_HERO_GOT) ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.X_NEW_HERO_GOT)
ModuleManager.PlayerManager:checkUnlockAvatar(id) ModuleManager.PlayerManager:checkUnlockAvatar(id)
activeBefore = false activeBefore = false
BIReport:postFirstGetHero(self.data.activeCount)
end end
local beforeLv = entity:getLv()
entity:setLv(lv) entity:setLv(lv)
if entity:isActived() then if entity:isActived() then
local matchType = entity:getMatchType() local matchType = entity:getMatchType()
@ -145,6 +147,9 @@ function HeroData:setHeroLv(id, lv)
end end
BIReport:postHeroOpt(id, BIReport.HERO_OPT_TYPE.ACTIVE) BIReport:postHeroOpt(id, BIReport.HERO_OPT_TYPE.ACTIVE)
end end
BIReport:postHeroLev(beforeLv, lv)
BIReport:postFirstDayHeroLevel(id)
end end
function HeroData:getMatchActiveHeroMap() function HeroData:getMatchActiveHeroMap()

View File

@ -18,6 +18,8 @@ function PlayerData:init(data)
self.data.payAmount = 0 self.data.payAmount = 0
self.data.payCount = 0 self.data.payCount = 0
self.data.adCount = stat.ad_count or 0 self.data.adCount = stat.ad_count or 0
self.pay_counts = stat.pay_counts or {}
self.register_ts = GFunc.formatTimeStep(stat.register_ts or Time:getServerTime())
if stat.pay_counts then if stat.pay_counts then
for id, count in pairs(stat.pay_counts) do for id, count in pairs(stat.pay_counts) do
if RECHARGE_CFG[id] then if RECHARGE_CFG[id] then
@ -120,6 +122,7 @@ function PlayerData:addExp(exp)
end end
function PlayerData:setLv(level, exp) function PlayerData:setLv(level, exp)
local beforeLv = self.data.level or 0
self.data.level = level self.data.level = level
self.data.exp = exp self.data.exp = exp
self.lvUpNeedExp = self:getNextExp(self.data.level) self.lvUpNeedExp = self:getNextExp(self.data.level)
@ -128,6 +131,7 @@ function PlayerData:setLv(level, exp)
local data = {} local data = {}
data.player_level = self.data.level data.player_level = self.data.level
CS.ThinkingAnalytics.ThinkingAnalyticsAPI.UserSet(data) CS.ThinkingAnalytics.ThinkingAnalyticsAPI.UserSet(data)
BIReport:postLvEvent(beforeLv, level)
end end
function PlayerData:getLv() function PlayerData:getLv()
@ -191,12 +195,17 @@ function PlayerData:addPayment(rechargeId)
local cfg = ConfigManager:getConfig("recharge")[rechargeId] local cfg = ConfigManager:getConfig("recharge")[rechargeId]
self.data.payAmount = self.data.payAmount + cfg.price self.data.payAmount = self.data.payAmount + cfg.price
self.data.payCount = self.data.payCount + 1 self.data.payCount = self.data.payCount + 1
self.pay_counts[rechargeId] = (self.pay_counts[rechargeId] or 0) + 1
end end
function PlayerData:getPayCount() function PlayerData:getPayCount()
return self.data.payCount return self.data.payCount
end end
function PlayerData:getPayCounts(rechargeId)
return self.pay_counts[rechargeId] or 0
end
function PlayerData:addPayCount() function PlayerData:addPayCount()
self.data.payCount = self.data.payCount + 1 self.data.payCount = self.data.payCount + 1
end end
@ -563,4 +572,8 @@ function PlayerData:addArenaTicketAdBuyCount()
self.data.arenaTicketADCount = self.data.arenaTicketADCount + 1 self.data.arenaTicketADCount = self.data.arenaTicketADCount + 1
end end
function PlayerData:getRegisterTs()
return self.register_ts or Time:getServerTime()
end
return PlayerData return PlayerData