| <?php | 
| include_once "/Account/User.php"; | 
| include_once "/db/DBOper.php"; | 
| include_once "/Common/Logging.php"; | 
| include_once "/Common/ServerOPS.php"; | 
| include_once "/Common/CommFunc.php"; | 
| include_once "/language/lang.php"; | 
|   | 
| \Logging\CreateLogging("serverops.serverEdit.php"); | 
|   | 
| $Permission = \User\Permission::P_OPSServerList; | 
| $channel = $_SESSION['spid']; | 
| $user = new \User\User($_SESSION['UserAccount']); | 
| if (!$user->HavePermission($Permission)) { | 
|     exit; | 
| } | 
| $ServerID = intval($_GET["ServerID"]); | 
|   | 
| $opType = $_GET["opType"]; | 
|   | 
| $editInfo = array(); | 
| $pageTitle = "服务器 - 添加"; | 
| if ($opType == "upd") { | 
|     $pageTitle = "服务器 - 编辑"; | 
|     DBOper\FindOne("GameServers", array("Channel" => $channel, "ServerID" => $ServerID), $editInfo, null, false); | 
| } else { | 
|     $editInfo = $_GET; | 
| } | 
|   | 
| // echo "_GET:" . print_r($_GET, true); | 
| // echo "editInfo:" . print_r($editInfo, true); | 
|   | 
| ?> | 
|   | 
| <html> | 
|   | 
| <head> | 
|     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | 
|     <title><?php echo $pageTitle; ?></title> | 
|     <link rel="stylesheet" type="text/css" href="/css/tableform.css"> | 
| </head> | 
|   | 
| <body> | 
|     <center> | 
|         <p><b><?php echo $pageTitle; ?></b></P> | 
|     </center> | 
|     <hr /> | 
|   | 
|     <form action="serverlist.php" method="post"> | 
|         <table id="tt" class="formTable"> | 
|             <tr> | 
|                 <td class="formTableTDName">渠道: </td> | 
|                 <td class="formTableTDValue"> | 
|                     <?php echo $channel; ?> | 
|                 </td> | 
|             </tr> | 
|             <tr> | 
|                 <td class="formTableTDName">区服ID: </td> | 
|                 <td class="formTableTDValue"> | 
|                     <input type="number" name="ServerID" id="ServerID" value="<?php echo array_key_exists("ServerID", $editInfo)  ? $editInfo["ServerID"] : "" ?>" placeholder="大于0的值" <?php echo $opType == "upd" ? "readonly" : "" ?> /> | 
|                 </td> | 
|             </tr> | 
|             <tr> | 
|                 <td class="formTableTDName">区服名称: </td> | 
|                 <td class="formTableTDValue"> | 
|                     <input type="text" name="ServerName" id="ServerName" value="<?php echo array_key_exists("ServerName", $editInfo)  ? $editInfo["ServerName"] : "" ?>" /> | 
|                 </td> | 
|             </tr> | 
|             <tr> | 
|                 <td class="formTableTDName">Json分支: </td> | 
|                 <td class="formTableTDValue"> | 
|                     <input type="number" name="JsonBranch" id="JsonBranch" value="<?php echo array_key_exists("JsonBranch", $editInfo)  ? $editInfo["JsonBranch"] : "" ?>" placeholder="生成xxx_分支.json" /> | 
|                 </td> | 
|             </tr> | 
|             <tr> | 
|                 <td class="formTableTDName">开服方式: </td> | 
|                 <td class="formTableTDValue"> | 
|                     <select name="OpenServerWay"> | 
|                         <?php | 
|                         $selected = array_key_exists("OpenServerWay", $editInfo)  ? $editInfo["OpenServerWay"] : "0"; | 
|                         foreach (array("0" => "指定时间", "1" => "指定服创角人数") as $key => $value) { | 
|                             echo "<option value='" . $key . "'"; | 
|                             if ($key == $selected) { | 
|                                 echo " selected"; | 
|                             } | 
|                             echo ">" . $value . "</option>"; | 
|                         } | 
|                         ?> | 
|                     </select> | 
|                 </td> | 
|             </tr> | 
|             <tr> | 
|                 <td class="formTableTDName">开服时间: </td> | 
|                 <td class="formTableTDValue"> | 
|                     <?php | 
|                     $startDateStr = array_key_exists("StartDate", $editInfo)  ? $editInfo["StartDate"] : ""; | 
|                     \CommFunc\EchoDateTimeSelect("StartDate", "StartHour", "StartMinute", "StartSecond", $startDateStr, null, null, array(0)); | 
|                     ?> | 
|                 </td> | 
|             </tr> | 
|             <tr> | 
|                 <td class="formTableTDName">指定服: </td> | 
|                 <td class="formTableTDValue"> | 
|                     <input type="number" name="RelationServerID" id="RelationServerID" value="<?php echo array_key_exists("RelationServerID", $editInfo)  ? $editInfo["RelationServerID"] : 0 ?>" /> | 
|                     创角人数: | 
|                     <input type="number" name="RelationCreateRoles" id="RelationCreateRoles" value="<?php echo array_key_exists("RelationCreateRoles", $editInfo)  ? $editInfo["RelationCreateRoles"] : 0 ?>" /> | 
|                 </td> | 
|             </tr> | 
|             <tr> | 
|                 <td class="formTableTDName"> | 
|                     <span title="默认开服前15分钟清档
清档前15分钟开始同步设置清档时间
0点~0点15分开服的默认0点清档
如果设置已同步则不会再同步清档时间"> | 
|                         清档状态 | 
|                     </span>: | 
|                 </td> | 
|                 <td class="formTableTDValue"> | 
|                     <?php | 
|                     $ClearStateName = array(1 => "已同步", 0 => "未处理"); | 
|                     if ($editInfo["ClearState"] == 1) { | 
|                         echo $ClearStateName[$editInfo["ClearState"]]; | 
|                         echo '<input type="hidden" name="ClearState" id="ClearState" value="' . $editInfo["ClearState"] . '" />'; | 
|                     } else { | 
|                         echo '<select name="ClearState">'; | 
|                         $ClearState = array_key_exists("ClearState", $editInfo)  ? $editInfo["ClearState"] : 0; | 
|                         foreach ($ClearStateName as $key => $value) { | 
|                             echo "<option value='" . $key . "'"; | 
|                             if ($key == $ClearState) { | 
|                                 echo " selected"; | 
|                             } | 
|                             echo ">" . $value . "</option>"; | 
|                         } | 
|                         echo '</select>'; | 
|                     } | 
|                     ?> | 
|                 </td> | 
|             </tr> | 
|             <tr> | 
|                 <td class="formTableTDName">开放状态: </td> | 
|                 <td class="formTableTDValue"> | 
|                     <select name="Statue"> | 
|                         <?php | 
|                         $selected = array_key_exists("Statue", $editInfo)  ? $editInfo["Statue"] : \ServerOPS\ServerStatue::InternalOpen; | 
|                         foreach (\ServerOPS\ServerStatue::$StatueName as $key => $value) { | 
|                             echo "<option value='" . $key . "'"; | 
|                             if ($key == $selected) { | 
|                                 echo " selected"; | 
|                             } | 
|                             echo ">" . $value . "</option>"; | 
|                         } | 
|                         ?> | 
|                     </select> | 
|                 </td> | 
|             </tr> | 
|             <tr> | 
|                 <td class="formTableTDName">运行状态: </td> | 
|                 <td class="formTableTDValue"> | 
|                     <select name="RunningStatus"> | 
|                         <?php | 
|                         $selected = array_key_exists("RunningStatus", $editInfo)  ? $editInfo["RunningStatus"] : \ServerOPS\ServerRunningStatus::PreOpen; | 
|                         foreach (\ServerOPS\ServerRunningStatus::$RunningStatusName as $key => $value) { | 
|                             echo "<option value='" . $key . "'"; | 
|                             if ($key == $selected) { | 
|                                 echo " selected"; | 
|                             } | 
|                             echo ">" . $value . "</option>"; | 
|                         } | 
|                         ?> | 
|                     </select> | 
|                 </td> | 
|             </tr> | 
|             <tr> | 
|                 <td class="formTableTDName">推荐: </td> | 
|                 <td class="formTableTDValue"> | 
|                     <select name="Recommend"> | 
|                         <?php | 
|                         $selected = array_key_exists("Recommend", $editInfo)  ? $editInfo["Recommend"] : "1"; | 
|                         foreach (array("1" => "是", "0" => "否") as $key => $value) { | 
|                             echo "<option value='" . $key . "'"; | 
|                             if ($key == $selected) { | 
|                                 echo " selected"; | 
|                             } | 
|                             echo ">" . $value . "</option>"; | 
|                         } | 
|                         ?> | 
|                     </select> | 
|                 </td> | 
|             </tr> | 
|             <tr> | 
|                 <td class="formTableTDName">域名: </td> | 
|                 <td class="formTableTDValue"> | 
|                     <input type="text" name="RegionDomain" id="RegionDomain" value="<?php echo array_key_exists("RegionDomain", $editInfo)  ? $editInfo["RegionDomain"] : "" ?>" size="50" placeholder="不带http" /> | 
|                 </td> | 
|             </tr> | 
|             <tr> | 
|                 <td class="formTableTDName">登录端口: </td> | 
|                 <td class="formTableTDValue"> | 
|                     <input type="number" name="LoginPort" id="LoginPort" value="<?php echo array_key_exists("LoginPort", $editInfo)  ? $editInfo["LoginPort"] : 80 ?>" /> | 
|                 </td> | 
|             </tr> | 
|             <tr> | 
|                 <td class="formTableTDName">游戏端口: </td> | 
|                 <td class="formTableTDValue"> | 
|                     <input type="number" name="GamePort" id="GamePort" value="<?php echo array_key_exists("GamePort", $editInfo)  ? $editInfo["GamePort"] : 19006 ?>" /> | 
|                 </td> | 
|             </tr> | 
|             <tr> | 
|                 <td class="formTableTDName">所属主服: </td> | 
|                 <td class="formTableTDValue"> | 
|                     <input type="number" name="MainServerID" id="MainServerID" value="<?php echo array_key_exists("MainServerID", $editInfo)  ? $editInfo["MainServerID"] : "" ?>" size="50" placeholder="选填,设置合服所属主服" /> | 
|                 </td> | 
|             </tr> | 
|             <?php | 
|             if ($opType == "add" && \CommFunc\IsInnerTest()) { | 
|                 echo "<tr>"; | 
|                 echo "<td class=\"formTableTDName\">内网测试批量插入数: </td>"; | 
|                 echo "<td class=\"formTableTDValue\">"; | 
|                 echo "<input type=\"number\" name=\"InnerTestCount\" id=\"InnerTestCount\" value=\"\" placeholder=\"根据新增区服ID自增插入\" />"; | 
|                 echo "</td>"; | 
|                 echo "</tr>"; | 
|             } | 
|             ?> | 
|             <tr> | 
|                 <td class="formTableTDName"></td> | 
|                 <td class="formTableTDValue"> | 
|                     <input type="submit" name="submit" align="center" value="提交" onclick="return CheckSubmit()" /> | 
|                 </td> | 
|             </tr> | 
|             <input type="hidden" name="opType" id="opType" value="<?php echo $opType ?>" /> | 
|         </table> | 
|     </form> | 
|   | 
|     <script type='text/javascript' src='/js/calendar.js'></script> | 
|     <script type="text/javascript"> | 
|         function CheckSubmit() { | 
|             if (!document.getElementById("ServerID").value || document.getElementById("ServerID").value <= 0) { | 
|                 alert("请输入大于0服务器ID!"); | 
|                 document.getElementById('ServerID').focus(); | 
|                 return false; | 
|             } | 
|             if (!document.getElementById("ServerName").value) { | 
|                 alert("请输入服务器名称!"); | 
|                 document.getElementById('ServerName').focus(); | 
|                 return false; | 
|             } | 
|             if (!document.getElementById("JsonBranch").value || document.getElementById("JsonBranch").value <= 0) { | 
|                 alert("请输入大于0所属Json分支名称!"); | 
|                 document.getElementById('JsonBranch').focus(); | 
|                 return false; | 
|             } | 
|             if (!document.getElementById("StartDate").value) { | 
|                 alert("请输入开服时间!"); | 
|                 document.getElementById('StartDate').focus(); | 
|                 return false; | 
|             } | 
|             var RegionDomain = document.getElementById("RegionDomain").value; | 
|             if (!RegionDomain || RegionDomain.sub(0, 4) == "http") { | 
|                 alert("请输入域名,不带http!"); | 
|                 document.getElementById('RegionDomain').focus(); | 
|                 return false; | 
|             } | 
|             if (!document.getElementById("LoginPort").value || document.getElementById("LoginPort").value <= 0) { | 
|                 alert("请输入大于0登录端口!"); | 
|                 document.getElementById('LoginPort').focus(); | 
|                 return false; | 
|             } | 
|             if (!document.getElementById("GamePort").value || document.getElementById("GamePort").value <= 0) { | 
|                 alert("请输入大于0游戏端口!"); | 
|                 document.getElementById('GamePort').focus(); | 
|                 return false; | 
|             } | 
|             return true; | 
|         } | 
|     </script> | 
| </body> | 
|   | 
| </html> |