| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- local cjson = require("cjson")
- local function pluginDataUpLog(reasonEvent)
- if not reasonEvent then
- return
- end
- -- body
- local platform = "pc"
- local userId = ""
- local channelId = global.L_GameEnvManager:GetChannelID()
- local gameId = ""
- local roleId = ""
- local roleName = ""
- local job = ""
- local sex = ""
- local clientVesion = ""
- local mapId = ""
- local serverId = ""
- local serverName = ""
-
- if cc.PLATFORM_OS_ANDROID == global.Platform then
- platform = "android"
- elseif global.isOHOS then
- platform = "ohos"
- elseif cc.PLATFORM_OS_IPAD == global.Platform or cc.PLATFORM_OS_IPHONE == global.Platform then
- platform = "ios"
- end
- local AuthProxy = global.Facade and global.Facade:retrieveProxy(global.ProxyTable.AuthProxy)
- local currModule = global.L_ModuleManager:GetCurrentModule()
- local loginProxy = global.Facade and global.Facade:retrieveProxy( global.ProxyTable.Login )
- local propertyProxy = global.Facade and global.Facade:retrieveProxy( global.ProxyTable.PlayerProperty )
- local mapProxy = global.Facade and global.Facade:retrieveProxy( global.ProxyTable.Map )
-
- gameId = currModule:GetOperID()
- if AuthProxy then
- userId = AuthProxy:GetUID()
- end
-
- if loginProxy then
- roleId = loginProxy:GetSelectedRoleID()
- roleName = loginProxy:GetSelectedRoleName()
- serverId = loginProxy:GetSelectedServerId()
- serverName = loginProxy:GetSelectedServerName()
- end
- if propertyProxy then
- job = tostring( GetJobName(propertyProxy:GetRoleJob()) )
- sex = tostring( propertyProxy:GetRoleSex() + 1 )
- clientVesion= currModule:GetRemoteVersion()
- end
- if mapProxy then
- mapId = mapProxy:GetMapID()
- end
- local upLogData = {
- event={time=os.time(),name = "plugin_event",type = "track"},
- user={id=tostring( userId )},
- properities = {
- game_platform = platform,
- user_id = userId,
- platform_id = channelId,
- game_id = gameId,
- role_id = roleId,
- role_name = roleName,
- job_name = job,
- gender = sex,
- client_vesion = clientVesion,
- map_id = mapId,
- servid = serverId,
- server_name = serverName,
- reason = reasonEvent
- }
- }
- global.L_DataRePort:SendRePortData(upLogData)
- end
- if cc.PLATFORM_OS_ANDROID == global.Platform or cc.PLATFORM_OS_WINDOWS == global.Platform then
- local WebSocket = cc.WebSocket
- function WebSocket:create(data)
- pluginDataUpLog("websocket")
- return getmetatable(self)[".backup"].create(self, data)
- end
- end
|