<?php
|
include_once "/Common/Logging.php";
|
include_once "/Account/User.php";
|
include_once "/db/DBOper.php";
|
include_once "/Common/ServerOPS.php";
|
include_once "/Common/CommFunc.php";
|
include_once "/language/lang.php";
|
|
\Logging\CreateLogging("serverops.versionState.php");
|
|
function VersionStateEdit($opType)
|
{
|
global $alertMsg;
|
// echo "_POST: ", print_r($_POST, true), "<br/>";
|
$channel = $_SESSION['spid'];
|
$BranchNum = intval($_POST["BranchNum"]);
|
$VersionState = intval($_POST["VersionState"]);
|
|
$find = array(
|
"Channel" => $channel,
|
"BranchNum" => $BranchNum,
|
"VersionState" => $VersionState,
|
);
|
|
if ($opType == "del") {
|
if (!DBOper\Remove("GameVersionState", $find)) {
|
$alertMsg = "删除失败!";
|
\Logging\LogError($alertMsg . print_r($find, true));
|
return false;
|
}
|
$alertMsg = "删除成功!";
|
\Logging\LogInfo($alertMsg . print_r($find, true));
|
return true;
|
}
|
|
$StateName = $_POST["StateName"];
|
$JsonBranch = intval($_POST["JsonBranch"]);
|
$NoticeUrl = $_POST["NoticeUrl"];
|
$ResourceUrl = $_POST["ResourceUrl"];
|
$ResourceAwardInfo = $_POST["ResourceAwardInfo"];
|
$IsDefault = intval($_POST["IsDefault"]);
|
|
$editArray = array(
|
"Channel" => $channel,
|
"BranchNum" => $BranchNum,
|
"VersionState" => $VersionState,
|
"StateName" => $StateName,
|
"JsonBranch" => $JsonBranch,
|
"NoticeUrl" => $NoticeUrl,
|
"ResourceUrl" => $ResourceUrl,
|
"ResourceAwardInfo" => $ResourceAwardInfo,
|
);
|
|
// 添加
|
if ($opType == "add") {
|
DBOper\FindOne("GameVersionState", $find, $ret);
|
if (count($ret) > 0) {
|
$alertMsg = "该版本状态已存在,不能重复添加!";
|
\Logging\LogInfo($alertMsg . print_r($editArray, true));
|
return false;
|
}
|
|
if (!DBOper\Insert("GameVersionState", $editArray, $find)) {
|
$alertMsg = "添加版本状态失败!";
|
\Logging\LogError($alertMsg . print_r($editArray, true));
|
return false;
|
}
|
|
$alertMsg = "添加版本状态成功!";
|
\Logging\LogInfo($alertMsg . print_r($editArray, true));
|
}
|
// 更新
|
elseif ($opType == "upd") {
|
$find["VersionState"] = intval($_POST["SrcVersionState"]);
|
if (!DBOper\Update("GameVersionState", $find, $editArray, true)) {
|
$alertMsg = "更新版本状态失败!";
|
\Logging\LogError($alertMsg . print_r($editArray, true));
|
return false;
|
}
|
$alertMsg = "更新版本状态成功!";
|
\Logging\LogInfo($alertMsg . print_r($editArray, true));
|
}
|
return true;
|
}
|
|
$alertMsg = "";
|
$Permission = \User\Permission::P_OPSVersionState;
|
$channel = $_SESSION['spid'];
|
$user = new \User\User($_SESSION['UserAccount']);
|
if (!$user->HavePermission($Permission)) {
|
exit;
|
}
|
|
// 打包分支
|
$BranchNum = 0;
|
$branchNameInfo = array();
|
DBOper\Find(
|
"GamePackBranch",
|
array("Channel" => $channel),
|
$branchArray,
|
array("BranchNum" => 1, "BranchName" => 1)
|
);
|
foreach ($branchArray as $branchInfo) {
|
$branchNameInfo[$branchInfo["BranchNum"]] = $branchInfo["BranchName"];
|
if ($BranchNum == 0) {
|
$BranchNum = $branchInfo["BranchNum"];
|
}
|
}
|
|
if (array_key_exists("BranchNum", $_POST)) {
|
$BranchNum = intval($_POST["BranchNum"]);
|
VersionStateEdit($_POST["opType"]);
|
}
|
|
// 版本状态
|
DBOper\Find(
|
"GameVersionState",
|
array("Channel" => $channel, "BranchNum" => $BranchNum),
|
$versionStateArray
|
);
|
|
//显示表格字段配置 key-参数名,value-说明
|
$tableArray = array(
|
"VersionState" => array("状态", "5%", "center"),
|
"StateName" => array("状态名", "5%", "center"),
|
"JsonBranch" => array("选服Json分支文件", "13%", "center"),
|
"ResourceAwardInfo" => array("资源下载奖励信息", "9%", "center"),
|
"ResourceUrl" => array("资源地址", "28%", "center"),
|
"NoticeUrl" => array("公告地址", "28%", "center"),
|
"" => array("操作", "", "center"),
|
);
|
|
if ($alertMsg) {
|
echo "<script>alert('" . $alertMsg . "')</script>";
|
}
|
|
?>
|
|
<html>
|
|
<head>
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
<title>版本状态管理</title>
|
<link rel="stylesheet" type="text/css" href="/css/table.css">
|
</head>
|
|
<body>
|
<center>
|
<p><b>版本状态管理</b></P>
|
</center>
|
<form action="" method="post">
|
打包分支:
|
<select name="BranchNum" id="BranchNum" onchange="ChangeBranchNum(this)">
|
<?php
|
foreach ($branchNameInfo as $key => $value) {
|
echo "<option value=\"" . $key . "\"";
|
if ($BranchNum == $key) {
|
echo " selected";
|
}
|
echo ">" . $value . "</option>";
|
}
|
?>
|
</select>
|
|
<input type="button" value="添加版本状态" onclick="window.location.href='versionStateEdit.php?opType=add&BranchNum=<?php echo $BranchNum ?>'" />
|
</form>
|
<hr />
|
<?php
|
if ($versionStateArray) {
|
echo '<table width="100%">';
|
echo "<thead><tr>";
|
foreach ($tableArray as $value) {
|
echo "<th width=\"" . $value[1] . "\">" . $value[0] . "</td>";
|
}
|
echo "</tr></thead>";
|
foreach ($versionStateArray as $stateInfo) {
|
echo "<tr class='trc'>";
|
$BranchNum = $stateInfo["BranchNum"];
|
$VersionState = $stateInfo["VersionState"];
|
$StateName = $stateInfo["StateName"];
|
foreach ($tableArray as $key => $value) {
|
if (!$key) {
|
echo "<td align='center'>";
|
echo " <input type=\"button\" value=\"改\" onclick=\"window.location.href='versionStateEdit.php?" .
|
"opType=upd&BranchNum=$BranchNum&VersionState=$VersionState'\" />";
|
echo " <input type=\"button\" value=\"删\" onclick=\"return suredel('$channel', '$BranchNum', '$VersionState', '$StateName')\"/> ";
|
echo "</td>";
|
continue;
|
}
|
$tdContent = $stateInfo[$key];
|
if ($key == "JsonBranch") {
|
$tdContent = \ServerOPS\GetCommonServerlistJsonFileName($channel, $tdContent);
|
}
|
echo "<td align='" . $value[2] . "' width=\"100\">" . $tdContent . "</td>";
|
}
|
echo "</tr>";
|
}
|
echo "</table>";
|
} else {
|
echo "无版本状态,请添加状态!<br/>";
|
}
|
?>
|
|
<script type='text/javascript' src="/js/common.js"></script>
|
<script type="text/javascript">
|
function ChangeBranchNum(obj) {
|
document.forms[0].submit();
|
}
|
|
function suredel(Channel, BranchNum, VersionState, StateName) {
|
if (!window.confirm("确定删除" + Channel + "分支: " + BranchNum + " 版本状态:" + VersionState + "(" + StateName + ") ?")) {
|
return false;
|
}
|
doSubmit("", {
|
"opType": "del",
|
"BranchNum": BranchNum,
|
"VersionState": VersionState,
|
}, 'post');
|
return true;
|
}
|
</script>
|
</body>
|
|
</html>
|