784 lines
21 KiB
Lua
784 lines
21 KiB
Lua
local BIReport = {
|
||
isNewPlayer = false
|
||
}
|
||
|
||
-- 客户端的所有的上报事件都要加"client_"前缀
|
||
local EVENT_NAME_TUTORIAL = "client_tutorial"
|
||
local EVENT_NAME_LUA_CRASH = "client_lua_crash"
|
||
local EVENT_NAME_OPEN_UI = "client_open_ui"
|
||
|
||
-- 所有需要上报的按钮点击事件
|
||
BIReport.CLICK_BTN_TYPE = {
|
||
HOME = "Home",
|
||
HERO = "Hero",
|
||
}
|
||
|
||
BIReport.ADS_OPT_TYPE = {
|
||
CLICK = "Click",
|
||
SUCCESS = "Success",
|
||
REWARD_GET = "RewardGet",
|
||
}
|
||
|
||
BIReport.PAY_OPT_TYPE = {
|
||
POP = "Pop",
|
||
CLICK = "Click",
|
||
BUY = "Buy",
|
||
REWARD = "Reward",
|
||
CANCEL = "Cancel",
|
||
FAILED = "Failed",
|
||
INIT_SUC = "InitSuc",
|
||
INIT_FAILED = "InitFailed",
|
||
}
|
||
|
||
BIReport.ACCOUNT_OPT_TYPE = {
|
||
LOGIN_FINISH = "LoginFinish",
|
||
LOGIN_FAILED = "LoginFailed",
|
||
BIND_CLICK = "BindClick",
|
||
BIND_FINISH = "BindFinish",
|
||
}
|
||
|
||
BIReport.CHAPTER_OPT_TYPE = {
|
||
PASS = "Pass",
|
||
BOX_OPEN = "BoxOpen",
|
||
}
|
||
|
||
BIReport.TASK_TYPE = {
|
||
DAILY = "Daily",
|
||
}
|
||
|
||
BIReport.TASK_OPT_TYPE = {
|
||
FINISH = "Finish",
|
||
REWARD = "Reward",
|
||
}
|
||
|
||
BIReport.ITEM_GET_TYPE = {
|
||
NONE = "None",
|
||
NEW_PLAYER_INITIAL = "NewPlayerInitial", -- 新玩家创号自带
|
||
UPGRADE_HERO = "UpgradeHero",
|
||
CHAPTER_FIGHT_START = "ChapterFightStart",
|
||
CHAPTER_FIGHT_END = "ChapterFightEnd",
|
||
CHAPTER_BOX = "ChapterBox",
|
||
CROSS_DAY = "CrossDay",
|
||
RECOVERY_TIME = "RecoveryTime",
|
||
ADS_BUY_VIT = "AdsBuyVit",
|
||
GEM_BUY_VIT = "GemBuyVit",
|
||
TASK_DAILY_REFRESH = "TaskDailyRefresh",
|
||
TASK_DAILY_REWARD = "TaskDailyReward",
|
||
BOUNTY_UNLOCK_LEVEL = "BountyUnlockLevel",
|
||
BOUNTY_REWARD = "BountyReward",
|
||
BOUNTY = "Bounty",
|
||
IDLE_DROP = "IdleDrop",
|
||
IDLE_QUICK_DROP = "IdleQuickDrop",
|
||
MAIL = "Mail",
|
||
MALL = "Mall",
|
||
MALL_IDLE = "MallIdle", -- 常驻金币挂机礼包
|
||
MALL_TREASURE = "MallTreasure", -- 常驻钻石礼包
|
||
MALL_DAILY = "MallDaily", -- 每日特惠
|
||
MALL_DAILY_RESET = "MallDailyReset",
|
||
FIRST_RECHARGE = "FirstRecharge",
|
||
COIN_GIFT = "CoinGift",
|
||
BEGINNER_GIFT = "BeginnerGift",
|
||
LEVEL_UP_GIFT = "LevelUpGift",
|
||
ACT_CHAPTER_STORE = "ActChapterStore", -- 章节礼包
|
||
SUMMON = "Summon",
|
||
PLAYER_LV_UP = "PlayerLvUp",
|
||
GOLD_PIG = "GoldPig",
|
||
BATTLE_SKILL_REFRESH = "BattleSkillRefresh",
|
||
GROWTH_FUND = "GrowthFund",
|
||
GROW_UP_GIFT = "GrowUpGift", -- 成长礼包
|
||
SEVEN_DAY_TASK = "SevenDayTask",
|
||
SEVEN_DAY_STEP_REWARD = "SevenDayStepReward",
|
||
DAILY_CHALLENGE = "DailyChallenge",
|
||
DAILY_CHALLENGE_END = "DailyChallengeEnd",
|
||
DAILY_CHALLENGE_RESET = "DailyChallengeReset",
|
||
DAILY_CHALLENGE_TASK_REWARD = "DailyChallengeTaskReward",
|
||
}
|
||
|
||
BIReport.ADS_CLICK_TYPE = {
|
||
BATTLE_SKILL_REFRESH = "BattleSkillRefresh",
|
||
AD_ENERGY = "AdEnergy",
|
||
TASK_DAILY_REFRESH = "TaskDailyRefresh",
|
||
TASK_DAILY_TASK = "TaskDailyTask",
|
||
IDLE_QUICK_DROP = "IdleQuickDrop",
|
||
|
||
MALL_DAILY = "MallDaily",
|
||
MALL_DAILY_RESET = "MallDailyReset",
|
||
MALL_GOLD = "MallGold",
|
||
MALL_TREASURE = "MallTreasure",
|
||
MAIL = "Mail",
|
||
}
|
||
|
||
BIReport.FIGHT_OPT_TYPE = {
|
||
START = "Start",
|
||
END = "End",
|
||
SELECT_SKILL_OPEN = "SelectSkillOpen",
|
||
SELECT_SKILL = "SelectSkill",
|
||
}
|
||
|
||
BIReport.FIGHT_DEATH_TYPE = {
|
||
SURVIVE = "Survive",
|
||
ELITE_FAIL = "EliteFail",
|
||
BOSS_FAIL = "BossFail",
|
||
NORMAL_FAIL = "NormalFail",
|
||
}
|
||
|
||
BIReport.FIGHT_WAVE_END_TYPE = {
|
||
WIN = "Win",
|
||
FAIL = "Fail",
|
||
QUIT = "Quit",
|
||
}
|
||
|
||
BIReport.BATTLE_TYPE = {
|
||
["1"] = "Stage",
|
||
}
|
||
|
||
BIReport.GIFT_TYPE = {
|
||
FIRST_RECHARGE = "FirstRecharge",
|
||
COIN_GIFT = "CoinGift",
|
||
BEGINNER_GIFT = "BeginnerGift",
|
||
LEVEL_UP_GIFT = "LevelUpGift",
|
||
BOUNTY = "Bounty",
|
||
GOLD_PIG = "GoldPig",
|
||
MALL_TREASURE = "MallTreasure",
|
||
ACT_CHAPTER_STORE = "ActChapterStore",
|
||
GROWTH_FUND = "GrowthFund",
|
||
GROW_UP_GIFT = "GrowUpGift",
|
||
}
|
||
|
||
BIReport.COIN_TYPE = {
|
||
[1] = "Gold",
|
||
[2] = "Gem",
|
||
}
|
||
|
||
BIReport.MAIL_OPT_TYPE = {
|
||
OPEN = "Open",
|
||
CLAIM = "Claim",
|
||
}
|
||
|
||
-- b6
|
||
local EVENT_NAME_EXIT = "client_exit"
|
||
local EVENT_NAME_FIGHT = "client_fight"
|
||
local EVENT_NAME_CLICK_BTN = "client_click_btn"
|
||
local EVENT_NAME_ITEM_GET = "client_item_get"
|
||
local EVENT_NAME_ITEM_USE = "client_item_use"
|
||
local EVENT_NAME_COIN_GET = "client_coin_get"
|
||
local EVENT_NAME_COIN_USE = "client_coin_use"
|
||
local EVENT_NAME_AD_OPT = "client_ads_opt"
|
||
local EVENT_NAME_PAY_OPT = "client_pay_opt"
|
||
local EVENT_NAME_LOGIN_FINISH = "client_login_finish"
|
||
local EVENT_NAME_LOGIN = "client_login"
|
||
local EVENT_NAME_PING_SERVER = "client_ping_server"
|
||
local EVENT_NAME_ACCOUNT_OPT = "client_account_opt"
|
||
local EVENT_NAME_CHAPTER_OPT = "client_chapter_opt" -- 章节
|
||
local EVENT_NAME_VIT_USE = "client_vit_use"
|
||
local EVENT_NAME_VIT_GET = "client_vit_get"
|
||
local EVENT_NAME_TASK = "client_task"
|
||
local EVENT_NAME_MAIL_OPT = "client_mail_opt"
|
||
|
||
function BIReport:setIsNewPlayer(isNewPlayer)
|
||
self.isNewPlayer = isNewPlayer
|
||
end
|
||
|
||
-- adjust
|
||
function BIReport:postAdjustSimpleTrackEvent(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:PostAdjustSimpleTrackEvent(eventName, json.encode(eventValue))
|
||
end
|
||
|
||
|
||
function BIReport:updateAccountId(id)
|
||
if id == nil then
|
||
return
|
||
end
|
||
self:clearAccountId()
|
||
CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:SetThinkingAnalyticsAccountId(tostring(id))
|
||
end
|
||
|
||
function BIReport:clearAccountId()
|
||
CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:ClearThinkingAnalyticsAccountId()
|
||
end
|
||
|
||
function BIReport:report(name, args)
|
||
self:printArgsStr(name, args)
|
||
-- 内网dev包和编辑器模式不上报
|
||
if Platform and Platform:getIsDevChannel() or EDITOR_MODE then
|
||
return
|
||
end
|
||
|
||
-- 审核模式不上报
|
||
if CS.BF.BFMain.IsShenhe then
|
||
return
|
||
end
|
||
if args and type(args) == "table" then
|
||
if DataManager then
|
||
if DataManager.ChapterData then
|
||
if args.max_level == nil then
|
||
args.max_level = DataManager.ChapterData:getMaxChapterId()
|
||
end
|
||
if args.level_id == nil then
|
||
args.level_id = DataManager.ChapterData:getChapterId()
|
||
end
|
||
if args.max_chapter == nil then
|
||
args.max_chapter = DataManager.ChapterData:getNextChapter(DataManager.ChapterData:getMaxChapterId())
|
||
end
|
||
end
|
||
if DataManager.BagData and DataManager.BagData.ItemData then
|
||
args.gold = DataManager.BagData.ItemData:getItemNumById(GConst.ItemConst.ITEM_ID_GOLD)
|
||
args.gem = DataManager.BagData.ItemData:getItemNumById(GConst.ItemConst.ITEM_ID_GEM)
|
||
end
|
||
end
|
||
args.current_version = CS.BF.BFMain.Instance.GameLaunchMgr:GetCurrentVersion()
|
||
args.is_new_player = self.isNewPlayer
|
||
args.device_unique_identifier = CS.UnityEngine.SystemInfo.deviceUniqueIdentifier
|
||
CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostThinkingAnalyticsEvent(name, json.encode(args))
|
||
else
|
||
CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostThinkingAnalyticsEvent(name)
|
||
end
|
||
end
|
||
|
||
-- 上报引导每一步
|
||
function BIReport:postTutorialStep(id)
|
||
local level = DataManager.PlayerData:getLv()
|
||
local args = {
|
||
client_tutorial_id = id,
|
||
level = level
|
||
}
|
||
self:report(EVENT_NAME_TUTORIAL, args)
|
||
end
|
||
|
||
-- Lua crash
|
||
function BIReport:postLuaCrash(logString, stackTrace)
|
||
local msg = logString .. stackTrace
|
||
if #msg > 2000 then
|
||
msg = string.sub(msg, 1, 2000)
|
||
end
|
||
local args = {
|
||
client_lua_crash_msg = msg,
|
||
}
|
||
self:report(EVENT_NAME_LUA_CRASH, args)
|
||
end
|
||
|
||
-- 上报界面打开
|
||
function BIReport:postOpenUI(uiName, childUI)
|
||
if uiName == nil or uiName == "" then
|
||
return
|
||
end
|
||
local args = {
|
||
client_ui_name = uiName,
|
||
client_ui_child_name = childUI,
|
||
}
|
||
self:report(EVENT_NAME_OPEN_UI, args)
|
||
end
|
||
|
||
-- 上报内购事件,单独处理,只上报到AF和FB,不上报数数
|
||
function BIReport:postPurchase(price, content, originOrderId, orderId)
|
||
-- 只有外网正式渠道真机包才上报
|
||
if not Platform:getIsPublishChannel() or EDITOR_MODE then
|
||
return
|
||
end
|
||
-- 审核模式不上报
|
||
if CS.BF.BFMain.IsShenhe then
|
||
return
|
||
end
|
||
-- 上报AF,AF的所有事件值都是String类型
|
||
local args = {
|
||
af_revenue = tostring(price),
|
||
af_currency = "USD",
|
||
af_quantity = "1",
|
||
af_content_id = content,
|
||
af_order_id = originOrderId,
|
||
af_receipt_id = orderId
|
||
}
|
||
CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_purchase", json.encode(args))
|
||
|
||
-- 上报FB的付费事件
|
||
local fbArgs = {
|
||
order_id = originOrderId,
|
||
product_id = content
|
||
}
|
||
CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogPurchase(price, "USD", json.encode(fbArgs))
|
||
|
||
-- 上报付费到adjust
|
||
CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAdjustRevenueTrackEvent("naoyh8", price, "USD")
|
||
end
|
||
|
||
-- 上报等级提升事件,单独处理,只上报到AF和FB,不上报数数
|
||
function BIReport:postFirstLoginEvent()
|
||
-- 只有外网正式渠道真机包才上报
|
||
if not Platform:getIsPublishChannel() or EDITOR_MODE then
|
||
return
|
||
end
|
||
-- 审核模式不上报
|
||
if CS.BF.BFMain.IsShenhe then
|
||
return
|
||
end
|
||
CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_first_login", json.encode({}))
|
||
CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_first_login", json.encode({}))
|
||
end
|
||
|
||
-- 以下为数数
|
||
function BIReport:printArgsStr(eventName, args)
|
||
if not EDITOR_MODE then
|
||
return
|
||
end
|
||
local tab = clone(args)
|
||
tab.eventName = eventName
|
||
Logger.log("============report %s===========", eventName)
|
||
Logger.printTable(tab or {})
|
||
end
|
||
|
||
-- 开启游戏
|
||
function BIReport:postGameLogin(isFirstLogin)
|
||
local args = {
|
||
first_begin = isFirstLogin,
|
||
-- LogType -- 进入类型,不处理
|
||
}
|
||
self:report(EVENT_NAME_LOGIN, args)
|
||
end
|
||
|
||
-- 登录完成
|
||
function BIReport:postGameLoginFinish()
|
||
-- FirstBegin 是否是首次登陆
|
||
-- DailyFirstBegin 是否当日首次登录
|
||
-- LogType 进入类型
|
||
-- PushID 推送id
|
||
-- MaxLevel 已解锁最大关卡
|
||
-- Duration 登录加载时长
|
||
-- MyEquip 拥有装备
|
||
-- MyCherish 拥有传家宝
|
||
-- MyRunes 拥有符文
|
||
-- MaxTrial 副本进度
|
||
-- IsNew 是否是新用户
|
||
local args = {
|
||
-- is_daily_first = DataManager:getIsTodayFirstLogin(),
|
||
-- is_first = DataManager:getIsFirstLogin(),
|
||
}
|
||
self:report(EVENT_NAME_LOGIN_FINISH, args)
|
||
end
|
||
|
||
-- 游戏退出
|
||
function BIReport:postGameExit()
|
||
local args = {}
|
||
self:report(EVENT_NAME_EXIT, args)
|
||
end
|
||
|
||
-- 进入战斗
|
||
function BIReport:postFightBegin(battleType, wave, chapterId, maxChapter, startTimes)
|
||
-- wave -- 波次
|
||
-- chapterId 进入关卡编号
|
||
-- maxChapter 已解锁最大关卡
|
||
-- startTimes 累计进入次数
|
||
|
||
local args = {
|
||
battle_type = BIReport.BATTLE_TYPE[battleType],
|
||
event_type = BIReport.FIGHT_OPT_TYPE.START,
|
||
wave_id = wave,
|
||
chapter_id = chapterId,
|
||
max_chapter = maxChapter,
|
||
start_times = startTimes,
|
||
}
|
||
self:report(EVENT_NAME_FIGHT, args)
|
||
end
|
||
|
||
function BIReport:postFightEnd(battleType, chapterId, wave, duration, totalTime, eliminateCount, chapterEliminateCount, type, deathType, startTimes, isFirstWin, isFianlStep)
|
||
-- wave 进入关卡编号
|
||
-- LevelType 进入关卡类型
|
||
-- MaxLevel 已解锁最大关卡
|
||
-- StartTimes 累计进入次数
|
||
-- IsNew 是否是新用户
|
||
|
||
local skillStr = GConst.EMPTY_STRING
|
||
local skillNum = 0
|
||
local skillMap = DataManager.BattleData:getSelectSkillMap()
|
||
if skillMap then
|
||
for skillId, info in pairs(skillMap) do
|
||
skillStr = skillStr .. skillId .. "|"
|
||
skillNum = skillNum + (info.count or 0)
|
||
end
|
||
end
|
||
|
||
local args = {
|
||
battle_type = BIReport.BATTLE_TYPE[battleType],
|
||
event_type = BIReport.FIGHT_OPT_TYPE.END,
|
||
wave_id = wave,
|
||
chapter_id = chapterId,
|
||
duration = duration,
|
||
chapter_duration = totalTime,
|
||
eliminate = eliminateCount,
|
||
chapter_eleminate = chapterEliminateCount,
|
||
skill = skillStr,
|
||
skill_num = skillNum,
|
||
type = type, -- "Win Fail Quit",
|
||
death_type = deathType,
|
||
start_times = startTimes,
|
||
is_first_win = isFirstWin,
|
||
isFianlStep = isFianlStep,
|
||
}
|
||
self:report(EVENT_NAME_FIGHT, args)
|
||
end
|
||
|
||
function BIReport:postShowFightSkillSelect(battleType, skillList, chapterId, totalTime, wave)
|
||
local skillNum = 0
|
||
local skillMap = DataManager.BattleData:getSelectSkillMap()
|
||
if skillMap then
|
||
for skillId, info in pairs(skillMap) do
|
||
skillNum = skillNum + (info.count or 0)
|
||
end
|
||
end
|
||
|
||
local skillStr = GConst.EMPTY_STRING
|
||
if skillList then
|
||
for _, skillId in ipairs(skillList) do
|
||
skillStr = skillStr .. skillId .. "|"
|
||
end
|
||
end
|
||
|
||
local args = {
|
||
battle_type = BIReport.BATTLE_TYPE[battleType],
|
||
event_type = BIReport.FIGHT_OPT_TYPE.SELECT_SKILL_OPEN,
|
||
wave_id = wave,
|
||
chapter_id = chapterId,
|
||
chapter_duration = totalTime,
|
||
skill = skillStr,
|
||
skill_num = skillNum,
|
||
}
|
||
self:report(EVENT_NAME_FIGHT, args)
|
||
end
|
||
|
||
function BIReport:postFightSkillSelect(battleType, skillList, chapterId, totalTime, wave)
|
||
local skillNum = 0
|
||
local skillMap = DataManager.BattleData:getSelectSkillMap()
|
||
if skillMap then
|
||
for skillId, info in pairs(skillMap) do
|
||
skillNum = skillNum + (info.count or 0)
|
||
end
|
||
end
|
||
|
||
local skillStr = GConst.EMPTY_STRING
|
||
if skillList then
|
||
for _, skillId in ipairs(skillList) do
|
||
skillStr = skillStr .. skillId .. "|"
|
||
end
|
||
end
|
||
|
||
local args = {
|
||
battle_type = BIReport.BATTLE_TYPE[battleType],
|
||
event_type = BIReport.FIGHT_OPT_TYPE.SELECT_SKILL,
|
||
wave_id = wave,
|
||
chapter_id = chapterId,
|
||
chapter_duration = totalTime,
|
||
skill = skillStr,
|
||
skill_num = skillNum,
|
||
}
|
||
self:report(EVENT_NAME_FIGHT, args)
|
||
end
|
||
|
||
-- 首页按钮点击
|
||
function BIReport:postHomeBtnCilck(clickType)
|
||
local args = {
|
||
event_type = clickType,
|
||
type = BIReport.CLICK_BTN_TYPE[clickType],
|
||
chapter_id = DataManager.ChapterData:getChapterId()
|
||
}
|
||
self:report(EVENT_NAME_CLICK_BTN, args)
|
||
end
|
||
|
||
function BIReport:postChapterOpenBox(chapterId, wave, rewards)
|
||
local rewardStr = GFunc.getRewardsStr(rewards)
|
||
local args = {
|
||
box_level = wave,
|
||
rewards = rewardStr,
|
||
chapter_id = chapterId,
|
||
type = BIReport.CHAPTER_OPT_TYPE.BOX_OPEN
|
||
}
|
||
self:report(EVENT_NAME_CHAPTER_OPT, args)
|
||
end
|
||
|
||
-- 道具获取
|
||
function BIReport:postItemGet(num, itemId, getType)
|
||
-- Item 道具id
|
||
-- Type 获得方式
|
||
-- MaxLevel 最大关卡
|
||
-- ItemNum 获取道具数量
|
||
-- ItemAll 获取后道具数量
|
||
-- IsNew 是否是新用户
|
||
local allNum = DataManager.BagData.ItemData:getItemNumById(itemId)
|
||
local args = {
|
||
item_value = num,
|
||
item_id = itemId,
|
||
item_all_value = allNum,
|
||
type = getType,
|
||
}
|
||
self:report(EVENT_NAME_ITEM_GET, args)
|
||
end
|
||
|
||
-- 道具使用
|
||
function BIReport:postItemUse(num, itemId, getType)
|
||
-- Item 道具id
|
||
-- Type 消耗方式
|
||
-- MaxLevel 最大关卡
|
||
-- ItemNum 消耗道具数量
|
||
-- ItemAll 消耗后道具数量
|
||
-- IsNew 是否是新用户
|
||
local allNum = DataManager.BagData.ItemData:getItemNumById(itemId)
|
||
local args = {
|
||
item_value = num,
|
||
item_id = itemId,
|
||
item_all_value = allNum,
|
||
type = getType,
|
||
}
|
||
self:report(EVENT_NAME_ITEM_USE, args)
|
||
end
|
||
|
||
-- 体力获得
|
||
function BIReport:postVitGet(num, getType, vitAll)
|
||
-- Type 获得类型 获得体力时 String Ads=广告、Gold=金币 、Time=时间恢复 、Stores=商品恢复
|
||
-- IsNew 是否是新用户 Boolean 是否为当天新用户,True = 是,False = 否
|
||
-- EnergyNum 当前体力数 Int 获得体力数量
|
||
-- MaxChapter 最大章节 Int 已解锁的最大章节
|
||
local args = {
|
||
type = getType,
|
||
vit_num = num,
|
||
vit_all = vitAll or DataManager.BagData.ItemData:getItemNumById(GConst.ItemConst.ITEM_ID_VIT),
|
||
}
|
||
self:report(EVENT_NAME_VIT_GET, args)
|
||
end
|
||
|
||
-- 体力使用
|
||
function BIReport:postVitUse(num)
|
||
-- EnergyNum 当前体力数 减少体力时 Int 使用体力数量
|
||
-- IsNew 是否是新用户 Boolean 是否为当天新用户,True = 是,False = 否
|
||
-- MaxChapter 最大章节 Int 已解锁的最大章节
|
||
local args = {
|
||
vit_num = num,
|
||
vit_all = DataManager.BagData.ItemData:getItemNumById(GConst.ItemConst.ITEM_ID_VIT),
|
||
}
|
||
self:report(EVENT_NAME_VIT_USE, args)
|
||
end
|
||
|
||
-- 点击广告按钮
|
||
function BIReport:postAdClick(adsType)
|
||
local args = {
|
||
ad_type = adsType,
|
||
event_type = BIReport.ADS_OPT_TYPE.CLICK,
|
||
}
|
||
self:report(EVENT_NAME_AD_OPT, args)
|
||
end
|
||
|
||
-- 广告播放视频成功
|
||
function BIReport:postAdPlaySuccess(adsType)
|
||
local args = {
|
||
ad_type = adsType,
|
||
event_type = BIReport.ADS_OPT_TYPE.SUCCESS,
|
||
}
|
||
self:report(EVENT_NAME_AD_OPT, args)
|
||
end
|
||
|
||
-- 广告奖励发放成功
|
||
function BIReport:postAdRewardGet(adsType)
|
||
local args = {
|
||
ad_type = adsType,
|
||
event_type = BIReport.ADS_OPT_TYPE.REWARD_GET,
|
||
}
|
||
self:report(EVENT_NAME_AD_OPT, args)
|
||
end
|
||
|
||
-- 支付sdk初始化成功
|
||
function BIReport:postPayInitSuccess()
|
||
local args = {
|
||
event_type = BIReport.PAY_OPT_TYPE.INIT_SUC,
|
||
}
|
||
self:report(EVENT_NAME_PAY_OPT, args)
|
||
end
|
||
|
||
-- 支付sdk初始化失败
|
||
function BIReport:postPayInitFailed(failedDesc)
|
||
local args = {
|
||
failed_desc = failedDesc or GConst.EMPTY_STRING,
|
||
event_type = BIReport.PAY_OPT_TYPE.INIT_FAILED,
|
||
}
|
||
self:report(EVENT_NAME_PAY_OPT, args)
|
||
end
|
||
|
||
-- 点击商品购买按钮
|
||
function BIReport:postPayClick(giftType, id, rechargeId)
|
||
local args = {
|
||
gift_type = giftType,
|
||
commodity_id = id,
|
||
recharge_id = rechargeId,
|
||
event_type = BIReport.PAY_OPT_TYPE.CLICK,
|
||
}
|
||
self:report(EVENT_NAME_PAY_OPT, args)
|
||
end
|
||
|
||
-- 跳转购买界面
|
||
function BIReport:postPayTurn(giftType, id, rechargeId)
|
||
local args = {
|
||
gift_type = giftType,
|
||
commodity_id = id,
|
||
recharge_id = rechargeId,
|
||
event_type = BIReport.PAY_OPT_TYPE.BUY,
|
||
}
|
||
self:report(EVENT_NAME_PAY_OPT, args)
|
||
end
|
||
|
||
-- 取消购买
|
||
function BIReport:postPayCancel(productId, orderId, rechargeId, giftType)
|
||
local args = {
|
||
pay_product_id = productId,
|
||
pay_order_id = orderId,
|
||
recharge_id = rechargeId,
|
||
gift_type = giftType,
|
||
event_type = BIReport.PAY_OPT_TYPE.CANCEL,
|
||
}
|
||
self:report(EVENT_NAME_PAY_OPT, args)
|
||
end
|
||
|
||
-- 购买失败
|
||
function BIReport:postPayFailed(productId, orderId, rechargeId, failedType, giftType)
|
||
local args = {
|
||
pay_product_id = productId,
|
||
pay_order_id = orderId,
|
||
recharge_id = rechargeId,
|
||
pay_failed_type = failedType,
|
||
gift_type = giftType,
|
||
event_type = BIReport.PAY_OPT_TYPE.FAILED,
|
||
}
|
||
self:report(EVENT_NAME_PAY_OPT, args)
|
||
end
|
||
|
||
-- -- 获得购买物品
|
||
function BIReport:postPayGet(giftType, id, rechargeId, orderId, originOrderId, buyNum, rewards)
|
||
-- local itemStr = GFunc.getRewardsStr(rewards)
|
||
local args = {
|
||
gift_type = giftType,
|
||
commodity_id = id,
|
||
-- commodity_state = payDouble,
|
||
-- commodity_item = itemStr,
|
||
buy_num = buyNum,
|
||
origin_order_id_new = tostring(originOrderId),
|
||
recharge_id = rechargeId,
|
||
event_type = BIReport.PAY_OPT_TYPE.REWARD,
|
||
}
|
||
self:report(EVENT_NAME_PAY_OPT, args)
|
||
|
||
if EDITOR_MODE then
|
||
if not giftType or not id or not rechargeId then
|
||
local params = {
|
||
content = "BI Report postPayGet has no basic params",
|
||
boxType = GConst.MESSAGE_BOX_TYPE.MB_OK,
|
||
okText = I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK),
|
||
}
|
||
GFunc.showMessageBox(params)
|
||
Logger.log("BI Report postPayGet has no basic params")
|
||
end
|
||
end
|
||
end
|
||
|
||
|
||
-- 登录成功
|
||
function BIReport:postAccountLoginFinish(loginType)
|
||
local args = {
|
||
login_type = loginType,
|
||
event_type = BIReport.ACCOUNT_OPT_TYPE.LOGIN_FINISH,
|
||
}
|
||
self:report(EVENT_NAME_ACCOUNT_OPT, args)
|
||
end
|
||
|
||
-- 登录失败
|
||
function BIReport:postAccountLoginFailed(loginType, reason)
|
||
local args = {
|
||
login_type = loginType,
|
||
login_reason = reason,
|
||
event_type = BIReport.ACCOUNT_OPT_TYPE.LOGIN_FAILED,
|
||
}
|
||
self:report(EVENT_NAME_ACCOUNT_OPT, args)
|
||
end
|
||
|
||
|
||
-- 上报ping服务器地址情况
|
||
function BIReport:postPingServer(address, time, resultType)
|
||
local args = {
|
||
address = address,
|
||
time = time,
|
||
type = resultType
|
||
}
|
||
self:report(EVENT_NAME_PING_SERVER, args)
|
||
end
|
||
|
||
-- 钻石增加
|
||
function BIReport:postGemGet(num, getType, itemId)
|
||
-- CoinNum 代币数量 增加代币时 Int 获得代币数量
|
||
-- Type 获得类型 String 广告=Ads、商店宝箱=Box、关卡宝箱=LevelBox、关卡奖励=LevelReward、
|
||
-- CoinsType 代币类型 String Gold=金币、Gems=钻石
|
||
-- IsNew 是否是新用户 Boolean 是否为当天新用户,True = 是,False = 否
|
||
-- MaxChapter 最大章节 Int 已解锁的最大章节
|
||
local args = {
|
||
type = getType,
|
||
coin_num = num,
|
||
coin_type = BIReport.COIN_TYPE[itemId],
|
||
coin_all = DataManager.BagData.ItemData:getItemNumById(itemId),
|
||
}
|
||
self:report(EVENT_NAME_COIN_GET, args)
|
||
end
|
||
|
||
-- 钻石使用
|
||
function BIReport:postGemUse(num, getType, itemId)
|
||
-- CoinNum 代币数量 减少代币时 Int 使用代币数量
|
||
-- Type 使用类型 String Box=开启宝箱、复活=Revive、天赋升级=Talent、Equip=装备升级
|
||
-- CoinsType 代币类型 String Gold=金币、Gems=钻石
|
||
-- IsNew 是否是新用户 Boolean 是否为当天新用户,True = 是,False = 否
|
||
-- MaxChapter 最大章节 Int 已解锁的最大章节
|
||
local args = {
|
||
type = getType,
|
||
coin_num = num,
|
||
coin_type = BIReport.COIN_TYPE[itemId],
|
||
coin_all = DataManager.BagData.ItemData:getItemNumById(itemId),
|
||
}
|
||
self:report(EVENT_NAME_COIN_USE, args)
|
||
end
|
||
|
||
function BIReport:postDailyTaskFinish(taskType, cfgId, taskId, refresh)
|
||
local args = {
|
||
task_type = taskType,
|
||
task_id = taskId,
|
||
cfg_id = cfgId,
|
||
task_refresh = refresh,
|
||
event_type = BIReport.TASK_OPT_TYPE.FINISH,
|
||
}
|
||
self:report(EVENT_NAME_TASK, args)
|
||
end
|
||
|
||
-- 邮箱
|
||
function BIReport:postMailOpen(mailId)
|
||
-- IsNew 是否是新用户
|
||
-- MaxLevel 最大关卡
|
||
-- Email_ID 邮件编号
|
||
|
||
local args = {
|
||
mail_id = mailId,
|
||
event_type = BIReport.MAIL_OPT_TYPE.OPEN,
|
||
}
|
||
self:report(EVENT_NAME_MAIL_OPT, args)
|
||
BIReport:printArgsStr(EVENT_NAME_MAIL_OPT, args)
|
||
end
|
||
|
||
function BIReport:postMailClaim(mailId)
|
||
-- IsNew 是否是新用户
|
||
-- MaxLevel 最大关卡
|
||
-- Email_ID 邮件编号
|
||
|
||
local args = {
|
||
mail_id = mailId,
|
||
event_type = BIReport.MAIL_OPT_TYPE.CLAIM,
|
||
}
|
||
self:report(EVENT_NAME_MAIL_OPT, args)
|
||
BIReport:printArgsStr(EVENT_NAME_MAIL_OPT, args)
|
||
end
|
||
|
||
return BIReport |