"; \Logging\LogInfo("_POST: " . print_r($_POST, true)); $channel = $_SESSION['spid']; $BranchNum = intval($_POST["BranchNum"]); $Version = $_POST["Version"]; $VersionState = intval($_POST["VersionState"]); $ForceDownUrl = $_POST["ForceDownUrl"]; $find = array( "Channel" => $channel, "BranchNum" => $BranchNum, "Version" => $Version ); if ($opType == "del") { if (!DBOper\Remove("GameVersion", $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, "BranchNum" => $BranchNum, "Version" => $Version, "VersionState" => $VersionState, "ForceDownUrl" => $ForceDownUrl, "UpdateTime" => date("Y-m-d H:i:s") ); // 更新 if ($opType == "upd") { $SrcVersion = $_POST["SrcVersion"]; if ($Version != $SrcVersion) { \Logging\LogInfo("版本号修改,需要验证修改后版本是否存在及先删除旧版本: SrcVersion=" . $SrcVersion . " => " . $Version); DBOper\FindOne("GameVersion", $find, $ret, null, false); if (count($ret) > 0) { $alertMsg = "不能修改为已存在的内容版本!"; \Logging\LogInfo($alertMsg . " find=" . print_r($find, true)); return false; } $removeFind = array( "Channel" => $channel, "BranchNum" => $BranchNum, "Version" => $SrcVersion ); if (!DBOper\Remove("GameVersion", $removeFind)) { $alertMsg = "删除旧版本失败,无法更新新版本号!"; \Logging\LogError($alertMsg . print_r($removeFind, true)); return false; } \Logging\LogInfo("删除旧版本成功 removeFind=" . print_r($removeFind, true)); $editArray["VersionTime"] = date("Y-m-d H:i:s"); } if (!DBOper\Update("GameVersion", $find, $editArray, true, true)) { $alertMsg = "更新内容版本失败!"; \Logging\LogError($alertMsg . " find=" . print_r($find, true) . " set=" . print_r($editArray, true)); return false; } $alertMsg = "更新内容版本成功!"; \Logging\LogInfo($alertMsg . " find=" . print_r($find, true) . " set=" . print_r($editArray, true)); } // 添加 else if ($opType == "add") { DBOper\FindOne("GameVersion", $find, $ret); if (count($ret) > 0) { $alertMsg = "该内容版本已存在,不能重复添加!"; \Logging\LogInfo($alertMsg . " find=" . print_r($find, true)); return false; } $editArray["VersionTime"] = date("Y-m-d H:i:s"); if (!DBOper\Insert("GameVersion", $editArray, $find)) { $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_OPSGameVersion; $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"]); GameVersionEdit($_POST["opType"]); } $BranchName = $branchNameInfo[$BranchNum]; // 版本状态 $stateNameInfo = array(); DBOper\Find( "GameVersionState", array("Channel" => $channel, "BranchNum" => $BranchNum), $versionStateArray ); foreach ($versionStateArray as $stateInfo) { $stateNameInfo[$stateInfo["VersionState"]] = $stateInfo["StateName"]; } DBOper\Find( "GameVersion", array("Channel" => $channel, "BranchNum" => $BranchNum), $versionArray, null, array("VersionTime" => -1) ); //显示表格字段配置 key-参数名,value-说明 $tableArray = array( // "BranchNum" => array("分支", "5%", "center"), // "BranchName" => array("名称", "7%", "center"), "Version" => array("游戏版本", "7%", "center"), "VsersionState" => array("版本状态", "5%", "center"), "VersionTime" => array("版本时间", "12%", "center"), "UpdateTime" => array("修改时间", "12%", "center"), "ForceDownUrl" => array("强更下载地址", "40%", "center"), "" => array("操作", "", "center"), ); if ($alertMsg) { echo ""; } ?>
内容版本管理