1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<?php
include_once "/Common/Logging.php";
include_once "/Account/User.php";
include_once "/db/DBOper.php";
include_once "/Common/CommFunc.php";
include_once "/language/lang.php";
 
\Logging\CreateLogging("serverops.versionlog.php");
 
function VersionInfoEdit($opType)
{
    global $alertMsg;
    // echo "_POST: ", print_r($_POST, true), "<br/>";
    $channel = $_SESSION['spid'];
    $VerNum = $_POST["VerNum"];
    $VerTitle = $_POST["VerTitle"];
    $VerDetail = $_POST["VerDetail"];
 
    $UpdDate = $_POST["UpdDate"];
    $UpdHour = $_POST["UpdHour"];
    $UpdMinute = $_POST["UpdMinute"];
    $UpdSecond = $_POST["UpdSecond"];
 
    $UpdTime = $UpdDate . " " . $UpdHour . ":" . $UpdMinute . ":" . $UpdSecond;
 
    $find = array(
        "Channel" => $channel,
        "VerNum" => $VerNum
    );
    if ($opType == "del") {
        if (!DBOper\Remove("Versionlog", $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,
        "UpdTime" => $UpdTime,
        "VerNum" => $VerNum,
        "VerTitle" => $VerTitle,
        "VerDetail" => $VerDetail,
    );
    $opName = $opType == "add" ? "添加" : "修改";
    if (!DBOper\Update("Versionlog", $find, $editArray, false, true)) {
        $alertMsg = $opName . "版本失败!";
        \Logging\LogError($alertMsg . " find=" . json_encode($find) . " set=" . json_encode($editArray));
        return false;
    }
    $alertMsg = $opName . "版本成功!";
    \Logging\LogInfo($alertMsg . " find=" . json_encode($find) . " set=" . json_encode($editArray));
    return true;
}
 
$Permission = \User\Permission::P_VersionLog;
$channel = $_SESSION['spid'];
$user = new \User\User($_SESSION['UserAccount']);
if (!$user->HavePermission($Permission)) {
    exit;
}
// echo "_POST:" . print_r($_POST, true) . "<br/>";
 
if ($_POST["opType"]) {
    if (VersionInfoEdit($_POST["opType"])) {
    }
    if ($alertMsg) {
        echo "<script>alert('" . $alertMsg . "')</script>";
    }
}
 
\DBOper\Find("Versionlog", array("Channel" => $channel), $versions, null, array("UpdTime" => -1), 100);
 
?>
 
<html>
 
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>版本更新日志</title>
    <link rel="stylesheet" type="text/css" href="/css/tableform.css">
</head>
 
<body>
    <center>
        <p><b>版本更新日志</b></P>
    </center>
 
    <input type="button" value="添加版本" onclick="window.location.href='versionEdit.php?opType=add'" />
    <hr />
    <?php
    if (isset($versions) && count($versions)) {
        $itemHtml = "<ul>";
        $detalHtml = "";
        $index = 0;
        foreach ($versions as $vInfo) {
            $VerNum = $vInfo["VerNum"];
            $UpdTime = $vInfo["UpdTime"];
            $VerTitle = $vInfo["VerTitle"];
            $VerDetail = $vInfo["VerDetail"];
 
            // 项目目录
            $itemName = $VerNum . " (" . $UpdTime . ") " . $VerTitle;
            $itemHtml .= '<li><a href="#' . $VerNum . '" id="I' . $VerNum . '">' . $itemName . '</a></li>';
 
            // 明细
            $detalHtml .= '<hr/>';
            $detalHtml .= '<a href="#I' . $VerNum . '" id="' . $VerNum . '"><font style="font-size: 25px;"><b>' . $itemName . '</b></font></a>';
            if ($index == 0) { // 仅最近一个可修改
                $detalHtml .= '    <a href="versionEdit.php?VerNum=' . $VerNum . '">修改</a>';
            }
            $detalHtml .= '<br/>';
            $detalHtml .= $vInfo["VerDetail"] . '<br/>';
            $index++;
        }
        $itemHtml . "</ul>";
 
        echo "版本记录<p/>";
        echo $itemHtml;
        echo "<br/><br/><br/>";
        echo $detalHtml;
    } else {
        echo "没有版本更新日志";
    }
    ?>
    <hr />
</body>
 
</html>