【登录】serverversion改为从后端获取
parent
aae1e82a1c
commit
a7c947d8b4
|
@ -5,8 +5,7 @@ local this = LoginPanel
|
||||||
this.LoginWay = { Account = 0, WeChat = 1 }
|
this.LoginWay = { Account = 0, WeChat = 1 }
|
||||||
|
|
||||||
SERVER_VERSION = tonumber(ServerConfigManager.GetSettingValue(ServerConfigManager.SettingConfig.ServerVersion) or 0)
|
SERVER_VERSION = tonumber(ServerConfigManager.GetSettingValue(ServerConfigManager.SettingConfig.ServerVersion) or 0)
|
||||||
local ServerVersion = SERVER_VERSION
|
local IsShowNotice = false
|
||||||
local IsShowNotice = SERVER_VERSION == 0 -- 正式服显示公告
|
|
||||||
|
|
||||||
local IsSDKLogin = AppConst.isSDK and AppConst.isSDKLogin
|
local IsSDKLogin = AppConst.isSDK and AppConst.isSDKLogin
|
||||||
local IsDevelopLogin = true
|
local IsDevelopLogin = true
|
||||||
|
@ -273,6 +272,11 @@ function this:OnClose()
|
||||||
SoundManager.PauseAmbient()
|
SoundManager.PauseAmbient()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function this.CheckNoticeShow()
|
||||||
|
-- 判断公告显示
|
||||||
|
IsShowNotice = SERVER_VERSION == 0 -- 正式服显示公告
|
||||||
|
this.btnNotice:SetActive(IsShowNotice)
|
||||||
|
end
|
||||||
-- 打开公告界面
|
-- 打开公告界面
|
||||||
function this.ShowNotice()
|
function this.ShowNotice()
|
||||||
RequestPanel.Show(Language[11137])
|
RequestPanel.Show(Language[11137])
|
||||||
|
@ -287,14 +291,48 @@ function this.ShowNotice()
|
||||||
end, nil, nil, nil)
|
end, nil, nil, nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- 请求获取
|
||||||
|
function this.RequestServerVersion(func)
|
||||||
|
local ChannelID = LoginRoot_Channel
|
||||||
|
local packId = PackageManager.GetPackageID()
|
||||||
|
if packId then
|
||||||
|
ChannelID = ChannelID.. packId
|
||||||
|
end
|
||||||
|
local url = LoginRoot_Url .. "jl_loginserver/getServerVersion?serverVersion=tishen1"--..ChannelID
|
||||||
|
LogPink(url)
|
||||||
|
networkMgr:SendGetHttp(url, function (str)
|
||||||
|
LogPink(str)
|
||||||
|
if str == "null" or string.find(str, "<html>") then
|
||||||
|
LogWarn("获取到的ServerVersion数据是空值,请检查!")
|
||||||
|
else
|
||||||
|
local json = require 'cjson'
|
||||||
|
local context = json.decode(str)
|
||||||
|
SERVER_VERSION = context.serverInfo or SERVER_VERSION
|
||||||
|
end
|
||||||
|
--
|
||||||
|
if func then
|
||||||
|
func()
|
||||||
|
end
|
||||||
|
end, nil, nil, function(errCode, errMsg)
|
||||||
|
LogError("GetServerVersion Error: "..errCode .. ", "..errMsg)
|
||||||
|
if func then
|
||||||
|
func()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
-- 请求获取服务器列表
|
-- 请求获取服务器列表
|
||||||
function this.RequestServerList(userId, callback)
|
function this.RequestServerList(userId, callback)
|
||||||
RequestPanel.Show(Language[11139])
|
this.RequestServerVersion(function()
|
||||||
local url = string.format(
|
this.CheckNoticeShow()
|
||||||
"%sjl_loginserver/getServerList?openId=%s&channel=%s&plat=android&sub_channel=%s&server_version=%s",
|
RequestPanel.Show(Language[11139])
|
||||||
LoginRoot_Url, userId, LoginRoot_Channel, LoginRoot_SubChannel, ServerVersion)
|
local url = string.format(
|
||||||
Log(url)
|
"%sjl_loginserver/getServerList?openId=%s&channel=%s&plat=android&sub_channel=%s&server_version=%s",
|
||||||
networkMgr:SendGetHttp(url, callback, nil, nil, nil)
|
LoginRoot_Url, userId, LoginRoot_Channel, LoginRoot_SubChannel, SERVER_VERSION)
|
||||||
|
Log(url)
|
||||||
|
networkMgr:SendGetHttp(url, callback, nil, nil, nil)
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue