Merge branch '0功能/账号id校验' into china/dev
commit
4607bd2fed
|
@ -1636,8 +1636,14 @@ function SubmitExtraData(context)
|
|||
params.guildID = PlayerManager.familyId
|
||||
params.Vip = tostring(VipManager.GetVipLevel())
|
||||
params.moneyNum = BagManager.GetItemCountById(16)
|
||||
params.roleCreateTime = DateUtils.GetDateTime(PlayerManager.userCreateTime)
|
||||
params.roleLevelUpTime = context.roleLevelUpTime and DateUtils.GetDateTime(context.roleLevelUpTime) or ""
|
||||
params.roleCreateTime = PlayerManager.userCreateTime
|
||||
params.roleLevelUpTime = context.roleLevelUpTime and context.roleLevelUpTime or "0"
|
||||
|
||||
-- 特殊处理, 改名时用zoneName传递老名字
|
||||
if context.type == SDKSubMitType.TYPE_CHANGE_NAME then
|
||||
params.zoneName = context.oldName
|
||||
end
|
||||
|
||||
SDKMgr:SubmitExtraData(params)
|
||||
end
|
||||
|
||||
|
|
|
@ -45,14 +45,17 @@ function this.Initialize()
|
|||
this.extData = result[6] or ""
|
||||
this.p_appId = result[7] or ""
|
||||
this.SdkSubChannel = result[8] or ""
|
||||
|
||||
AppConst.SdkPackageName = AndroidDeviceInfo.Instance:GetPackageName()
|
||||
-- 账号数据正确性检测
|
||||
this.CheckUserId(this.extData, function()
|
||||
-- 判断是否是注册并登录
|
||||
if this.isRegister then
|
||||
this.isRegister = false
|
||||
-- 触发创建账户的事件
|
||||
this.TrackCreateAccount()
|
||||
-- 发送登录成功事件
|
||||
Game.GlobalEvent:DispatchEvent(GameEvent.LoginSuccess.OnLoginSuccess,result[1])
|
||||
Game.GlobalEvent:DispatchEvent(GameEvent.LoginSuccess.OnLoginSuccess, result[1])
|
||||
else
|
||||
this.CheckIsRegister(AppConst.OpenId, function(isRegister)
|
||||
if isRegister then
|
||||
|
@ -60,11 +63,12 @@ function this.Initialize()
|
|||
this.TrackCreateAccount()
|
||||
end
|
||||
-- 发送登录成功事件
|
||||
Game.GlobalEvent:DispatchEvent(GameEvent.LoginSuccess.OnLoginSuccess,result[1])
|
||||
Game.GlobalEvent:DispatchEvent(GameEvent.LoginSuccess.OnLoginSuccess, result[1])
|
||||
end)
|
||||
end
|
||||
-- 防沉迷检测
|
||||
this.CheckRealName()
|
||||
end)
|
||||
else
|
||||
local errCode = result[2]
|
||||
if not errCode then
|
||||
|
@ -134,6 +138,36 @@ function this.CheckRealName()
|
|||
end, nil)
|
||||
end
|
||||
end
|
||||
|
||||
function this.CheckUserId(extData, func)
|
||||
-- 如果没有OpenId则向登录服请求校验
|
||||
if not AppConst.OpenId or AppConst.OpenId == "" then
|
||||
local json = require 'cjson'
|
||||
if extData then
|
||||
local context = json.decode(extData)
|
||||
if context then
|
||||
HttpManager:SendGetHttp(LoginRoot_Url .. "jl_loginserver/getKTGameUserInfo?gid=".. context.gid .. "&pid=".. context.pid .. "&access_token=" .. AppConst.TokenStr,
|
||||
function(str)
|
||||
if str then
|
||||
Log(str)
|
||||
local data = json.decode(str)
|
||||
AppConst.OpenId = data.openid
|
||||
end
|
||||
-- 完成
|
||||
if func then
|
||||
func()
|
||||
end
|
||||
end)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
-- 不符合条件
|
||||
if func then
|
||||
func()
|
||||
end
|
||||
end
|
||||
|
||||
-- 检测是否是新账户
|
||||
function this.CheckIsRegister(openId, func)
|
||||
if func then
|
||||
|
|
|
@ -71,6 +71,9 @@ function this.ChangeUserName(type, name, teamPosId, sex, callBack)
|
|||
return
|
||||
end
|
||||
NetManager.ChangeUserNameRequest(type, name, teamPosId, sex, function()
|
||||
-- 保存一下老名字,用于上报事件
|
||||
local oldName = this.roleName
|
||||
--
|
||||
this.roleSex = sex
|
||||
this.roleName = name
|
||||
PlayerManager.nickName = name
|
||||
|
@ -79,6 +82,9 @@ function this.ChangeUserName(type, name, teamPosId, sex, callBack)
|
|||
ThinkingAnalyticsManager.SetSuperProperties({
|
||||
role_name = PlayerManager.nickName,
|
||||
})
|
||||
-- 上报改名事件
|
||||
SubmitExtraData({ type = SDKSubMitType.TYPE_CHANGE_NAME, oldName = oldName })
|
||||
|
||||
-- 创建角色时保存一下头像数据
|
||||
if type == 1 then
|
||||
local config = ConfigManager.GetConfigDataByKey(ConfigName.PlayerRole, "Role", sex)
|
||||
|
|
Loading…
Reference in New Issue