10310 【后台】修复游戏内容版本号反复删除修改可能导致后续修改版本失败bug;
2个文件已修改
53 ■■■■ 已修改文件
serverops/gameVersion.php 51 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
serverops/gameVersionEdit.php 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
serverops/gameVersion.php
@@ -11,6 +11,7 @@
{
    global $alertMsg;
    // echo "_POST: ", print_r($_POST, true), "<br/>";
    \Logging\LogInfo("_POST: " . print_r($_POST, true));
    $channel = $_SESSION['spid'];
    $BranchNum = intval($_POST["BranchNum"]);
    $Version = $_POST["Version"];
@@ -42,8 +43,44 @@
        "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));
    }
    // 添加
    if ($opType == "add") {
    else if ($opType == "add") {
        DBOper\FindOne("GameVersion", $find, $ret);
        if (count($ret) > 0) {
            $alertMsg = "该内容版本已存在,不能重复添加!";
@@ -59,18 +96,6 @@
        $alertMsg = "添加内容版本成功!";
        \Logging\LogInfo($alertMsg . print_r($editArray, true));
    }
    // 更新
    elseif ($opType == "upd") {
        $find["Version"] = $_POST["SrcVersion"];
        if (!DBOper\Update("GameVersion", $find, $editArray, 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));
    }
    return true;
}
serverops/gameVersionEdit.php
@@ -24,7 +24,7 @@
if ($opType == "upd") {
    $pageTitle = "内容版本 - 编辑";
    $find = array("Channel" => $channel, "BranchNum" => $BranchNum, "Version" => $Version);
    DBOper\FindOne("GameVersion", $find, $editInfo);
    DBOper\FindOne("GameVersion", $find, $editInfo, null, false);
}
$stateNameInfo = array();