------------------------------------------------ -- 作者: gzg -- 日期: 2021-02-25 -- 文件: ServerUrlInfo.lua -- 模块: ServerUrlInfo -- 描述: 服务器的地址获取信息 ------------------------------------------------ local SDKCacheData = CS.Thousandto.CoreSDK.SDKCacheData; local ServerUrlInfo = { --serverlist地址,SDK返回 ServerListURL = nil, --登陆服务器的地址 LoginServerUrl = nil, } --构造函数 function ServerUrlInfo:New() local _m = Utils.DeepCopy(self); return _m; end function ServerUrlInfo:GetDefaultURL() local _url = CS.UnityEngine.Gonbest.MagicCube.AppManager.Instance:GetLocalVersionValue("ServerKitURL"); Debug.Log("GetDefaultURL:" .. _url); if not _url then _url = "http://182.151.35.7:9090"; end return _url; end function ServerUrlInfo:GetSceneID() local _sceneID = CS.UnityEngine.Gonbest.MagicCube.AppManager.Instance:GetLocalVersionValue("platform_fid"); Debug.Log("GetSceneID:" .. _sceneID); if not _sceneID then _sceneID = "qx"; end return _sceneID; end --获取登陆服务器列表的地址 function ServerUrlInfo:GetLoginServerURL() if (SDKCacheData.AppID == nil or SDKCacheData.AppID =="") then self.LoginServerUrl = string.format("%s/api/app/list.do?app_id=16", SDKCacheData.DefaultURL); else --域名 应用编号 self.LoginServerUrl = string.format("%s/api/app/list.do?app_id=%s", GameCenter.SDKSystem.SDKImplement:GetServerUrl(), SDKCacheData.AppID); end return self.LoginServerUrl; end --获取游戏服务器列表的地址 function ServerUrlInfo:GetServerListURL() if (SDKCacheData.AppID == nil or SDKCacheData.AppID =="") or (SDKCacheData.ChannelID == nil or SDKCacheData.ChannelID =="") then self.ServerListURL = string.format("%s/api/svr/list.do?app_id=16&chn_id=73&sec_id=%s", SDKCacheData.DefaultURL,self:GetSceneID()); else --域名 应用编号 渠道号 self.ServerListURL = string.format("%s/api/svr/list.do?app_id=%s&chn_id=%s&user_id=%s&sec_id=%s&client_version=%s", GameCenter.SDKSystem.SDKImplement:GetServerUrl(), SDKCacheData.AppID, SDKCacheData.ChannelID, SDKCacheData.PlatformUID, self:GetSceneID(), AppPersistData.AppVersion); end return self.ServerListURL; end --获取游戏服务器列表的地址 function ServerUrlInfo:GetServerListNewURL() if (SDKCacheData.AppID == nil or SDKCacheData.AppID =="") or (SDKCacheData.ChannelID == nil or SDKCacheData.ChannelID =="") then self.ServerListURL = string.format("%s/PlatformKits/queryServerList?chn_id=73&sec_id=%s", self:GetDefaultURL(),self:GetSceneID()); else --域名 应用编号 渠道号 self.ServerListURL = string.format("%s/PlatformKits/queryServerList?chn_id=%s&user_id=%s&sec_id=%s&client_version=%s", self:GetDefaultURL(), SDKCacheData.ChannelID, SDKCacheData.PlatformUID, self:GetSceneID(), AppPersistData.AppVersion); end return self.ServerListURL; end return ServerUrlInfo;