hxp
2025-06-09 6c3f6335c70859ded94a1ad8d218acb0ac34239c
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
<?php
include_once "/language/lang.php";
include_once "/Common/CommFunc.php";
include_once "/Common/Logging.php";
include_once "/Account/User.php";
 
\Logging\CreateLogging("GMT_CompensationQuery.php");
 
\CommFunc\SessionStart();
$Permission = \User\Permission::P_ServerMailMgr;
$spid = $_SESSION['spid'];
$user = new \User\User($_SESSION['UserAccount']);
if (!$user->HavePermission($Permission)) {
    exit;
}
 
$serversArray = $user->GetServers();
 
$mailNameArray = CommFunc\getCfgKeyNameContent("mail", true, $spid);
$itemNameArray = CommFunc\getCfgKeyNameContent("item", true, $spid);
$moneyTypeArray = CommFunc\getCfgKeyNameContent("money", true, $spid);
$mailtypes = CommFunc\GetMailTypes();
 
//------------------------------------------
 
//显示表格字段配置 key-参数名,value-说明
$tableArray = array(
    "Num" => \Lang\gettext("编号"),
    "CheckState" => \Lang\gettext("状态"),
    "MailType" => \Lang\gettext("类型"),
    "Title" => \Lang\gettext("标题"),
    "LimitLV" => \Lang\gettext("限制等级"),
    "LimitLVType" => \Lang\gettext("升级可领"),
    "Gold" => $moneyTypeArray["1"],
    "GoldPaper" => $moneyTypeArray["2"],
    "Silver" => $moneyTypeArray["3"],
    "PlayerJob" => \Lang\gettext("职业"),
    "ItemList" => \Lang\gettext("物品"),
    "Content" => \Lang\gettext("内容"),
    "GUID" => \Lang\gettext("GUID"),
    "CreateTime" => \Lang\gettext("发送时间"),
    "LimitTime" => \Lang\gettext("到期时间"),
    "Sender" => \Lang\gettext("发送人"),
    "OnlyServerID" => \Lang\gettext("是否单服邮件")
);
 
// 获取字段对应内容
function GetContent($mailDict, $keyName, $mailNameArray, $itemNameArray)
{
    global $mailtypes;
    $c = $mailDict[$keyName];
    if ($keyName == "CheckState") {
        if ($c == "0") {
            return \Lang\gettext("通过");
        }
        return "<font color='red'>" . \Lang\gettext("未审") . "</font>";
    } elseif ($keyName == "LimitLVType") {
        if ($c == "0") {
            return \Lang\gettext("否");
        }
        return \Lang\gettext("是");
    } elseif ($keyName == "ItemList") {
        if (count($c) == 0) {
            return \Lang\gettext("无");
        }
        $itemInfo = "";
        foreach ($c as $item) {
            $itemID = "" . $item[0];
            $itemCount = $item[1];
            if (array_key_exists($itemID, $itemNameArray)) {
                $itemInfo .= $itemNameArray[$itemID] . "(" . $itemID . ")";
            } else {
                $itemInfo .= "<font color='red'>" . \Lang\gettext("未知物品ID") . "(" . $itemID . ")</font>";
            }
            $itemInfo .= " x" . $itemCount . \Lang\gettext("个") . "<br/><br/>";
        }
        return $itemInfo;
    } elseif ($keyName == "MailType") {
        return $mailtypes["" . $c] . "(" . $c . ")";
    }
    return $mailDict[$keyName];
}
 
$resultInfo = $_POST;
 
$resultList = $resultInfo["ResultMsg"];
 
$retCount = count($resultList);
 
?>
 
<!DOCTYPE html>
<html>
 
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title><?php echo \Lang\gettext("全服邮件管理"); ?></title>
</head>
 
<body>
    <form id="CompensationMgr" name="CompensationMgr" action="/Common/GMCmdProcess.php" method="post">
        <br />
        <hr />
        <?php echo \Lang\gettext("返回条数"); ?>: <?php echo $retCount; ?><br /><br />
        <table id="tt" class="border-table">
            <?php
            echo "<tr>";
            foreach ($tableArray as $key => $value) {
                echo "<td align='center'>" . $value . "</td>";
            }
            echo "</tr>";
 
            for ($i = 0; $i < $retCount; $i++) {
                $mailDict = $resultList[$i];
                $num = $i + 1;
                echo "<tr>";
                echo "<td align='center'><input name='checkbox" . $i . "' id='checkbox" . $i . "' type='checkbox' />" . $num . "&nbsp;</td>";
                foreach ($tableArray as $key => $value) {
                    if ($key == "Num") {
                        continue;
                    }
 
                    $widgetName = "lab" . $key . $i;
                    $tdContent = GetContent($mailDict, $key, $mailNameArray, $itemNameArray);
                    $tdContent = '<label name="' . $widgetName . '" id="' . $widgetName . '"/>' . $tdContent . '</label>';
                    if ($key == "Title" || $key == "Content" || $key == "ItemList") {
                        $align = "left";
                    } else {
                        $align = "center";
                    }
                    echo "<td align='" . $align . "'>" . $tdContent . "</td>";
                }
                echo "</tr>";
            }
            ?>
        </table>
        <hr />
 
        <input type="hidden" name="GUIDInfo" id="GUIDInfo" value="" />
        <?php echo \Lang\gettext("选中邮件操作"); ?>:
        <input type="radio" name="operation" id="operation" value="1" /><label name="operation1" id="operation1"><?php echo \Lang\gettext("通过"); ?></label>
        <input type="radio" name="operation" id="operation" value="2" /><label name="operation2" id="operation2"><?php echo \Lang\gettext("删除"); ?></label>
 
        <input type="hidden" name="Permission" value="<?php echo $Permission; ?>" />
        <input type="hidden" name="pack_type" value="GMT_CompensationMgr" />
        <p>
            <?php
            if ($user->NeedCheckKey()) {
                echo \Lang\gettext("授权码(key)") . ":";
                echo "<input type=\"text\" name=\"key\" id=\"key\" />";
            } else {
                echo "<input type=\"hidden\" name=\"key\" id=\"key\" />";
            }
            ?>
        </p>
        <?php
        include_once "/Common/SelectServer.php";
        ?>
        <center>
            <p>
                <input type="submit" name="submit" align="center" value="<?php echo \Lang\gettext("提交"); ?>" onclick="return CheckSubmit(<?php echo $retCount; ?>)" />
            </P>
        </center>
        <hr>
    </form>
    <script src="/Common/selectserver.js"></script>
    <script>
        //浏览器类型判定
        function getOs() {
            if (navigator.userAgent.indexOf("MSIE") > 0) {
                return "IE"; //InternetExplor
            } else if (isFirefox = navigator.userAgent.indexOf("Firefox") > 0) {
                return "FF"; //firefox
            } else if (isSafari = navigator.userAgent.indexOf("Safari") > 0) {
                return "SF"; //Safari
            } else if (isCamino = navigator.userAgent.indexOf("Camino") > 0) {
                return "C"; //Camino
            } else if (isMozilla = navigator.userAgent.indexOf("Gecko/") > 0) {
                return "G"; //Gecko
            } else if (isMozilla = navigator.userAgent.indexOf("Opera") >= 0) {
                return "O"; //opera
            } else {
                return 'Other';
            }
        }
 
        //获取换行符
        function getbr() {
            var os = getOs();
            if (os == 'FF' || os == 'SF') { //FireFox、谷歌浏览器用这个
                return "\n";
            } else { //IE系列用这个
                return "\r\n";
            }
        }
 
        function CheckSubmit(rCount) {
            var br = getbr();
            var checkInfo = "";
            //每次重新提交表单要重置该值,不然单次操作中多次确认提交会产生多余数据
            document.getElementById("GUIDInfo").value = "";
            for (var i = 0; i < rCount; i++) {
                if (!document.getElementById("checkbox" + i).checked) {
                    continue;
                }
 
                var guid = document.getElementById("labGUID" + i).innerText;
                var title = document.getElementById("labTitle" + i).innerText;
 
                checkInfo = checkInfo + "<?php echo \Lang\gettext("编号"); ?>" + (i + 1) + "." + title + "(" + guid + ")" + br + br;
 
                var GUIDInfo = document.getElementById("GUIDInfo").value;
                if (GUIDInfo) {
                    GUIDInfo += ",";
                }
                GUIDInfo += guid;
                document.getElementById("GUIDInfo").value = GUIDInfo;
            }
            // alert("GUIDInfo: " + document.getElementById("GUIDInfo").value);
            if (checkInfo == "") {
                alert("<?php echo \Lang\gettext("没有选中邮件"); ?>");
                return false;
            }
 
            // 列表的不能用 getElementById
            var operation = document.getElementsByName("operation")
            var operText = "";
            for (var i = 0; i < operation.length; i++) {
                if (operation[i].checked) {
                    operText = document.getElementById("operation" + (i + 1)).innerText;
                    break;
                }
            }
 
            if (operText == "") {
                alert("<?php echo \Lang\gettext("没有选择操作类型"); ?>");
                return false;
            }
 
            if (!window.confirm("<?php echo \Lang\gettext("以下邮件确定执行该操作吗"); ?>" + "?【" + operText + "】" + br + br + checkInfo)) {
                return false;
            }
 
            if (document.getElementById("key").type != "hidden" && !document.getElementById("key").value) {
                alert("<?php echo \Lang\gettext("请输入授权码!"); ?>");
                return false;
            }
 
            return true;
        }
    </script>
 
    <style type="text/css">
        .border-table {
            border-collapse: collapse;
            border: none;
            font-size: 13px;
        }
 
        .border-table td {
            border: solid #000 1px;
        }
    </style>
</body>
 
</html>