c1_lua/lua/app/common/bi_report.lua
2023-04-24 21:20:55 +08:00

1342 lines
37 KiB
Lua
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

local BIReport = {}
-- 客户端的所有的上报事件都要加"client_"前缀
local EVENT_NAME_TUTORIAL = "client_tutorial"
local EVENT_NAME_LUA_CRASH = "client_lua_crash"
local EVENT_NAME_OPEN_UI = "client_open_ui"
-- BIReport.FIREBASE_UI_TYPE = {
-- SHOP = "Shop",
-- BUY_VIT = "BuyVit",
-- QUICK_HANG_UP = "QuickHangUp",
-- SUPER_TURNTABLE = "SuperTurntable",
-- DAILY_GIFT = "DailyGift",
-- NEW_WISH_GIFT = "NewWishGift",
-- NEW_PLAYER_GIFT = "NewPlayerGift",
-- BALLTE_JEWELRY_SELECT_BUFF = "BallteJewelrySelectBuff",
-- BALLTE_RESURRECTION = "BallteResurrection",
-- BALLTE_SELECT_BUFF = "BallteSelectBuff",
-- }
-- BIReport.FIGHT_END_TYPE = {
-- WIN = "Win",
-- FAIL = "Fail",
-- QUIT = "Quit",
-- }
-- BIReport.FIGHT_DEATH_TYPE = {
-- SURVIVE = "Survive",
-- ELITE_FAIL = "EliteFail",
-- BOSS_FAIL = "BossFail",
-- NORMAL_FAIL = "NormalFail",
-- }
-- BIReport.SKILL_REFRESH_TYPE = {
-- FREE = "Free",
-- ADS = "Ads",
-- GEM = "Gem",
-- }
-- 所有需要上报的按钮点击事件
BIReport.CLICK_BTN_TYPE = {
EQUIP = "Equip",
DUNGEON = "Dungeon",
TRAIN = "Train",
MALL = "Mall",
SHOP = "Shop",
}
BIReport.ADS_OPT_TYPE = {
CLICK = "Click",
SUC = "Scu",
RETURN = "Return",
}
BIReport.PAY_OPT_TYPE = {
POP = "Pop",
CLICK = "Click",
BUY = "Buy",
REWARD = "Reward",
CANCEL = "Cancel",
FAILED = "Failed",
INIT_SUC = "InitSuc",
INIT_FAILED = "InitFailed",
}
BIReport.EQUIP_OPT_TYPE = {
EQUIP_GET = "EquipGet",
EQUIP_LV_UP = "EquipLvUp",
EQUIP_WEAR = "EquipWear",
LEGACY_GET = "LegacyGet",
LEGACY_LV_UP = "LegacyLvUp",
LEGACY_WEAR = "LegacyWear",
LEGACY_REMOVE = "LegacyRemove",
}
BIReport.BATTLE_PASS_OPT_TYPE = {
OPEN = "Open",
TASK_CLAIM = "TaskClaim",
REWARD_CLAIM = "RewardClaim",
EXP_GET = "ExpGet",
}
BIReport.ACCOUNT_OPT_TYPE = {
LOGIN_CLICK = "LoginClick",
LOGIN_FINISH = "LoginFinish",
LOGIN_FAILED = "LoginFailed",
BIND_CLICK = "BindClick",
BIND_FINISH = "BindFinish",
}
BIReport.TASK_OPT_TYPE = {
FINISH = "Finish",
REWARD = "Reward",
}
BIReport.MAIL_OPT_TYPE = {
OPEN = "Open",
CLAIM = "Claim",
}
BIReport.TRAIN_OPT_TYPE = {
TRAIN = "Train",
REBORN = "Reborn",
QUICK_PASS = "QuickPass",
QUICK_PASS_UP = "QuickPassUp",
}
BIReport.CHAPTER_OPT_TYPE = {
PASS = "Pass",
}
BIReport.RUNE_OPT_TYPE = {
GET = "Get",
LV_UP = "LvUp",
WEAR = "Wear",
}
BIReport.ITEM_GET_TYPE = {
NEW_PLAYER_INITIAL = "NewPlayerInitial", -- 新玩家创号自带
UPGRADE_HERO = "UpgradeHero",
CHAPTER_FIGHT_START = "ChapterFightStart",
CHAPTER_FIGHT_END = "ChapterFightEnd",
CHAPTER_BOX = "ChapterBox",
CROSS_DAY = "CrossDay",
RECOVERY_TIME = "RecoveryTime",
}
BIReport.ADS_CLICK_TYPE = {
BATTLE_SKILL_REFRESH = "BattleSkillRefresh"
}
-- BIReport.OPEN_STORE_TYPE = {
-- ICON = "Icon",
-- NO_GOLD = "NoGold",
-- FIRST_PAY = "FirstPay",
-- }
BIReport.FIGHT_TYPE = {
START = "Start",
END = "End",
}
BIReport.BATTLE_TYPE = {
["1"] = "Stage",
["2"] = "DungeonGold",
["3"] = "DungeonGem",
["4"] = "DungeonMithril",
["5"] = "DungeonArena",
}
BIReport.GIFT_TYPE = {
MALL_POP_GIFT = "MallPopGift",
MALL_SKIP_AD_GIFT = "MallSkipAdGift",
MALL_SUBSCRIBE_BLESSING_GIFT = "MallSubscribeBlessingGift",
MALL_MONTH_CARD = "MallMonthCard",
MALL_LIMIT_GIFT = "MallLimitGift",
MALL_FIRST_RECHARGE_GIFT = "MallFirstRechargeGift",
MALL_CHAPTER_FUND = "MallChapterFund",
MALL_BATTLE_PASS = "MallBattlePass",
MALL_TREASURE = "MallTreasure",
DAILY_GIFT = "DailyGift",
WEEKLY_GIFT = "WeeklyGift",
}
BIReport.COIN_TYPE = {
[1] = "Gold",
[2] = "Gem",
}
-- BIReport.MONTHLY_CARD_TYPE = {
-- NONE = "None", -- 无月卡
-- SMALL = "OnlySmall", -- 小月卡
-- BIG = "OnlyBig", -- 大月卡
-- BOTH = "Both", -- 大小月卡
-- NO_TIME = "NoTime", -- 没登录无月卡数据
-- }
-- 割草
local EVENT_NAME_EXIT = "exit"
local EVENT_NAME_FIGHT = "fight"
local EVENT_NAME_CLICK_BTN = "click_btn"
local EVENT_NAME_ITEM_GET = "item_get"
local EVENT_NAME_ITEM_USE = "item_use"
local EVENT_NAME_COIN_GET = "coin_get"
local EVENT_NAME_COIN_USE = "coin_use"
local EVENT_NAME_AD_OPT = "ads_opt"
local EVENT_NAME_PAY_OPT = "pay_opt"
local EVENT_NAME_EQUIP_OPT = "equip_opt"
local EVENT_NAME_LOGIN_FINISH = "login_finish"
local EVENT_NAME_LOGIN = "login"
local EVENT_NAME_BATTLE_PASS_OPT = "battle_pass_opt"
local EVENT_NAME_PING_SERVER = "ping_server"
local EVENT_NAME_ACCOUNT_OPT = "account_opt"
local EVENT_NAME_SUMMON = "summon"
local EVENT_NAME_TASK_OPT = "task_opt"
local EVENT_NAME_MAIL_OPT = "mail_opt"
local EVENT_NAME_TRAIN_OPT = "train_opt"
local EVENT_NAME_CHAPTER_OPT = "chapter_opt" -- 章节
local EVENT_NAME_RUNE_OPT = "rune_opt" -- 符文
-- 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
-- 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
-- if CS.UnityEngine.Application.platform == CS.UnityEngine.RuntimePlatform.Android then
-- CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostFireBaseEvent(eventName, json.encode(eventValue))
-- end
-- 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)
-- -- 内网dev包和编辑器模式不上报
-- if Platform and Platform:getIsDevChannel() or EDITOR_MODE then
-- return
-- end
-- -- 审核模式不上报
-- if CS.BF.BFMain.IsShenhe then
-- return
-- end
-- --@TODO 2023-02-22 17:15:51 开发期间不上报
-- if args and type(args) == "table" then
-- -- Level_ID 关卡ID Int 事件发生时所处关卡ID
-- -- MaxLevel 最大关卡 Int 事件发生时已解锁的最大关卡
-- -- IsNew 是否是新用户 Boolean 事件发生时用户是否为新用户
-- -- gold 金币数 Int 事件发生后剩余金币数
-- -- gem 钻石数 Int 事件发生后剩余钻石数
-- -- Energy 体力数 Int 事件发生后剩余体力数
-- -- ResourceVersion 热更资源版本 String 事件发生时资源更新版本
-- -- WearEquip 当前装备 String 装备id:等级|装备id:等级|装备id:等级|装备id:等级|装备id:等级(按武器盔甲头盔的顺序)
-- -- WearCherish 当前传家宝 String 传家宝id:等级|传家宝id:等级|传家宝id:等级|传家宝id:等级|传家宝id:等级
-- -- WearRunes 当前符文 String 符文id:等级|符文id:等级|符文id:等级|符文id:等级|符文id:等级
-- -- UserGrade 用户等级 int 事件发生后用户等级
-- -- Skill 当前精通能力 int 精通能力强化次数
-- if DataManager and DataManager:getIsInitWithServer() then
-- if DataManager.ChapterData then
-- if not args.max_level then
-- args.max_level = DataManager.ChapterData:getHistoryChapterId() + 1
-- end
-- if not args.level_id then
-- args.level_id = DataManager.ChapterData:getCurChapterId() + 1
-- end
-- end
-- if DataManager.BagData and DataManager.BagData.ItemData then
-- local goldBigBNum = DataManager.BagData.ItemData:getItemBigNumById(GConst.ItemConst.ITEM_ID_GOLD)
-- args.gold_value = goldBigBNum.value
-- args.gold_unit = goldBigBNum.unit
-- args.gem = DataManager.BagData.ItemData:getItemById(GConst.ItemConst.ITEM_ID_GEM)
-- end
-- end
-- args.current_version = CS.BF.BFMain.Instance.GameLaunchMgr:GetCurrentVersion()
-- -- args.is_today_first = LocalData:getTodayFirst()
-- 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
-- 首页按钮点击
function BIReport:postHomeBtnCilck(clickType)
-- -- Type 点击位置 点击首页按钮时 String "Shop=商店、Equip=装备界面、Home=首页、Level=关卡按钮、ChangeLevel=切换关卡、
-- -- Talent=天赋界面、LevelBox=关卡宝箱"
-- -- IsNew 是否是新用户 Boolean 是否为当天新用户True = 是False = 否
-- -- MaxChapter 最大章节 Int 已解锁的最大章节
-- -- Chapter 章节id Int 当前停留的章节id
-- local chapterId = DataManager.StageData:getChapterId()
-- local args = {
-- type = clickType, -- 宝箱类型
-- chapter = chapterId, -- 章节
-- max_chapter = DataManager.StageData:getNewChapterId(),
-- }
-- self:report(EVENT_NAME_CLICK_HOME_BTN, args)
-- BIReport:printArgsStr(EVENT_NAME_CLICK_HOME_BTN, 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)
BIReport:printArgsStr(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("qm803c", 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
-- 上报等级提升事件,单独处理,只上报到AF和FB,不上报数数
-- function BIReport:postLvEvent(lv)
-- -- 只有外网正式渠道真机包才上报
-- if not Platform:getIsPublishChannel() or EDITOR_MODE then
-- return
-- end
-- -- 审核模式不上报
-- if CS.BF.BFMain.IsShenhe then
-- return
-- end
-- if not lv then
-- return
-- end
-- local 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,
-- [90] = true,
-- [100] = true,
-- }
-- -- CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_Grade", json.encode({}))
-- -- CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_Grade", json.encode({}))
-- -- if not postLV[lv] then
-- -- return
-- -- end
-- -- local args = {}
-- -- CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_Grade_" .. lv, json.encode(args))
-- -- CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_Grade_" .. lv, json.encode(args))
-- end
-- 上报广告播放提升事件,单独处理,只上报到AF和FB,不上报数数
-- function BIReport:postAdEvent()
-- -- 只有外网正式渠道真机包才上报
-- if not Platform:getIsPublishChannel() or EDITOR_MODE then
-- return
-- end
-- -- 审核模式不上报
-- if CS.BF.BFMain.IsShenhe 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({}))
-- -- local postAdCount = {
-- -- [1] = true,
-- -- [2] = true,
-- -- [3] = true,
-- -- [5] = true,
-- -- [10] = true,
-- -- [15] = true,
-- -- [20] = true,
-- -- [30] = true,
-- -- [40] = true,
-- -- [50] = true,
-- -- [60] = true,
-- -- }
-- -- if not postAdCount[adCount] then
-- -- return
-- -- end
-- -- local args = {}
-- -- CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_AdRewardAD_" .. adCount, json.encode(args))
-- -- CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_AdRewardAD_" .. adCount, json.encode(args))
-- end
-- 上报部分档位首次付费
-- function BIReport:postFirstRechargeEvent(id)
-- -- 只有外网正式渠道真机包才上报
-- if not Platform:getIsPublishChannel() or EDITOR_MODE then
-- return
-- end
-- -- 审核模式不上报
-- if CS.BF.BFMain.IsShenhe then
-- return
-- end
-- local postRechargeID = {
-- [1] = false, -- 0.99
-- [2] = false, -- 1.99
-- [3] = false, -- 2.99
-- [4] = true, -- 4.99
-- [5] = true, -- 9.99
-- [6] = false, -- 14.99
-- [7] = true, -- 19.99
-- [8] = false, -- 24.99
-- [9] = true, -- 29.99
-- [10] = true, -- 49.99
-- [11] = false, -- 69.99
-- [12] = false, -- 99.99
-- }
-- if not 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))
-- end
-- 上报进入章节事件,单独处理,只上报到AF和FB,不上报数数
-- function BIReport:postChapterEvent(chapter)
-- -- 只有外网正式渠道真机包才上报
-- if not Platform:getIsPublishChannel() or EDITOR_MODE then
-- return
-- end
-- -- 审核模式不上报
-- if CS.BF.BFMain.IsShenhe then
-- return
-- end
-- if not chapter then
-- return
-- end
-- -- CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_Chapter", json.encode({}))
-- -- CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_Chapter", json.encode({}))
-- -- local args = {}
-- -- CS.BF.BFMain.Instance.SDKMgr.BFThirdReportSDKMgr:PostAppsflyerEvent("af_Chapter_" .. chapter, json.encode(args))
-- -- CS.BF.BFMain.Instance.SDKMgr.BFLoginSDKMgr.FBSdk:LogAppEvent("fb_Chapter_" .. chapter, json.encode(args))
-- end
-- 以下为数数
function BIReport:printArgsStr(eventName, args)
if EDITOR_MODE then
local tab = clone(args)
tab.eventName = eventName
Logger.log("============report %s===========", eventName)
Logger.printTable(tab or {})
end
end
-- 开启游戏
-- function BIReport:postGameLogin(isFirstLogin)
-- local args = {
-- first_begin = isFirstLogin,
-- }
-- self:report(EVENT_NAME_LOGIN, args)
-- BIReport:printArgsStr(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(),
}
local equips = DataManager.BagData.EquipData:getAllEquips()
for k,v in pairs(equips) do
if not args.my_equip then
args.my_equip = v:getId() .. ":" .. v:getLv() .. ":" .. v:getCount()
else
args.my_equip = args.my_equip .. "|" .. v:getId() .. ":" .. v:getLv() .. ":" .. v:getCount()
end
end
args.my_equip = args.my_equip or ""
for i = 1, 4 do
local info = DataManager.DungeonData:getPassedMaxLevel(i)
if info then
if not args.my_dungeon then
args.my_dungeon = i .. ":" .. info
else
args.my_dungeon = args.my_dungeon .. "|" .. i .. ":" .. info
end
end
end
args.my_dungeon = args.my_dungeon or ""
local info = DataManager.ArenaData:getSegment() or 0
if not args.my_dungeon then
args.my_dungeon = "5:" .. info
else
args.my_dungeon = args.my_dungeon .. "|5:" .. info
end
self:report(EVENT_NAME_LOGIN_FINISH, args)
BIReport:printArgsStr(EVENT_NAME_LOGIN_FINISH, args)
end
-- 游戏退出
function BIReport:postGameExit()
local nowTime = Time:getServerTime()
local args = {}
-- if DataManager then
-- args.duration = nowTime - DataManager:getLoginTime()
-- end
self:report(EVENT_NAME_EXIT, args)
BIReport:printArgsStr(EVENT_NAME_EXIT, args)
end
-- 进入战斗
function BIReport:postFightBegin(battleType, currLevelId, maxLevelId)
-- Level_ID 进入关卡编号
-- LevelType 进入关卡类型
-- MaxLevel 已解锁最大关卡
-- StartTimes 累计进入次数
-- IsNew 是否是新用户
local args = {
-- level_id = currLevelId + 1,
-- max_level = maxLevelId + 1,
battle_type = BIReport.BATTLE_TYPE[battleType],
event_type = BIReport.FIGHT_TYPE.START,
}
self:report(EVENT_NAME_FIGHT, args)
BIReport:printArgsStr(EVENT_NAME_FIGHT, args)
end
function BIReport:postFightEnd(battleType, currLevelId, maxLevelId, passType)
-- Level_ID 进入关卡编号
-- LevelType 进入关卡类型
-- MaxLevel 已解锁最大关卡
-- StartTimes 累计进入次数
-- IsNew 是否是新用户
local args = {
level_id = currLevelId,
-- max_level = maxLevelId + 1,
pass_type = passType,
battle_type = BIReport.BATTLE_TYPE[battleType],
event_type = BIReport.FIGHT_TYPE.END,
}
self:report(EVENT_NAME_FIGHT, args)
BIReport:printArgsStr(EVENT_NAME_FIGHT, args)
end
function BIReport:postDungeonFightBegin(battleType, currLevelId, maxLevelId)
-- Level_ID 进入关卡编号
-- LevelType 进入关卡类型
-- MaxLevel 已解锁最大关卡
-- StartTimes 累计进入次数
-- IsNew 是否是新用户
local args = {
level_id = currLevelId,
max_dungeon_level = maxLevelId,
battle_type = BIReport.BATTLE_TYPE[battleType],
event_type = BIReport.FIGHT_TYPE.START,
}
self:report(EVENT_NAME_FIGHT, args)
BIReport:printArgsStr(EVENT_NAME_FIGHT, args)
end
function BIReport:postDungeonFightEnd(battleType, currLevelId, maxLevelId, passType)
-- Level_ID 进入关卡编号
-- LevelType 进入关卡类型
-- MaxLevel 已解锁最大关卡
-- StartTimes 累计进入次数
-- IsNew 是否是新用户
local args = {
level_id = currLevelId,
max_dungeon_level = maxLevelId,
pass_type = passType,
battle_type = BIReport.BATTLE_TYPE[battleType],
event_type = BIReport.FIGHT_TYPE.END,
}
self:report(EVENT_NAME_FIGHT, args)
BIReport:printArgsStr(EVENT_NAME_FIGHT, args)
end
-- 首页按钮点击
function BIReport:postBtnCilck(clickType)
local args = {
event_type = clickType,
}
self:report(EVENT_NAME_CLICK_BTN, args)
BIReport:printArgsStr(EVENT_NAME_CLICK_BTN, args)
end
-- 道具获取
function BIReport:postItemGet(bigNum, itemId, getType)
-- Item 道具id
-- Type 获得方式
-- MaxLevel 最大关卡
-- ItemNum 获取道具数量
-- ItemAll 获取后道具数量
-- IsNew 是否是新用户
local itemBigNum = DataManager.BagData.ItemData:getItemBigNumById(itemId)
local args = {
item_value = bigNum.value,
item_unit = bigNum.unit,
item_id = itemId,
item_all_value = itemBigNum.value,
item_all_unit = itemBigNum.unit,
type = getType,
}
self:report(EVENT_NAME_ITEM_GET, args)
BIReport:printArgsStr(EVENT_NAME_ITEM_GET, args)
end
-- 道具使用
function BIReport:postItemUse(bigNum, itemId, getType)
-- Item 道具id
-- Type 消耗方式
-- MaxLevel 最大关卡
-- ItemNum 消耗道具数量
-- ItemAll 消耗后道具数量
-- IsNew 是否是新用户
local itemBigNum = DataManager.BagData.ItemData:getItemBigNumById(itemId)
local args = {
item_value = bigNum.value,
item_unit = bigNum.unit,
item_id = itemId,
item_all_value = itemBigNum.value,
item_all_unit = itemBigNum.unit,
type = getType,
}
self:report(EVENT_NAME_ITEM_USE, args)
BIReport:printArgsStr(EVENT_NAME_ITEM_USE, args)
end
-- 钻石增加
function BIReport:postGemGet(bigNum, getType, itemId)
-- CoinNum 代币数量
-- Type 获得类型
-- CoinsType 代币类型
-- IsNew 是否是新用户
-- MaxLevel 最大关卡
local args = {
type = getType,
-- coin_value = bigNum.value,
-- coin_unit = bigNum.unit,
coin_type = BIReport.COIN_TYPE[itemId],
}
if itemId == GConst.ItemConst.ITEM_ID_GEM then
-- args.coin_value = BigNumOpt.bigNum2Num(bigNum)
args.coin_unit = 0
else
args.coin_value = bigNum.value
args.coin_unit = bigNum.unit
end
self:report(EVENT_NAME_COIN_GET, args)
BIReport:printArgsStr(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),
-- max_chapter = DataManager.StageData:getNewChapterId(),
}
self:report(EVENT_NAME_COIN_USE, args)
BIReport:printArgsStr(EVENT_NAME_COIN_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)
BIReport:printArgsStr(EVENT_NAME_AD_OPT, args)
end
-- 广告播放视频成功
function BIReport:postAdPlaySuccess(adsType)
local args = {
ad_type = adsType,
event_type = BIReport.ADS_OPT_TYPE.SUC,
}
self:report(EVENT_NAME_AD_OPT, args)
BIReport:printArgsStr(EVENT_NAME_AD_OPT, args)
end
-- 广告奖励发放成功
function BIReport:postAdRewardGet(adsType)
local args = {
ad_type = adsType,
event_type = BIReport.ADS_OPT_TYPE.RETURN,
}
self:report(EVENT_NAME_AD_OPT, args)
BIReport:printArgsStr(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)
BIReport:printArgsStr(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)
BIReport:printArgsStr(EVENT_NAME_PAY_OPT, args)
end
-- 点击商品购买按钮
function BIReport:postPayClick(giftType, id, rechargeId)
local args = {
gift_type = giftType,
commodity_id = id,
-- commodity_state = payDouble,
recharge_id = rechargeId,
event_type = BIReport.PAY_OPT_TYPE.CLICK,
}
self:report(EVENT_NAME_PAY_OPT, args)
BIReport:printArgsStr(EVENT_NAME_PAY_OPT, args)
end
-- 跳转购买界面
function BIReport:postPayTurn(giftType, id, rechargeId)
local args = {
gift_type = giftType,
commodity_id = id,
-- commodity_state = payDouble,
recharge_id = rechargeId,
event_type = BIReport.PAY_OPT_TYPE.BUY,
}
self:report(EVENT_NAME_PAY_OPT, args)
BIReport:printArgsStr(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)
BIReport:printArgsStr(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)
BIReport:printArgsStr(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)
BIReport:printArgsStr(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:postEquipWear(equipPart, equipLv, equipId)
-- MaxLevel 最大关卡
-- IsNew 是否是新用户
-- Equip_Lv 装备等级
-- Equip_ID 装备ID
local args = {
equip_part = equipPart,
equip_lv = equipLv,
equip_id = equipId,
event_type = BIReport.EQUIP_OPT_TYPE.EQUIP_WEAR,
}
self:report(EVENT_NAME_EQUIP_OPT, args)
BIReport:printArgsStr(EVENT_NAME_EQUIP_OPT, args)
end
-- 装备升级
function BIReport:postEquipUp(equipPart, equipLv, equipId)
-- MaxLevel 最大关卡
-- IsNew 是否是新用户
-- Equip_Lv 升级后装备等级
-- Equip_ID 装备ID
-- Type 消耗类型
local args = {
equip_part = equipPart,
equip_lv = equipLv,
equip_id = equipId,
event_type = BIReport.EQUIP_OPT_TYPE.EQUIP_LV_UP,
}
self:report(EVENT_NAME_EQUIP_OPT, args)
BIReport:printArgsStr(EVENT_NAME_EQUIP_OPT, args)
end
function BIReport:postEquipGet(equipId, getType)
-- MaxLevel 最大关卡
-- IsNew 是否是新用户
-- Equip_Lv 获取的装备等级
-- Equip_ID 获取的装备ID
-- Type 获取类型
local args = {
equip_id = equipId,
type = getType,
event_type = BIReport.EQUIP_OPT_TYPE.EQUIP_GET,
}
self:report(EVENT_NAME_EQUIP_OPT, args)
BIReport:printArgsStr(EVENT_NAME_EQUIP_OPT, args)
end
function BIReport:postLegacyWear(equipPart, equipLv, equipId)
-- MaxLevel 最大关卡
-- IsNew 是否是新用户
-- Equip_Lv 装备等级
-- Equip_ID 装备ID
local args = {
equip_part = equipPart,
equip_lv = equipLv,
equip_id = equipId,
event_type = BIReport.EQUIP_OPT_TYPE.LEGACY_WEAR,
}
self:report(EVENT_NAME_EQUIP_OPT, args)
BIReport:printArgsStr(EVENT_NAME_EQUIP_OPT, args)
end
-- 装备升级
function BIReport:postLegacyUp(equipPart, equipLv, equipId)
-- MaxLevel 最大关卡
-- IsNew 是否是新用户
-- Equip_Lv 升级后装备等级
-- Equip_ID 装备ID
-- Type 消耗类型
local args = {
equip_part = equipPart,
equip_lv = equipLv,
equip_id = equipId,
event_type = BIReport.EQUIP_OPT_TYPE.LEGACY_LV_UP,
}
self:report(EVENT_NAME_EQUIP_OPT, args)
BIReport:printArgsStr(EVENT_NAME_EQUIP_OPT, args)
end
function BIReport:postLegacyGet(equipId, getType)
-- MaxLevel 最大关卡
-- IsNew 是否是新用户
-- Equip_Lv 获取的装备等级
-- Equip_ID 获取的装备ID
-- Type 获取类型
local args = {
equip_id = equipId,
type = getType,
event_type = BIReport.EQUIP_OPT_TYPE.LEGACY_GET,
}
self:report(EVENT_NAME_EQUIP_OPT, args)
BIReport:printArgsStr(EVENT_NAME_EQUIP_OPT, args)
end
function BIReport:postLegacyRemove(equipPart, equipId)
-- MaxLevel 最大关卡
-- IsNew 是否是新用户
-- Equip_Lv 获取的装备等级
-- Equip_ID 获取的装备ID
-- Type 获取类型
local args = {
equip_part = equipPart,
equip_id = equipId,
event_type = BIReport.EQUIP_OPT_TYPE.LEGACY_REMOVE,
}
self:report(EVENT_NAME_EQUIP_OPT, args)
BIReport:printArgsStr(EVENT_NAME_EQUIP_OPT, args)
end
function BIReport:postDataException(itemId, count, getType)
-- local args = {
-- item_num = count,
-- item_id = itemId,
-- type = getType,
-- }
-- self:report(EVENT_NAME_DATA_EXCEPTION, args)
-- BIReport:printArgsStr(EVENT_NAME_DATA_EXCEPTION, args)
end
-- 战令打点
function BIReport:postBattlePassOpen()
local args = {
event_type = BIReport.BATTLE_PASS_OPT_TYPE.OPEN,
}
self:report(EVENT_NAME_BATTLE_PASS_OPT, args)
BIReport:printArgsStr(EVENT_NAME_BATTLE_PASS_OPT, args)
end
function BIReport:postBattlePassTaskClaim(id, lv, progress)
local args = {
task_id = id,
task_level = lv,
task_progress = progress,
event_type = BIReport.BATTLE_PASS_OPT_TYPE.TASK_CLAIM,
}
self:report(EVENT_NAME_BATTLE_PASS_OPT, args)
BIReport:printArgsStr(EVENT_NAME_BATTLE_PASS_OPT, args)
end
function BIReport:postBattlePassRewardClaim(lv, highLv)
local args = {
task_level = lv,
task_high_lv = highLv,
event_type = BIReport.BATTLE_PASS_OPT_TYPE.REWARD_CLAIM,
}
self:report(EVENT_NAME_BATTLE_PASS_OPT, args)
BIReport:printArgsStr(EVENT_NAME_BATTLE_PASS_OPT, args)
end
function BIReport:postBattlePassExpGet(getExp, lv, exp)
local args = {
task_get_exp = getExp,
task_level = lv,
task_exp = exp,
event_type = BIReport.BATTLE_PASS_OPT_TYPE.EXP_GET,
}
self:report(EVENT_NAME_BATTLE_PASS_OPT, args)
BIReport:printArgsStr(EVENT_NAME_BATTLE_PASS_OPT, args)
end
-- 登录
-- 点击登录
function BIReport:postAccountLoginClick(loginType)
local args = {
login_type = loginType,
event_type = BIReport.ACCOUNT_OPT_TYPE.LOGIN_CLICK,
}
self:report(EVENT_NAME_ACCOUNT_OPT, args)
BIReport:printArgsStr(EVENT_NAME_ACCOUNT_OPT, args)
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)
BIReport:printArgsStr(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)
BIReport:printArgsStr(EVENT_NAME_ACCOUNT_OPT, args)
end
-- 点击绑定
function BIReport:postAccountBindClick(loginType)
local args = {
login_type = loginType,
event_type = BIReport.ACCOUNT_OPT_TYPE.BIND_CLICK,
}
self:report(EVENT_NAME_ACCOUNT_OPT, args)
BIReport:printArgsStr(EVENT_NAME_ACCOUNT_OPT, args)
end
-- 绑定成功
function BIReport:postAccountBindFinish(loginType)
local args = {
login_type = loginType,
event_type = BIReport.ACCOUNT_OPT_TYPE.BIND_FINISH,
}
self:report(EVENT_NAME_ACCOUNT_OPT, args)
BIReport:printArgsStr(EVENT_NAME_ACCOUNT_OPT, args)
end
-- -- 切换账号
-- function BIReport:postAccountChange(loginType)
-- local args = {
-- loginType = loginType,
-- }
-- self:report(EVENT_NAME_ACCOUNT_CHANGE, args)
-- BIReport:printArgsStr(EVENT_NAME_ACCOUNT_CHANGE, args)
-- end
-- -- 删除账号
-- function BIReport:postAccountDelete(loginType)
-- local args = {
-- loginType = loginType,
-- }
-- self:report(EVENT_NAME_ACCOUNT_DELETE, args)
-- BIReport:printArgsStr(EVENT_NAME_ACCOUNT_DELETE, args)
-- end
-- 上报ping服务器地址情况
function BIReport:postPingServer(address, time, resultType)
local args = {
address = address,
time = time,
type = resultType
}
self:report(EVENT_NAME_PING_SERVER, args)
BIReport:printArgsStr(EVENT_NAME_PING_SERVER, args)
end
-- -- CDKey兑换结果
-- function BIReport:postCDKeyResult(CDKeyStr, result, code)
-- local args = {
-- cdkey = CDKeyStr,
-- success = result,
-- code = code
-- }
-- self:report(CDKEY_EXCHANGE_RESULT, args)
-- BIReport:printArgsStr(CDKEY_EXCHANGE_RESULT, args)
-- end
-- -- 网络异常
-- function BIReport:postNetFail(errorType, msgName, time, failedTime)
-- local args = {
-- error_type = errorType,
-- message_name = msgName,
-- time = time,
-- failed_time = failedTime
-- }
-- self:report(EVENT_NAME_NET_FAIL, args)
-- BIReport:printArgsStr(EVENT_NAME_NET_FAIL, args)
-- end
-- -- 通信成功
-- function BIReport:postNetSuccess(msgName, retryTimes, time, code)
-- local args = {
-- message_name = msgName,
-- retry_times = retryTimes,
-- time = time,
-- code = code
-- }
-- self:report(EVENT_NAME_NET_SUCCESS, args)
-- BIReport:printArgsStr(EVENT_NAME_NET_SUCCESS, args)
-- end
-- -- 重复订单
-- function BIReport:postRepeatPayOrder(productId, originOrderId, orderId)
-- local args = {
-- product_id = productId,
-- origin_order_id = tostring(originOrderId),
-- order_id = orderId
-- }
-- self:report(EVENT_NAME_PAY_ORDER_REPEAT, args)
-- BIReport:printArgsStr(EVENT_NAME_PAY_ORDER_REPEAT, args)
-- end
-- 召唤
function BIReport:postSummonSuc(summonType, diamondType)
-- MaxLevel 最大关卡
-- IsNew 是否是新用户
-- Type 召唤类型 Equip=武器召唤、Defense=防具召唤、Cherish=传家宝召唤、Rune=符文召唤
-- DiamondType 消耗钻石类型 Free=免费召唤、Ad1=当日第1次广告召唤、Ad2=第2次、Ad3=当日第3次、Daimond11=召唤11次、Diamond35=召唤35次
local args = {
diamond_type = diamondType,
type = summonType,
}
self:report(EVENT_NAME_SUMMON, args)
BIReport:printArgsStr(EVENT_NAME_SUMMON, args)
end
-- 任务
function BIReport:postTaskFinish(taskType, taskId)
-- MaxLevel 最大关卡
-- IsNew 是否是新用户
-- TaskType 任务类型
-- Task_ID 任务id
-- FinishTimes 任务完成数
local args = {
task_type = taskType,
task_id = taskId,
event_type = BIReport.TASK_OPT_TYPE.FINISH,
}
self:report(EVENT_NAME_TASK_OPT, args)
BIReport:printArgsStr(EVENT_NAME_TASK_OPT, args)
end
function BIReport:postTaskReward(taskType, taskId)
-- MaxLevel 最大关卡
-- IsNew 是否是新用户
-- TaskType 任务类型
-- Task_ID 任务id
-- FinishTimes 累计领取奖励数
local args = {
task_type = taskType,
task_id = taskId,
event_type = BIReport.TASK_OPT_TYPE.REWARD,
}
self:report(EVENT_NAME_TASK_OPT, args)
BIReport:printArgsStr(EVENT_NAME_TASK_OPT, 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
-- 修炼
function BIReport:postTrainFinish(trainType, trainLv)
-- IsNew 是否是新用户
-- MaxLevel 最大关卡
-- TrainLv 训练属性等级
-- TrainType 训练类型
local args = {
type = tostring(trainType),
train_lv = trainLv,
event_type = BIReport.TRAIN_OPT_TYPE.TRAIN,
}
self:report(EVENT_NAME_TRAIN_OPT, args)
BIReport:printArgsStr(EVENT_NAME_TRAIN_OPT, args)
end
function BIReport:postTrainReborn()
local args = {
event_type = BIReport.TRAIN_OPT_TYPE.REBORN,
}
self:report(EVENT_NAME_TRAIN_OPT, args)
BIReport:printArgsStr(EVENT_NAME_TRAIN_OPT, args)
end
function BIReport:postTrainQuickPass()
local args = {
event_type = BIReport.TRAIN_OPT_TYPE.QUICK_PASS,
}
self:report(EVENT_NAME_TRAIN_OPT, args)
BIReport:printArgsStr(EVENT_NAME_TRAIN_OPT, args)
end
function BIReport:postTrainQuickPassUp(level)
local args = {
train_lv = level,
event_type = BIReport.TRAIN_OPT_TYPE.QUICK_PASS,
}
self:report(EVENT_NAME_TRAIN_OPT, args)
BIReport:printArgsStr(EVENT_NAME_TRAIN_OPT, args)
end
-- function BIReport:postChapterPass(oldId, chapterId, passType)
-- local args = {
-- old_id = oldId,
-- chapter_id = chapterId,
-- pass_type = passType,
-- event_type = BIReport.CHAPTER_OPT_TYPE.PASS,
-- }
-- self:report(EVENT_NAME_CHAPTER_OPT, args)
-- BIReport:printArgsStr(EVENT_NAME_CHAPTER_OPT, args)
-- end
-- 符文
function BIReport:postRuneGet(runeId)
local args = {
equip_id = runeId,
event_type = BIReport.RUNE_OPT_TYPE.GET,
}
self:report(EVENT_NAME_RUNE_OPT, args)
BIReport:printArgsStr(EVENT_NAME_RUNE_OPT, args)
end
function BIReport:postRuneUp(runeId, runeLv)
local args = {
equip_id = runeId,
equip_lv = runeLv,
event_type = BIReport.RUNE_OPT_TYPE.LV_UP,
}
self:report(EVENT_NAME_RUNE_OPT, args)
BIReport:printArgsStr(EVENT_NAME_RUNE_OPT, args)
end
function BIReport:postRuneWear(runeId, runeLv)
local args = {
equip_id = runeId,
equip_lv = runeLv,
event_type = BIReport.RUNE_OPT_TYPE.WEAR,
}
self:report(EVENT_NAME_RUNE_OPT, args)
BIReport:printArgsStr(EVENT_NAME_RUNE_OPT, args)
end
return BIReport