【sdk登录】新增两个参数extData 和 p_appId 草花渠道使用
parent
9681a00816
commit
c2961f8f2d
|
@ -1934,4 +1934,14 @@ function trim(input)
|
|||
end
|
||||
function GetPlayerRoleSingleConFig()
|
||||
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
|
|
@ -42,31 +42,32 @@ function this.Initialize()
|
|||
this.SdkLoginTimeStamp = result[3]
|
||||
AppConst.TokenStr = result[4]
|
||||
AppConst.SdkChannel = result[5]
|
||||
this.extData = result[6]
|
||||
this.p_appId = result[7]
|
||||
AppConst.SdkPackageName = AndroidDeviceInfo.Instance:GetPackageName()
|
||||
end
|
||||
-- 判断是否是注册并登录
|
||||
if this.isRegister then
|
||||
this.isRegister = false
|
||||
-- 登出之前的账号
|
||||
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")
|
||||
-- 触发创建账户的事件
|
||||
this.TrackCreateAccount()
|
||||
-- 发送登录成功事件
|
||||
Game.GlobalEvent:DispatchEvent(GameEvent.LoginSuccess.OnLoginSuccess,result[1])
|
||||
else
|
||||
this.CheckIsRegister(AppConst.OpenId, function(isRegister)
|
||||
if isRegister then
|
||||
-- 触发创建账户的事件
|
||||
this.TrackCreateAccount()
|
||||
-- 发送登录成功事件
|
||||
Game.GlobalEvent:DispatchEvent(GameEvent.LoginSuccess.OnLoginSuccess,result[1])
|
||||
end
|
||||
end)
|
||||
end
|
||||
-- 发送登录成功事件
|
||||
Game.GlobalEvent:DispatchEvent(GameEvent.LoginSuccess.OnLoginSuccess,result[1])
|
||||
end
|
||||
|
||||
SDKMgr.onSwitchAccountCallback = function(resp)
|
||||
Log("onSwitchAccountCallback::"..resp)
|
||||
local result = string.split(resp, "#")
|
||||
--Util.LogError(debug.traceback("<color=#00ccee>onSwitchAccountCallback:" .. result[1] .. "</color>"))
|
||||
if tonumber(result[1]) == SDK_RESULT.SUCCESS then
|
||||
ThinkingAnalyticsManager.Track("change_account")
|
||||
Game.Restart()
|
||||
|
@ -76,7 +77,6 @@ function this.Initialize()
|
|||
SDKMgr.onLogoutCallback = function(resp)
|
||||
Log("onLogoutCallback::"..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
|
||||
ThinkingAnalyticsManager.Track("quit_account")
|
||||
Game.Restart()
|
||||
|
@ -86,6 +86,27 @@ function this.Initialize()
|
|||
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)
|
||||
--[[
|
||||
PlayerPrefs.SetInt(this.GameName.."LoginWay", this.CurLoginWay);
|
||||
|
@ -158,4 +179,6 @@ function this.RequestUser(name, pw, call)
|
|||
end,nil,nil,nil)
|
||||
end
|
||||
|
||||
|
||||
|
||||
return this
|
|
@ -593,6 +593,8 @@ function this.RequestHttpLogin()
|
|||
.. "&gid=" .. AppConst.SdkPackageName --LoginManager.pt_gId
|
||||
.. "&version=" .. LoginRoot_PackageVersion
|
||||
.. "&timeStamp="..LoginManager.SdkLoginTimeStamp
|
||||
.. "&ext="..encodeURI(LoginManager.extData)
|
||||
.. "&platform_appid="..LoginManager.p_appId
|
||||
else
|
||||
if IsDevelopLogin then
|
||||
-- 开发用
|
||||
|
|
Loading…
Reference in New Issue