【登录】serverversion改为从后端获取

dev_chengFeng
gaoxin 2021-06-22 15:01:02 +08:00 committed by JieLing
parent aae1e82a1c
commit a7c947d8b4
1 changed files with 46 additions and 8 deletions

View File

@ -5,8 +5,7 @@ local this = LoginPanel
this.LoginWay = { Account = 0, WeChat = 1 }
SERVER_VERSION = tonumber(ServerConfigManager.GetSettingValue(ServerConfigManager.SettingConfig.ServerVersion) or 0)
local ServerVersion = SERVER_VERSION
local IsShowNotice = SERVER_VERSION == 0 -- 正式服显示公告
local IsShowNotice = false
local IsSDKLogin = AppConst.isSDK and AppConst.isSDKLogin
local IsDevelopLogin = true
@ -273,6 +272,11 @@ function this:OnClose()
SoundManager.PauseAmbient()
end
function this.CheckNoticeShow()
-- 判断公告显示
IsShowNotice = SERVER_VERSION == 0 -- 正式服显示公告
this.btnNotice:SetActive(IsShowNotice)
end
-- 打开公告界面
function this.ShowNotice()
RequestPanel.Show(Language[11137])
@ -287,14 +291,48 @@ function this.ShowNotice()
end, nil, nil, nil)
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)
RequestPanel.Show(Language[11139])
local url = string.format(
"%sjl_loginserver/getServerList?openId=%s&channel=%s&plat=android&sub_channel=%s&server_version=%s",
LoginRoot_Url, userId, LoginRoot_Channel, LoginRoot_SubChannel, ServerVersion)
Log(url)
networkMgr:SendGetHttp(url, callback, nil, nil, nil)
this.RequestServerVersion(function()
this.CheckNoticeShow()
RequestPanel.Show(Language[11139])
local url = string.format(
"%sjl_loginserver/getServerList?openId=%s&channel=%s&plat=android&sub_channel=%s&server_version=%s",
LoginRoot_Url, userId, LoginRoot_Channel, LoginRoot_SubChannel, SERVER_VERSION)
Log(url)
networkMgr:SendGetHttp(url, callback, nil, nil, nil)
end)
end