| | |
| | | } |
| | | |
| | | //根据指定的spid获取对应服务器列表配置 |
| | | public function GetServersCfg($spid) |
| | | public function GetServersCfg($spid, $checkSpecial = true) |
| | | { |
| | | $ConfigFile = dirname(__FILE__) . "\Server\Server_" . $spid . ".ini"; |
| | | if (file_exists($ConfigFile)) { |
| | | $serversCfg = parse_ini_file($ConfigFile, true); |
| | | |
| | | if (!$checkSpecial) { |
| | | return $serversCfg; |
| | | } |
| | | $UserAccount = $this->userData["UserAccount"]; |
| | | \CommFunc\GetConfig("ServerInfo", "SpecialServerIDStart", $SpecialServerIDStart); |
| | | \CommFunc\GetConfig("ServerInfo", "SpecialAccountList", $SpecialAccountList); |
| | |
| | | return $this->serversArray; |
| | | } |
| | | $spid = $this->GetSPID(); |
| | | $serversCfg = $this->GetServersCfg($spid); |
| | | $serversCfg = $this->GetServersCfg($spid, false); |
| | | if (!count($serversCfg)) { |
| | | return $serversCfg; |
| | | } |
| | | $this->serversArray = $serversCfg; |
| | | |
| | | $UserAccount = $this->userData["UserAccount"]; |
| | | \CommFunc\GetConfig("ServerInfo", "SpecialServerIDStart", $SpecialServerIDStart); |
| | | \CommFunc\GetConfig("ServerInfo", "SpecialAccountList", $SpecialAccountList); |
| | | $SpecialAccountList = explode(",", $SpecialAccountList); |
| | | $SpecialServerIDStart = intval($SpecialServerIDStart); |
| | | $isSpecialUser = in_array($UserAccount, $SpecialAccountList); |
| | | $specialServerID = 270; // 270服特殊处理,被合到270以前的服了 |
| | | $specialMainServerID = 0; // 特殊服所属主服 |
| | | if ($isSpecialUser) { |
| | | foreach ($serversCfg as $info) { |
| | | $ServerID = intval($info["ServerID"]); |
| | | if ($ServerID == $specialServerID && $info["MainServer"]) { |
| | | $specialMainServerID = intval($info["MainServer"]); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | # 统计合服列表 |
| | | $mixServerArray = array(); |
| | |
| | | $mixServerArray[$mainServerID] = array("MixServerIDList" => array(), "MixServerStr" => ""); |
| | | } |
| | | array_push($mixServerArray[$mainServerID]["MixServerIDList"], intval($serverInfo["ServerID"])); |
| | | } |
| | | |
| | | if ($isSpecialUser) { |
| | | if ($specialMainServerID) { |
| | | // 特殊服只显示这两个服 |
| | | $mixServerArray[$specialMainServerID] = array("MixServerIDList" => array($specialMainServerID, $specialServerID), "MixServerStr" => ""); |
| | | } |
| | | } |
| | | |
| | | # 翻译合服字符串信息 |
| | |
| | | $this->serversArray[$serverName]["MixServerIDList"] = $mixServerInfo["MixServerIDList"]; |
| | | $this->serversArray[$serverName]["MixServerStr"] = $mixServerInfo["MixServerStr"]; |
| | | } |
| | | |
| | | // 特殊账号,只能看指定服及以上 |
| | | if ($isSpecialUser) { |
| | | foreach ($this->serversArray as $key => $info) { |
| | | $serverID = intval($info["ServerID"]); |
| | | if ($serverID < $SpecialServerIDStart && $serverID != $specialMainServerID) { |
| | | unset($this->serversArray[$key]); |
| | | } |
| | | } |
| | | } |
| | | return $this->serversArray; |
| | | } |
| | | |