"; $channel = $_SESSION['spid']; $ServerID = intval($_POST["ServerID"]); $ServerName = $_POST["ServerName"]; $JsonBranch = intval($_POST["JsonBranch"]); $OpenServerWay = intval($_POST["OpenServerWay"]); $RelationServerID = intval($_POST["RelationServerID"]); $RelationCreateRoles = intval($_POST["RelationCreateRoles"]); $StartDate = $_POST["StartDate"]; $StartHour = $_POST["StartHour"]; $StartMinute = $_POST["StartMinute"]; $StartSecond = $_POST["StartSecond"]; if ($StartDate) { $StartDate .= " " . $StartHour . ":" . $StartMinute . ":" . $StartSecond; } $ClearState = intval($_POST["ClearState"]); $Statue = intval($_POST["Statue"]); $RunningStatus = intval($_POST["RunningStatus"]); $Recommend = intval($_POST["Recommend"]); $RegionDomain = $_POST["RegionDomain"]; $LoginPort = intval($_POST["LoginPort"]); $GamePort = intval($_POST["GamePort"]); $MainServerID = intval($_POST["MainServerID"]); $find = array( "Channel" => $channel, "ServerID" => $ServerID ); if ($opType == "del") { if (!DBOper\Remove("GameServers", $find)) { $alertMsg = "删除服务器失败!"; \Logging\LogError($alertMsg . print_r($find, true)); return false; } $alertMsg = "删除服务器成功!"; \Logging\LogInfo($alertMsg . print_r($find, true)); return true; } $editArray = array( "Channel" => $channel, "ServerID" => $ServerID, "ServerName" => $ServerName, "JsonBranch" => $JsonBranch, "OpenServerWay" => $OpenServerWay, "RelationServerID" => $RelationServerID, "RelationCreateRoles" => $RelationCreateRoles, "StartDate" => $StartDate, "ClearState" => $ClearState, "Statue" => $Statue, "RunningStatus" => $RunningStatus, "Recommend" => $Recommend, "RegionDomain" => $RegionDomain, "LoginPort" => $LoginPort, "GamePort" => $GamePort, "MainServerID" => $MainServerID, ); // 添加 if ($opType == "add") { $editArray["RelationServerOK"] = 0; if (\CommFunc\IsInnerTest() && intval($_POST["InnerTestCount"]) > 0) { $testCount = intval($_POST["InnerTestCount"]); $testServerID = $ServerID; $testServerName = $ServerName; DBOper\Find("GameServers", array( "Channel" => $channel, "ServerID" => array('$gte' => $testServerID, '$lt' => ($testServerID + $testCount)) ), $existServer, array("ServerID" => 1)); $existServerIDArray = array(); foreach ($existServer as $value) { array_push($existServerIDArray, $value["ServerID"]); } \Logging\LogInfo("测试批量插入服务器: testServerID=" . $testServerID . " testCount=" . $testCount); // \Logging\LogInfo("已存在的服务器 => " . print_r($existServer, true)); \Logging\LogInfo("已存在的服务器ID => " . print_r($existServerIDArray, true)); $batchInsArray = array(); for ($i = 0; $i < $testCount; $i++) { $tServerID = $testServerID + $i; if (in_array($tServerID, $existServerIDArray)) { \Logging\LogInfo("测试插入服务器已存在: tServerID=" . $tServerID); continue; } $insArray = array_merge($editArray); $insArray["ServerID"] = $tServerID; $insArray["ServerName"] = "s" . $tServerID; array_push($batchInsArray, $insArray); } if (DBOper\BatchInsert("GameServers", $batchInsArray)) { $alertMsg = "批量插入测试服务器成功!"; } else { $alertMsg = "批量插入测试服务器失败!"; } // \Logging\LogInfo($alertMsg . print_r($batchInsArray, true)); return true; } DBOper\FindOne("GameServers", $find, $ret, null, false); if (count($ret) > 0) { $alertMsg = "该服务器已存在,不能重复添加!"; \Logging\LogInfo($alertMsg . " find=" . print_r($find, true)); return false; } if (!DBOper\Insert("GameServers", $editArray)) { $alertMsg = "添加服务器失败!"; \Logging\LogError($alertMsg . print_r($editArray, true)); return false; } $alertMsg = "添加服务器成功!"; \Logging\LogInfo($alertMsg . print_r($editArray, true)); } // 更新 elseif ($opType == "upd") { if (!DBOper\Update("GameServers", $find, $editArray)) { $alertMsg = "更新服务器失败!"; \Logging\LogError($alertMsg . " find=" . json_encode($find) . " set=" . json_encode($editArray)); return false; } $alertMsg = "更新服务器成功!"; \Logging\LogInfo($alertMsg . " find=" . json_encode($find) . " set=" . json_encode($editArray)); } return true; } \Logging\LogInfo("_POST:" . print_r($_POST, true)); $alertMsg = ""; $Permission = \User\Permission::P_OPSServerList; $channel = $_SESSION['spid']; $user = new \User\User($_SESSION['UserAccount']); if (!$user->HavePermission($Permission)) { exit; } if ($_POST["opType"]) { if (ServerInfoEdit($_POST["opType"])) { \ServerOPS\RefreshServerListIni($channel); } if ($_POST["opType"] == "add" && $alertMsg) { $getParams = "opType=add"; foreach ($_POST as $key => $value) { $getParams .= "&" . $key . "=" . $value; } $script = ""; echo $script; } else if ($alertMsg) { echo ""; } } $all = "all"; $Statue = array_key_exists("Statue", $_POST) ? $_POST["Statue"] : $all; $RunningStatus = array_key_exists("RunningStatus", $_POST) ? $_POST["RunningStatus"] : $all; $Recommend = array_key_exists("Recommend", $_POST) ? $_POST["Recommend"] : $all; // 搜索条件组合 {"Channel":"sohagame", "$or":[{"ServerID":{"$gte":1, "$lte":10}}, {"ServerID":{"$gte":80, "$lte":90}}]} $find = array("Channel" => $channel); if ($Statue != $all) { $find["Statue"] = intval($Statue); } if ($RunningStatus != $all) { $find["RunningStatus"] = intval($RunningStatus); } if ($Recommend != $all) { $find["Recommend"] = intval($Recommend); } $serverIDCondArray = array(); $serverIDCondIn = array(); $serverIDCondFind = array(); $serverIDCondNumMax = 20; for ($i = 1; $i < $serverIDCondNumMax + 1; $i++) { if (!array_key_exists("ServerIDGTE" . $i, $_POST)) { continue; } $eValue = intval($_POST["ServerIDE" . $i]); $gteValue = intval($_POST["ServerIDGTE" . $i]); $lteValue = intval($_POST["ServerIDLTE" . $i]); // echo $i, " : ", $gteValue, $lteValue, "
"; if ($eValue <= 0 && $gteValue <= 0 && $lteValue <= 0) { continue; } if ($gteValue > 0 && $lteValue > 0 && $gteValue > $lteValue) { continue; } $cond = array(); if ($eValue > 0) { array_push($serverIDCondIn, $eValue); } if ($gteValue > 0) { $cond['$gte'] = $gteValue; } if ($lteValue > 0) { $cond['$lte'] = $lteValue; } array_push($serverIDCondArray, array($eValue, $gteValue, $lteValue)); array_push($serverIDCondFind, array("ServerID" => $cond)); } if (count($serverIDCondIn) > 0) { array_push($serverIDCondFind, array("ServerID" => array('$in' => $serverIDCondIn))); } if (count($serverIDCondFind) > 0) { $find['$or'] = $serverIDCondFind; } // \Logging\LogInfo("find:" . json_encode($find)); $isSearch = true; if (array_key_exists("submitsearch", $_POST)) { } // 设置合服主服 else if (array_key_exists("submitSetMainServerID", $_POST)) { $SetMainServerID = intval($_POST["SetMainServerID"]); $set = array("MainServerID" => $SetMainServerID); if ($_POST["SetMainServerDomain"]) { \DBOper\FindOne("GameServers", array("Channel" => $channel, "ServerID" => $SetMainServerID), $mainServerInfo, null, false); if (isset($mainServerInfo)) { $set = array( "MainServerID" => $SetMainServerID, "RegionDomain" => $mainServerInfo["RegionDomain"], "LoginPort" => $mainServerInfo["LoginPort"], "GamePort" => $mainServerInfo["GamePort"] ); } } if (!\DBOper\Update("GameServers", $find, $set, false, false, true)) { $alertMsg = "批量更新合服主服失败!"; \Logging\LogError($alertMsg . " find=" . json_encode($find) . " set=" . json_encode($set)); } else { $alertMsg = "批量更新合服主服成功!"; \Logging\LogInfo($alertMsg . " find=" . json_encode($find) . " set=" . json_encode($set)); \ServerOPS\RefreshServerListIni($channel); } echo ""; } // 设置状态 else if (array_key_exists("updSelect", $_POST) && $_POST["updSelect"] != "") { $set = array(); $updSelect = $_POST["updSelect"]; if (substr($updSelect, 0, 6) == "Statue") { $set["Statue"] = intval(substr($updSelect, 6)); } else if (substr($updSelect, 0, 13) == "RunningStatus") { $set["RunningStatus"] = intval(substr($updSelect, 13)); } else if (substr($updSelect, 0, 9) == "Recommend") { $set["Recommend"] = intval(substr($updSelect, 9)); } // echo "set: ", json_encode($set), "
"; if (count($set) > 0) { if (!\DBOper\Update("GameServers", $find, $set, false, false, true)) { $alertMsg = "批量更新服务器失败!"; \Logging\LogError($alertMsg . " find=" . json_encode($find) . " set=" . json_encode($set)); } else { $alertMsg = "批量更新服务器成功!"; \Logging\LogInfo($alertMsg . " find=" . json_encode($find) . " set=" . json_encode($set)); \ServerOPS\RefreshServerListIni($channel); } echo ""; } } else { $isSearch = false; } $pageLimit = 50; # 默认仅展示最近服务器数 if ($isSearch) { $pageLimit = 0; # 搜索的直接显示全部,暂不做分页 } \DBOper\Find("GameServers", $find, $serverList, null, array("JsonBranch" => 1, "ServerID" => -1), $pageLimit); $totalCount = count($serverList); if (!$isSearch && $totalCount == $pageLimit) { $totalCount = \DBOper\Count("GameServers", $find); } // echo "_POST: ", print_r($_POST, true), "
"; // echo "find: ", json_encode($find), "
"; // echo "allVersionInfo:", print_r($allVersionInfo, true), "
"; // echo "branchNameInfo:", print_r($branchNameInfo, true), "
"; //显示表格字段配置 key-参数名,value-说明 $tableArray = array( "ServerID" => array("区服", "5%", "center"), "ServerName" => array("名称", "10%", "center"), "JsonBranch" => array("导出Json分支文件", "14%", "center"), "StartDate" => array("开服时间", "11%", "center"), "ClearState" => array("清档状态", "5%", "center"), "Statue" => array("开放状态", "5%", "center"), "RunningStatus" => array("运行状态", "5%", "center"), "Recommend" => array("推荐", "3%", "center"), "RegionDomain" => array("域名", "19%", "center"), "LoginPort" => array("登录端口", "5%", "center"), "GamePort" => array("游戏端口", "5%", "center"), "MainServerID" => array("所属主服", "5%", "center"), "" => array("操作", ""), ); ?> 服务器列表

服务器列表

开启状态:    运行状态:    推荐状态:         

     |          "; echo ""; echo ""; foreach (\ServerOPS\ServerStatue::$StatueName as $key => $value) { echo ""; } echo ""; echo ""; foreach (\ServerOPS\ServerRunningStatus::$RunningStatusName as $key => $value) { echo ""; } echo ""; echo ""; foreach (array("1" => "是", "0" => "否") as $key => $value) { echo ""; } echo ""; echo ""; ?>    />同步修改为主服地址
符合条件服务器总数: " . count($serverList) . ""; } else { echo ""; } echo ""; foreach ($tableArray as $value) { echo ""; } else { echo "无满足条件服务器!
"; } foreach ($serverList as $serverInfo) { echo ""; $ServerID = $serverInfo["ServerID"]; $ServerName = $serverInfo["ServerName"]; foreach ($tableArray as $key => $value) { if (!$key) { echo ""; continue; } $tdContent = $serverInfo[$key]; if ($key == "ServerID") { $tdContent = "s" . $tdContent; } else if ($key == "ClearState") { if ($tdContent == 1) { $tdContent = "已同步"; } else { $tdContent = "未处理"; } } else if ($key == "Statue") { $statue = $tdContent; $statueName = \ServerOPS\ServerStatue::$StatueName[$statue]; if ($statue != \ServerOPS\ServerStatue::Open) { $tdContent = "" . $statueName . ""; } else { $tdContent = $statueName; } } else if ($key == "RunningStatus") { $runningStatus = $tdContent; $runningStatusName = \ServerOPS\ServerRunningStatus::$RunningStatusName[$runningStatus]; if ($runningStatus == \ServerOPS\ServerRunningStatus::PreOpen || $runningStatus == \ServerOPS\ServerRunningStatus::Upkeep) { $tdContent = "" . $runningStatusName . ""; } else { $tdContent = $runningStatusName; } } else if ($key == "Recommend") { $tdContent = $tdContent == 1 ? "是" : "否"; } elseif ($key == "JsonBranch") { $tdContent = \ServerOPS\GetCommonServerlistJsonFileName($channel, $tdContent); } elseif ($key == "StartDate") { $OpenServerWay = $serverInfo["OpenServerWay"]; $RelationServerID = $serverInfo["RelationServerID"]; $RelationCreateRoles = $serverInfo["RelationCreateRoles"]; if ($OpenServerWay == 1 && $RelationServerID && $RelationCreateRoles && !$serverInfo["ClearState"]) { $tdContent = "指定服:" . $RelationServerID . " 创角:" . $RelationCreateRoles; } else { $tdContent = $tdContent; } } echo ""; } echo ""; } ?>
服务器数: " . count($serverList) . "/" . $totalCount . "
" . $value[0] . ""; } echo "
"; echo " "; echo "  "; echo "" . $tdContent . "