上报相关

This commit is contained in:
chenxi 2023-06-06 18:14:07 +08:00
parent 9c94d29418
commit ec3ae95cc4
4 changed files with 66 additions and 3 deletions

View File

@ -160,6 +160,11 @@ BIReport.MAIL_OPT_TYPE = {
CLAIM = "Claim",
}
BIReport.BOUNTY_OPT_TYPE = {
BOUNTY_LEVEL_UP = "BountyLevelUp",
}
-- b6
local EVENT_NAME_EXIT = "client_exit"
local EVENT_NAME_FIGHT = "client_fight"
@ -181,6 +186,7 @@ local EVENT_NAME_DAILY_TASK = "client_daily_task"
local EVENT_NAME_MAIL_OPT = "client_mail_opt"
local EVENT_NAME_PLAYER_LV_UP = "client_player_lv_up" -- 玩家升级
local EVENT_NAME_PAY_UI_SHOW = "client_pay_ui_show" -- 内购相关界面展示
local EVENT_NAME_BOUNTY_OPT = "client_bounty_opt" -- 战令事件
function BIReport:setIsNewPlayer(isNewPlayer)
self.isNewPlayer = isNewPlayer
@ -239,6 +245,9 @@ function BIReport:report(name, args)
args.gem = DataManager.BagData.ItemData:getItemNumById(GConst.ItemConst.ITEM_ID_GEM)
args.energy = DataManager.BagData.ItemData:getItemNumById(GConst.ItemConst.ITEM_ID_VIT)
end
if DataManager.PlayerData then
args.player_level = DataManager.PlayerData:getLv()
end
end
args.current_version = CS.BF.BFMain.Instance.GameLaunchMgr:GetCurrentVersion()
args.is_new_player = self.isNewPlayer
@ -844,4 +853,15 @@ function BIReport:postPayUIShow(giftType, giftId)
self:report(EVENT_NAME_PAY_UI_SHOW, args)
end
function BIReport:postBountyLevelUp(bountyType, level, exp, season)
local args = {
event_type = BIReport.BOUNTY_OPT_TYPE.BOUNTY_LEVEL_UP,
season = season,
level = level,
exp = exp,
bounty_type = bountyType,
}
self:report(EVENT_NAME_BOUNTY_OPT, args)
end
return BIReport

View File

@ -143,9 +143,10 @@ function LoginManager:loginFinish(data)
local data = {}
data.max_chapter = DataManager.ChapterData:getNewChapterId()
-- data.ads_num = DataManager.PlayerData:getAdCount()
-- data.pay_money = DataManager.PlayerData:getPaymentCount()
data.pay_money = DataManager.PlayerData:getTotalPayAmount()
-- data.play_days = DataManager.PlayerData:getLoginDay()
data.now_version = Platform:getClientVersion()
data.player_level = DataManager.PlayerData:getLv()
CS.ThinkingAnalytics.ThinkingAnalyticsAPI.UserSet(data)
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.LOGIN_REQ_SUCCESS)

View File

@ -17,6 +17,8 @@ function BountyData:init(data)
self.level = data.level or 1
self.exp = data.exp or 0
self.bought = data.bought
self.isBoughtBase = nil
self.isBoughtAdvance = nil
self.popBoughtTime = LocalData:getBountyPopTime()
self.claimed = data.claimed or {}
self.claimedCount = 0
@ -87,6 +89,8 @@ function BountyData:checkNextSeason()
self.level = 1
self.exp = 0
self.bought = false
self.isBoughtBase = nil
self.isBoughtAdvance = nil
for k, v in pairs(self.claimed) do
self.claimed[k] = false
end
@ -107,7 +111,13 @@ function BountyData:setBought(season, level)
return
end
self.bought = true
self.level = level or self.level
self.isBoughtBase = nil
self.isBoughtAdvance = nil
level = level or self.level
if self.level ~= level then
self.level = level
BIReport:postBountyLevelUp(self:getBountyReportType(), self.level, self.exp, self.season)
end
DataManager.DailyTaskData:unlockBountyTask()
self:markDirty()
end
@ -122,6 +132,7 @@ end
function BountyData:addExp(num)
self.exp = self.exp + num
local levelBefore = self.level
while true do
local lvUpExp = self:getLvUpExp()
if self.exp >= lvUpExp then
@ -131,6 +142,9 @@ function BountyData:addExp(num)
break
end
end
if levelBefore ~= self.level then
BIReport:postBountyLevelUp(self:getBountyReportType(), self.level, self.exp, self.season)
end
self:markDirty()
end
@ -289,6 +303,7 @@ end
function BountyData:onBoughtLevel()
self.level = self.level + 1
BIReport:postBountyLevelUp(self:getBountyReportType(), self.level, self.exp, self.season)
self:markDirty()
end
@ -355,4 +370,31 @@ function BountyData:getBuyProBountyAddLevelCount()
return self.buyProBountyAddLevelCount
end
function BountyData:getIsBoughtBase()
if self.isBoughtBase == nil then
self.isBoughtBase = DataManager.ShopData:getGiftBoughtNum(PayManager.PURCHARSE_TYPE.ACT_GIFT, ACT_GIFT_ID_BOUNTY) > 0
end
return self.isBoughtBase
end
function BountyData:getIsBoughtAdvance()
if self.isBoughtAdvance == nil then
self.isBoughtAdvance = DataManager.ShopData:getGiftBoughtNum(PayManager.PURCHARSE_TYPE.ACT_GIFT, ACT_GIFT_ID_BOUNTY_ADVANCED) > 0
end
return self.isBoughtAdvance
end
function BountyData:getBountyReportType()
if not self.bought then
return 0
end
if self:getIsBoughtBase() then
return 1
end
if self:getIsBoughtAdvance() then
return 2
end
return 0
end
return BountyData

View File

@ -14,7 +14,7 @@ function ShopData:clear()
end
function ShopData:setDirty()
self.data.isDirty = not self.data.isDirty
self.data.isDirty = not self.data.isDirty
end
function ShopData:initCrossDay()