diff --git a/lua/app/common/bi_report.lua b/lua/app/common/bi_report.lua index ed388c2b..9da85252 100644 --- a/lua/app/common/bi_report.lua +++ b/lua/app/common/bi_report.lua @@ -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_NETWORK_OPT = "client_network_opt" -- 网络操作 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_ARENA_OPT = "client_arena_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({})) 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) if not EDITOR_MODE then @@ -1048,9 +1449,36 @@ function BIReport:postAppLovinAdRevenue(msg) if args.revenue then args.revenue = tonumber(args.revenue) end - self:report(EVENT_NAME_APPLOVIN_AD_REVENUE, args) - if args.revenue and 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) + if args.revenue 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) + 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 diff --git a/lua/app/common/data_manager.lua b/lua/app/common/data_manager.lua index fffe461d..573a12d4 100644 --- a/lua/app/common/data_manager.lua +++ b/lua/app/common/data_manager.lua @@ -127,6 +127,8 @@ function DataManager:initWithServerData(data) Logger.logHighlight("initWithServerData") Logger.printTable(data) 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.PlayerData:init(data) self.ChapterData:init(data.chapter) @@ -180,12 +182,20 @@ end -- 是否首次登录 function DataManager:getIsFirstLogin() 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 end return false end +-- 是否在新号24小时内 +function DataManager:getIsInCreate24Hour() + local nowTime = Time:getServerTime() + local passTime = nowTime - (self.registerTs or 0) + return passTime < 86400 +end + function DataManager:getIsTodayFirstLogin() return self.todayFirstLogin or false end diff --git a/lua/app/common/pay_manager.lua b/lua/app/common/pay_manager.lua index bab2d912..a35e5cf7 100644 --- a/lua/app/common/pay_manager.lua +++ b/lua/app/common/pay_manager.lua @@ -175,6 +175,7 @@ function PayManager:requestRewards(purchaseToken, orderId, originOrderId, produc local cfgName = PayManager.PURCHARSE_TYPE_CONFIG[gift.act_type] local cfgInfo = ConfigManager:getConfig(cfgName)[gift.id] local rechargeId = cfgInfo.recharge_id + local beforCount = DataManager.PlayerData:getPayCounts(rechargeId) DataManager.PlayerData:addPayment(rechargeId) DataManager.ShopData:addPayment(rechargeId) -- 降档版本 DataManager.ShopData:updateGiftInfo(gift) @@ -183,6 +184,9 @@ function PayManager:requestRewards(purchaseToken, orderId, originOrderId, produc giftId = gift.id, rechargeId = cfgInfo.recharge_id }) + if beforCount <= 0 then + BIReport:postFirstRechargeEvent(rechargeId) + end end) for _, info in ipairs(biPayGetInfo) do diff --git a/lua/app/common/sdk_manager.lua b/lua/app/common/sdk_manager.lua index 76aa0089..4dd60c1a 100644 --- a/lua/app/common/sdk_manager.lua +++ b/lua/app/common/sdk_manager.lua @@ -68,6 +68,8 @@ function SDKManager:init() local SDKMgr = CS.BF.BFMain.Instance.SDKMgr self:initPay() self:initPayListener() + -- 初始化AF的广告回传SDK + CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:InitAppsFlyerAdRevenue() self:initAdsListener() -- 拿到firebasetoken @@ -275,6 +277,11 @@ function SDKManager:initAdsListener() self.adCallback = nil 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 -- 初始化一下 local adManager = CS.AdManager.Instance @@ -301,6 +308,12 @@ function SDKManager:showFullScreenAds(adsClickType, adCallback) BIReport:postAdClick(adsClickType) 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() if adCallback then adCallback() @@ -364,7 +377,7 @@ end function SDKManager:adRewradAd(noReport) ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.X_WATCH_AD) if not noReport then - -- BIReport:postAdEvent() + BIReport:postAdEvent() end end diff --git a/lua/app/module/chapter/chapter_manager.lua b/lua/app/module/chapter/chapter_manager.lua index b78ace71..fe69d241 100644 --- a/lua/app/module/chapter/chapter_manager.lua +++ b/lua/app/module/chapter/chapter_manager.lua @@ -58,6 +58,12 @@ function ChapterManager:startFightFinish(result) end 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 @@ -162,6 +168,9 @@ function ChapterManager:endFightFinish(result) if not reqData.win then DataManager.ShopData:markPopLastChapterActGift() + if DataManager.ChapterData:getChapterFightCount(fightChapterId) == 1 then -- 首次失败上报 + BIReport:postFirstDayGradeFailEvent(fightChapterId) + end end ModuleManager.TaskManager:addFightTaskProgress(reqData.task_stat) diff --git a/lua/app/module/login/login_manager.lua b/lua/app/module/login/login_manager.lua index d32ad686..739c48f8 100644 --- a/lua/app/module/login/login_manager.lua +++ b/lua/app/module/login/login_manager.lua @@ -173,6 +173,10 @@ function LoginManager:loginFinish(data) local info = LocalData:getLastLoginInfo() BIReport:postAccountLoginFinish(info.type) + + if DataManager:getIsFirstLogin() then + BIReport:postLvEvent(0, 1) + end else local info = LocalData:getLastLoginInfo() BIReport:postAccountLoginFailed(info.type, data.err_code) diff --git a/lua/app/module/summon/summon_manager.lua b/lua/app/module/summon/summon_manager.lua index 710a7eb0..73fde500 100644 --- a/lua/app/module/summon/summon_manager.lua +++ b/lua/app/module/summon/summon_manager.lua @@ -41,6 +41,13 @@ function SummonManager:summonFinish(result) ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.X_OPEN_SHOP_BOX_LEVEL_3, 1) 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 diff --git a/lua/app/userdata/hero/hero_data.lua b/lua/app/userdata/hero/hero_data.lua index 3c220227..d549f99d 100644 --- a/lua/app/userdata/hero/hero_data.lua +++ b/lua/app/userdata/hero/hero_data.lua @@ -127,7 +127,9 @@ function HeroData:setHeroLv(id, lv) ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.X_NEW_HERO_GOT) ModuleManager.PlayerManager:checkUnlockAvatar(id) activeBefore = false + BIReport:postFirstGetHero(self.data.activeCount) end + local beforeLv = entity:getLv() entity:setLv(lv) if entity:isActived() then local matchType = entity:getMatchType() @@ -145,6 +147,9 @@ function HeroData:setHeroLv(id, lv) end BIReport:postHeroOpt(id, BIReport.HERO_OPT_TYPE.ACTIVE) end + + BIReport:postHeroLev(beforeLv, lv) + BIReport:postFirstDayHeroLevel(id) end function HeroData:getMatchActiveHeroMap() diff --git a/lua/app/userdata/player/player_data.lua b/lua/app/userdata/player/player_data.lua index 4edb4812..ffaafe8a 100644 --- a/lua/app/userdata/player/player_data.lua +++ b/lua/app/userdata/player/player_data.lua @@ -18,6 +18,8 @@ function PlayerData:init(data) self.data.payAmount = 0 self.data.payCount = 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 for id, count in pairs(stat.pay_counts) do if RECHARGE_CFG[id] then @@ -120,6 +122,7 @@ function PlayerData:addExp(exp) end function PlayerData:setLv(level, exp) + local beforeLv = self.data.level or 0 self.data.level = level self.data.exp = exp self.lvUpNeedExp = self:getNextExp(self.data.level) @@ -128,6 +131,7 @@ function PlayerData:setLv(level, exp) local data = {} data.player_level = self.data.level CS.ThinkingAnalytics.ThinkingAnalyticsAPI.UserSet(data) + BIReport:postLvEvent(beforeLv, level) end function PlayerData:getLv() @@ -191,12 +195,17 @@ function PlayerData:addPayment(rechargeId) local cfg = ConfigManager:getConfig("recharge")[rechargeId] self.data.payAmount = self.data.payAmount + cfg.price self.data.payCount = self.data.payCount + 1 + self.pay_counts[rechargeId] = (self.pay_counts[rechargeId] or 0) + 1 end function PlayerData:getPayCount() return self.data.payCount end +function PlayerData:getPayCounts(rechargeId) + return self.pay_counts[rechargeId] or 0 +end + function PlayerData:addPayCount() self.data.payCount = self.data.payCount + 1 end @@ -563,4 +572,8 @@ function PlayerData:addArenaTicketAdBuyCount() self.data.arenaTicketADCount = self.data.arenaTicketADCount + 1 end +function PlayerData:getRegisterTs() + return self.register_ts or Time:getServerTime() +end + return PlayerData \ No newline at end of file