<?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.packBranch.php");
|
|
function PackBranchEdit($opType)
|
{
|
global $alertMsg;
|
// echo "_POST: ", print_r($_POST, true), "<br/>";
|
$channel = $_SESSION['spid'];
|
$BranchNum = intval($_POST["BranchNum"]);
|
|
$find = array(
|
"Channel" => $channel,
|
"BranchNum" => $BranchNum
|
);
|
|
if ($opType == "del") {
|
if (!DBOper\Remove("GamePackBranch", $find)) {
|
$alertMsg = "删除分支失败!";
|
\Logging\LogError($alertMsg . print_r($find, true));
|
return false;
|
}
|
$alertMsg = "删除分支成功!";
|
\Logging\LogInfo($alertMsg . print_r($find, true));
|
return true;
|
}
|
|
$BranchName = $_POST["BranchName"];
|
$NoticeUrl = $_POST["NoticeUrl"];
|
$ResourceUrl = $_POST["ResourceUrl"];
|
$ResourceAwardInfo = $_POST["ResourceAwardInfo"];
|
// $ResourceAwardVer = intval($_POST["ResourceAwardVer"]);
|
$JsonBranch = intval($_POST["JsonBranch"]);
|
$AuditState = intval($_POST["AuditState"]);
|
|
$editArray = array(
|
"Channel" => $channel,
|
"BranchNum" => $BranchNum,
|
"BranchName" => $BranchName,
|
"JsonBranch" => $JsonBranch,
|
"NoticeUrl" => $NoticeUrl,
|
"ResourceUrl" => $ResourceUrl,
|
"ResourceAwardInfo" => $ResourceAwardInfo,
|
"AuditState" => $AuditState,
|
// "ResourceAwardVer" => $ResourceAwardVer,
|
);
|
|
// 添加
|
if ($opType == "add") {
|
DBOper\FindOne("GamePackBranch", $find, $ret);
|
if (count($ret) > 0) {
|
$alertMsg = "该分支已存在,不能重复添加!";
|
\Logging\LogInfo($alertMsg . print_r($editArray, true));
|
return false;
|
}
|
|
if (!DBOper\Insert("GamePackBranch", $editArray, $find)) {
|
$alertMsg = "添加分支失败!";
|
\Logging\LogError($alertMsg . print_r($editArray, true));
|
return false;
|
}
|
|
$alertMsg = "添加分支成功!";
|
\Logging\LogInfo($alertMsg . print_r($editArray, true));
|
}
|
// 更新
|
elseif ($opType == "upd") {
|
$find["BranchNum"] = intval($_POST["SrcBranchNum"]);
|
if (!DBOper\Update("GamePackBranch", $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_OPSPackBranch;
|
$channel = $_SESSION['spid'];
|
$user = new \User\User($_SESSION['UserAccount']);
|
if (!$user->HavePermission($Permission)) {
|
exit;
|
}
|
|
if ($_POST["opType"]) {
|
PackBranchEdit($_POST["opType"]);
|
}
|
|
DBOper\Find("GamePackBranch", array("Channel" => $channel), $branchArray);
|
// $branchCount = $branchArray ? count($branchArray) : 0;
|
|
//显示表格字段配置 key-参数名,value-说明
|
$tableArray = array(
|
"BranchNum" => array("分支编号", "5%", "center"),
|
"BranchName" => array("名称", "5%", "center"),
|
"JsonBranch" => array("选服Json分支文件", "13%", "center"),
|
"ResourceAwardInfo" => array("资源下载奖励信息", "9%", "center"),
|
// "ResourceAwardVer" => array("奖励版本号", "6%", "center"),
|
"ResourceUrl" => array("资源地址", "28%", "center"),
|
"NoticeUrl" => array("公告地址", "28%", "center"),
|
"AuditState" => array("审核状态", "5%", "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>
|
|
<input type="button" value="添加分支" onclick="window.location.href='packBranchEdit.php?opType=add'" />
|
注:打包分支对应的选服、资源、公告等为默认值,即如果对应版本不存在或版本状态不存在则读该打包分支下配置的默认信息;
|
<hr />
|
<table width="100%">
|
<?php
|
if ($branchArray) {
|
echo "<thead><tr>";
|
foreach ($tableArray as $value) {
|
echo "<th width=\"" . $value[1] . "\">" . $value[0] . "</td>";
|
}
|
echo "</tr></thead>";
|
foreach ($branchArray as $branchInfo) {
|
echo "<tr class='trc'>";
|
$BranchNum = $branchInfo["BranchNum"];
|
$BranchName = $branchInfo["BranchName"];
|
foreach ($tableArray as $key => $value) {
|
if (!$key) {
|
echo "<td align='center'>";
|
echo " <input type=\"button\" value=\"改\" onclick=\"window.location.href='packBranchEdit.php?opType=upd&BranchNum=$BranchNum'\" />";
|
echo " <input type=\"button\" value=\"删\" onclick=\"return suredel('$channel', '$BranchNum', '$BranchName')\"/> ";
|
echo "</td>";
|
continue;
|
}
|
$tdContent = $branchInfo[$key];
|
if ($key == "JsonBranch") {
|
$tdContent = \ServerOPS\GetCommonServerlistJsonFileName($channel, $tdContent);
|
} elseif ($key == "AuditState") {
|
$tdContent = ($tdContent == 1) ? "是" : "否";
|
}
|
echo "<td align='" . $value[2] . "' width=\"100\">" . $tdContent . "</td>";
|
}
|
echo "</tr>";
|
}
|
} else {
|
echo "无分支,请添加分支!<br/>";
|
}
|
?>
|
</table>
|
|
<script type='text/javascript' src="/js/common.js"></script>
|
<script type="text/javascript">
|
function suredel(Channel, BranchNum, BranchName) {
|
if (!window.confirm("确定删除" + Channel + "分支: " + BranchName + " (" + BranchNum + ") ?")) {
|
return false;
|
}
|
doSubmit("packBranch.php", {
|
"opType": "del",
|
"BranchNum": BranchNum,
|
}, 'post');
|
return true;
|
}
|
</script>
|
</body>
|
|
</html>
|