英雄操作bi上报

This commit is contained in:
xiekaidong 2023-06-06 17:58:58 +08:00
parent 1f22f95197
commit 8bdd4ae3d3
3 changed files with 63 additions and 0 deletions

View File

@ -160,6 +160,13 @@ BIReport.MAIL_OPT_TYPE = {
CLAIM = "Claim", CLAIM = "Claim",
} }
BIReport.HERO_OPT_TYPE = {
UNLOCK = "Unlock",
ACTIVE = "Active",
LEVEL_UP = "LevelUp",
FORMATION = "Formation",
}
-- b6 -- b6
local EVENT_NAME_EXIT = "client_exit" local EVENT_NAME_EXIT = "client_exit"
local EVENT_NAME_FIGHT = "client_fight" local EVENT_NAME_FIGHT = "client_fight"
@ -179,6 +186,7 @@ local EVENT_NAME_VIT_USE = "client_vit_use"
local EVENT_NAME_VIT_GET = "client_vit_get" local EVENT_NAME_VIT_GET = "client_vit_get"
local EVENT_NAME_DAILY_TASK = "client_daily_task" local EVENT_NAME_DAILY_TASK = "client_daily_task"
local EVENT_NAME_MAIL_OPT = "client_mail_opt" local EVENT_NAME_MAIL_OPT = "client_mail_opt"
local EVENT_NAME_HERO_OPT = "client_hero_opt"
function BIReport:setIsNewPlayer(isNewPlayer) function BIReport:setIsNewPlayer(isNewPlayer)
self.isNewPlayer = isNewPlayer self.isNewPlayer = isNewPlayer
@ -825,4 +833,32 @@ function BIReport:postAccountChangeFinish(loginType, success)
self:report(EVENT_NAME_ACCOUNT_OPT, args) self:report(EVENT_NAME_ACCOUNT_OPT, args)
end end
function BIReport:postHeroOpt(heroId, optType)
local heroEntity = DataManager.HeroData:getHeroById(heroId)
if not heroEntity then
return
end
local args = {
hero_id = heroId,
level = heroEntity:getLv(),
event_type = optType
}
local formation = DataManager.FormationData:getStageFormation()
for matchType, heroId in pairs(formation) do
local entity = DataManager.HeroData:getHeroById(heroId)
if entity then
if args.fomation then
args.fomation = args.fomation .. "|"
else
args.fomation = GConst.EMPTY_STRING
end
args.fomation = args.fomation .. heroId .. ":" .. entity:getLv()
end
end
self:report(EVENT_NAME_HERO_OPT, args)
end
return BIReport return BIReport

View File

@ -17,6 +17,7 @@ function FormationManager:upHeroToStageFormationFinish(result)
if result.err_code == GConst.ERROR_STR.SUCCESS then if result.err_code == GConst.ERROR_STR.SUCCESS then
DataManager.FormationData:init(result) DataManager.FormationData:init(result)
DataManager.HeroData:setDirty() DataManager.HeroData:setDirty()
BIReport:postHeroOpt(result.reqData.id, BIReport.HERO_OPT_TYPE.FORMATION)
end end
end end

View File

@ -9,6 +9,7 @@ function HeroData:ctor()
self.maxHeroLvOnInit = 0 self.maxHeroLvOnInit = 0
self.showHeroUnlockChapter = 0 self.showHeroUnlockChapter = 0
self.heroChapterUnlockMap = {} self.heroChapterUnlockMap = {}
self.heroChapterUnlockMapBi = {}
end end
function HeroData:clear() function HeroData:clear()
@ -20,6 +21,9 @@ function HeroData:init(data)
for k, v in pairs(self.heroChapterUnlockMap) do for k, v in pairs(self.heroChapterUnlockMap) do
self.heroChapterUnlockMap[k] = false self.heroChapterUnlockMap[k] = false
end end
for k, v in pairs(self.heroChapterUnlockMapBi) do
self.heroChapterUnlockMapBi[k] = false
end
if data then if data then
for id, heroInfo in pairs(data) do for id, heroInfo in pairs(data) do
self:addHero(heroInfo.id, heroInfo.level) self:addHero(heroInfo.id, heroInfo.level)
@ -42,6 +46,9 @@ function HeroData:init(data)
if info.unlock_chapter and info.is_show == 1 then if info.unlock_chapter and info.is_show == 1 then
self.heroChapterUnlockMap[info.unlock_chapter] = true self.heroChapterUnlockMap[info.unlock_chapter] = true
end end
if info.unlock_chapter then
self.heroChapterUnlockMapBi[info.unlock_chapter] = true
end
end end
self.showHeroUnlockChapter = 0 self.showHeroUnlockChapter = 0
end end
@ -105,9 +112,11 @@ end
function HeroData:setHeroLv(id, lv) function HeroData:setHeroLv(id, lv)
local entity = self:getHeroById(id) local entity = self:getHeroById(id)
local activeBefore = true
if not entity:isActived() then if not entity:isActived() then
self.data.activeCount = self.data.activeCount + 1 self.data.activeCount = self.data.activeCount + 1
ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.X_NEW_HERO_GOT) ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.X_NEW_HERO_GOT)
activeBefore = false
end end
entity:setLv(lv) entity:setLv(lv)
if entity:isActived() then if entity:isActived() then
@ -117,6 +126,15 @@ function HeroData:setHeroLv(id, lv)
end end
self.matchActiveHeroMap[matchType][entity:getCfgId()] = true self.matchActiveHeroMap[matchType][entity:getCfgId()] = true
end end
if activeBefore then
BIReport:postHeroOpt(id, BIReport.HERO_OPT_TYPE.LEVEL_UP)
else
if not entity:getUnlcokChapter() then
BIReport:postHeroOpt(id, BIReport.HERO_OPT_TYPE.UNLOCK)
end
BIReport:postHeroOpt(id, BIReport.HERO_OPT_TYPE.ACTIVE)
end
end end
function HeroData:getMatchActiveHeroMap() function HeroData:getMatchActiveHeroMap()
@ -159,6 +177,14 @@ function HeroData:markShowHeroUnlock()
end end
function HeroData:checkIfCanShowHeroUnlock(chapterId) function HeroData:checkIfCanShowHeroUnlock(chapterId)
if self.heroChapterUnlockMapBi[chapterId] then -- 日志上报
for id, entity in pairs(self.heroes) do
if not entity:isActived() and entity:getUnlcokChapter() == chapterId then
BIReport:postHeroOpt(id, BIReport.HERO_OPT_TYPE.UNLOCK)
end
end
end
if not self.heroChapterUnlockMap[chapterId] then if not self.heroChapterUnlockMap[chapterId] then
return return
end end