【sdk登录】新增两个参数extData 和 p_appId 草花渠道使用
parent
9681a00816
commit
c2961f8f2d
|
@ -1934,4 +1934,14 @@ function trim(input)
|
||||||
end
|
end
|
||||||
function GetPlayerRoleSingleConFig()
|
function GetPlayerRoleSingleConFig()
|
||||||
return ConfigManager.GetConfigDataByKey(ConfigName.PlayerRole,"Role",0)
|
return ConfigManager.GetConfigDataByKey(ConfigName.PlayerRole,"Role",0)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 网络url转码
|
||||||
|
function decodeURI(s)
|
||||||
|
s = string.gsub(s, '%%(%x%x)', function(h) return string.char(tonumber(h, 16)) end)
|
||||||
|
return s
|
||||||
|
end
|
||||||
|
function encodeURI(s)
|
||||||
|
s = string.gsub(s, "([^%w%.%- ])", function(c) return string.format("%%%02X", string.byte(c)) end)
|
||||||
|
return string.gsub(s, " ", "+")
|
||||||
end
|
end
|
|
@ -42,31 +42,32 @@ function this.Initialize()
|
||||||
this.SdkLoginTimeStamp = result[3]
|
this.SdkLoginTimeStamp = result[3]
|
||||||
AppConst.TokenStr = result[4]
|
AppConst.TokenStr = result[4]
|
||||||
AppConst.SdkChannel = result[5]
|
AppConst.SdkChannel = result[5]
|
||||||
|
this.extData = result[6]
|
||||||
|
this.p_appId = result[7]
|
||||||
AppConst.SdkPackageName = AndroidDeviceInfo.Instance:GetPackageName()
|
AppConst.SdkPackageName = AndroidDeviceInfo.Instance:GetPackageName()
|
||||||
end
|
end
|
||||||
-- 判断是否是注册并登录
|
-- 判断是否是注册并登录
|
||||||
if this.isRegister then
|
if this.isRegister then
|
||||||
this.isRegister = false
|
this.isRegister = false
|
||||||
-- 登出之前的账号
|
-- 触发创建账户的事件
|
||||||
ThinkingAnalyticsManager.Logout()
|
this.TrackCreateAccount()
|
||||||
ThinkingAnalyticsManager.ClearSuperProperties()
|
-- 发送登录成功事件
|
||||||
-- 开始
|
Game.GlobalEvent:DispatchEvent(GameEvent.LoginSuccess.OnLoginSuccess,result[1])
|
||||||
ThinkingAnalyticsManager.SetSuperProperties({
|
else
|
||||||
account = AppConst.isSDK and tostring(AppConst.OpenId) or "",
|
this.CheckIsRegister(AppConst.OpenId, function(isRegister)
|
||||||
Bundle_id = AppConst.isSDK and AppConst.SdkPackageName or "",
|
if isRegister then
|
||||||
xx_id = AppConst.isSDK and AppConst.SdkChannel or "",
|
-- 触发创建账户的事件
|
||||||
device_id = AppConst.isSDK and ThinkingAnalyticsManager.GetDeviceId() or ""
|
this.TrackCreateAccount()
|
||||||
})
|
-- 发送登录成功事件
|
||||||
ThinkingAnalyticsManager.Track("create_account")
|
Game.GlobalEvent:DispatchEvent(GameEvent.LoginSuccess.OnLoginSuccess,result[1])
|
||||||
|
end
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
-- 发送登录成功事件
|
|
||||||
Game.GlobalEvent:DispatchEvent(GameEvent.LoginSuccess.OnLoginSuccess,result[1])
|
|
||||||
end
|
end
|
||||||
|
|
||||||
SDKMgr.onSwitchAccountCallback = function(resp)
|
SDKMgr.onSwitchAccountCallback = function(resp)
|
||||||
Log("onSwitchAccountCallback::"..resp)
|
Log("onSwitchAccountCallback::"..resp)
|
||||||
local result = string.split(resp, "#")
|
local result = string.split(resp, "#")
|
||||||
--Util.LogError(debug.traceback("<color=#00ccee>onSwitchAccountCallback:" .. result[1] .. "</color>"))
|
|
||||||
if tonumber(result[1]) == SDK_RESULT.SUCCESS then
|
if tonumber(result[1]) == SDK_RESULT.SUCCESS then
|
||||||
ThinkingAnalyticsManager.Track("change_account")
|
ThinkingAnalyticsManager.Track("change_account")
|
||||||
Game.Restart()
|
Game.Restart()
|
||||||
|
@ -76,7 +77,6 @@ function this.Initialize()
|
||||||
SDKMgr.onLogoutCallback = function(resp)
|
SDKMgr.onLogoutCallback = function(resp)
|
||||||
Log("onLogoutCallback::"..resp)
|
Log("onLogoutCallback::"..resp)
|
||||||
local result = string.split(resp, "#")
|
local result = string.split(resp, "#")
|
||||||
--Util.LogError(debug.traceback("<color=#00ccee>onLogoutCallback:" .. result[1] .. "</color>"))
|
|
||||||
if LoginManager.IsLogin and tonumber(result[1]) == SDK_RESULT.SUCCESS then
|
if LoginManager.IsLogin and tonumber(result[1]) == SDK_RESULT.SUCCESS then
|
||||||
ThinkingAnalyticsManager.Track("quit_account")
|
ThinkingAnalyticsManager.Track("quit_account")
|
||||||
Game.Restart()
|
Game.Restart()
|
||||||
|
@ -86,6 +86,27 @@ function this.Initialize()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- 检测是否是新账户
|
||||||
|
function this.CheckIsRegister(openId, func)
|
||||||
|
if func then
|
||||||
|
func(false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function this.TrackCreateAccount()
|
||||||
|
-- 登出之前的账号
|
||||||
|
ThinkingAnalyticsManager.Logout()
|
||||||
|
ThinkingAnalyticsManager.ClearSuperProperties()
|
||||||
|
-- 开始
|
||||||
|
ThinkingAnalyticsManager.SetSuperProperties({
|
||||||
|
account = AppConst.isSDK and tostring(AppConst.OpenId) or "",
|
||||||
|
Bundle_id = AppConst.isSDK and AppConst.SdkPackageName or "",
|
||||||
|
xx_id = AppConst.isSDK and AppConst.SdkChannel or "",
|
||||||
|
device_id = AppConst.isSDK and ThinkingAnalyticsManager.GetDeviceId() or ""
|
||||||
|
})
|
||||||
|
ThinkingAnalyticsManager.Track("create_account")
|
||||||
|
end
|
||||||
|
|
||||||
function this.SaveLoginInfo(user, pw)
|
function this.SaveLoginInfo(user, pw)
|
||||||
--[[
|
--[[
|
||||||
PlayerPrefs.SetInt(this.GameName.."LoginWay", this.CurLoginWay);
|
PlayerPrefs.SetInt(this.GameName.."LoginWay", this.CurLoginWay);
|
||||||
|
@ -158,4 +179,6 @@ function this.RequestUser(name, pw, call)
|
||||||
end,nil,nil,nil)
|
end,nil,nil,nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return this
|
return this
|
|
@ -593,6 +593,8 @@ function this.RequestHttpLogin()
|
||||||
.. "&gid=" .. AppConst.SdkPackageName --LoginManager.pt_gId
|
.. "&gid=" .. AppConst.SdkPackageName --LoginManager.pt_gId
|
||||||
.. "&version=" .. LoginRoot_PackageVersion
|
.. "&version=" .. LoginRoot_PackageVersion
|
||||||
.. "&timeStamp="..LoginManager.SdkLoginTimeStamp
|
.. "&timeStamp="..LoginManager.SdkLoginTimeStamp
|
||||||
|
.. "&ext="..encodeURI(LoginManager.extData)
|
||||||
|
.. "&platform_appid="..LoginManager.p_appId
|
||||||
else
|
else
|
||||||
if IsDevelopLogin then
|
if IsDevelopLogin then
|
||||||
-- 开发用
|
-- 开发用
|
||||||
|
|
Loading…
Reference in New Issue