2021-04-20 13:58:00 +08:00
|
|
|
|
CustomEventManager = {}
|
2020-08-22 15:31:14 +08:00
|
|
|
|
local this = CustomEventManager
|
2020-08-17 18:32:59 +08:00
|
|
|
|
local customEventConfig = ConfigManager.GetConfig(ConfigName.CustomEventConfig)
|
2020-08-22 15:31:14 +08:00
|
|
|
|
function this.SetisFirstLogVal(isDayFirst)
|
|
|
|
|
if isDayFirst == 0 then--今天第一次登陆
|
2021-04-21 16:36:12 +08:00
|
|
|
|
-- --LogGreen("埋点上报数据 : "..CalculateSecondsNowTo_N_OClock(24).." "..GetTimeStamp().." "..PlayerManager.userCreateTime)
|
2021-01-04 14:27:18 +08:00
|
|
|
|
local cur24Times = CalculateSecondsNowTo_N_OClock(0) + GetTimeStamp()
|
2020-08-22 15:31:14 +08:00
|
|
|
|
local day = math.floor((cur24Times - PlayerManager.userCreateTime)/86400) + 1
|
2021-04-21 16:36:12 +08:00
|
|
|
|
-- --LogGreen("day "..day)
|
2020-08-22 15:31:14 +08:00
|
|
|
|
--发送埋点数据
|
|
|
|
|
this.SendCustomEvents(FBSDKCustomEventType.LoginNum,day)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
function this.SendCustomEvents(CustomType,info)
|
2021-04-21 16:36:12 +08:00
|
|
|
|
--LogGreen("埋点上报数据 SendCustomEvents : "..CustomType)
|
2021-03-16 14:15:09 +08:00
|
|
|
|
if not AppConst.isSDKLogin then return end
|
2020-08-17 18:32:59 +08:00
|
|
|
|
local curConfigData = nil
|
2021-03-16 14:15:09 +08:00
|
|
|
|
info = tonumber(info)
|
2020-08-17 18:32:59 +08:00
|
|
|
|
for _, configInfo in ConfigPairs(customEventConfig) do
|
2021-03-16 14:15:09 +08:00
|
|
|
|
if CustomType == configInfo.CustomEventType and (configInfo.value == "0" or info == tonumber(configInfo.value)) then
|
2020-08-17 18:32:59 +08:00
|
|
|
|
curConfigData = configInfo
|
2021-03-16 14:15:09 +08:00
|
|
|
|
if curConfigData then
|
2021-05-31 17:31:31 +08:00
|
|
|
|
local field = PackageManager.GetCustomEventField()
|
|
|
|
|
if field and curConfigData[field] and curConfigData[field] ~= "" then
|
|
|
|
|
this.SendCustomEvent(curConfigData[field], curConfigData.Info, curConfigData.type)
|
2021-03-16 14:15:09 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
2020-08-17 18:32:59 +08:00
|
|
|
|
end
|
2020-08-22 15:31:14 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
-- 打点事件
|
2020-08-17 18:32:59 +08:00
|
|
|
|
function this.SendCustomEvent(event, data,type)
|
2021-03-17 17:36:50 +08:00
|
|
|
|
if AppConst.isSDKLogin then
|
|
|
|
|
SDKMgr:CustomEvent(event,data,type)
|
|
|
|
|
end
|
2020-08-22 15:31:14 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return CustomEventManager
|