hxp
2025-06-04 f4a514d5ac952110da846636ecbb9de951eaf3d2
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
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
<?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.serverlist.php");
 
function ServerInfoEdit($opType)
{
    global $alertMsg;
    // echo "_POST: ", print_r($_POST, true), "<br/>";
    $channel = $_SESSION['spid'];
    $ServerID = intval($_POST["ServerID"]);
    $ServerName = $_POST["ServerName"];
    $JsonBranch = intval($_POST["JsonBranch"]);
    $OpenServerWay = intval($_POST["OpenServerWay"]);
    $RelationServerID = intval($_POST["RelationServerID"]);
    $RelationCreateRoles = intval($_POST["RelationCreateRoles"]);
    $StartDate = $_POST["StartDate"];
    $StartHour = $_POST["StartHour"];
    $StartMinute = $_POST["StartMinute"];
    $StartSecond = $_POST["StartSecond"];
    if ($StartDate) {
        $StartDate .= " " . $StartHour . ":" . $StartMinute . ":" . $StartSecond;
    }
    $ClearState = intval($_POST["ClearState"]);
    $Statue = intval($_POST["Statue"]);
    $RunningStatus = intval($_POST["RunningStatus"]);
    $Recommend = intval($_POST["Recommend"]);
    $RegionDomain = $_POST["RegionDomain"];
    $LoginPort = intval($_POST["LoginPort"]);
    $GamePort = intval($_POST["GamePort"]);
    $MainServerID = intval($_POST["MainServerID"]);
 
    $find = array(
        "Channel" => $channel,
        "ServerID" => $ServerID
    );
    if ($opType == "del") {
        if (!DBOper\Remove("GameServers", $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,
        "ServerID" => $ServerID,
        "ServerName" => $ServerName,
        "JsonBranch" => $JsonBranch,
        "OpenServerWay" => $OpenServerWay,
        "RelationServerID" => $RelationServerID,
        "RelationCreateRoles" => $RelationCreateRoles,
        "StartDate" => $StartDate,
        "ClearState" => $ClearState,
        "Statue" => $Statue,
        "RunningStatus" => $RunningStatus,
        "Recommend" => $Recommend,
        "RegionDomain" => $RegionDomain,
        "LoginPort" => $LoginPort,
        "GamePort" => $GamePort,
        "MainServerID" => $MainServerID,
    );
 
    // 添加
    if ($opType == "add") {
        $editArray["RelationServerOK"] = 0;
        if (\CommFunc\IsInnerTest() && intval($_POST["InnerTestCount"]) > 0) {
            $testCount = intval($_POST["InnerTestCount"]);
            $testServerID = $ServerID;
            $testServerName = $ServerName;
            DBOper\Find("GameServers", array(
                "Channel" => $channel,
                "ServerID" => array('$gte' => $testServerID, '$lt' => ($testServerID +  $testCount))
            ), $existServer, array("ServerID" => 1));
            $existServerIDArray = array();
            foreach ($existServer as $value) {
                array_push($existServerIDArray, $value["ServerID"]);
            }
            \Logging\LogInfo("测试批量插入服务器: testServerID=" . $testServerID . " testCount=" . $testCount);
            // \Logging\LogInfo("已存在的服务器 => " . print_r($existServer, true));
            \Logging\LogInfo("已存在的服务器ID => " . print_r($existServerIDArray, true));
 
            $batchInsArray = array();
            for ($i = 0; $i < $testCount; $i++) {
                $tServerID = $testServerID + $i;
                if (in_array($tServerID, $existServerIDArray)) {
                    \Logging\LogInfo("测试插入服务器已存在: tServerID=" .  $tServerID);
                    continue;
                }
                $insArray = array_merge($editArray);
                $insArray["ServerID"] = $tServerID;
                $insArray["ServerName"] = "s" . $tServerID;
                array_push($batchInsArray, $insArray);
            }
            if (DBOper\BatchInsert("GameServers", $batchInsArray)) {
                $alertMsg = "批量插入测试服务器成功!";
            } else {
                $alertMsg = "批量插入测试服务器失败!";
            }
            // \Logging\LogInfo($alertMsg . print_r($batchInsArray, true));
            return true;
        }
 
        DBOper\FindOne("GameServers", $find, $ret, null, false);
        if (count($ret) > 0) {
            $alertMsg = "该服务器已存在,不能重复添加!";
            \Logging\LogInfo($alertMsg . " find=" . print_r($find, true));
            return false;
        }
        if (!DBOper\Insert("GameServers", $editArray)) {
            $alertMsg = "添加服务器失败!";
            \Logging\LogError($alertMsg . print_r($editArray, true));
            return false;
        }
 
        $alertMsg = "添加服务器成功!";
        \Logging\LogInfo($alertMsg . print_r($editArray, true));
    }
 
    // 更新
    elseif ($opType == "upd") {
        if (!DBOper\Update("GameServers", $find, $editArray)) {
            $alertMsg = "更新服务器失败!";
            \Logging\LogError($alertMsg . " find=" . json_encode($find) . " set=" . json_encode($editArray));
            return false;
        }
        $alertMsg = "更新服务器成功!";
        \Logging\LogInfo($alertMsg . " find=" . json_encode($find) . " set=" . json_encode($editArray));
    }
    return true;
}
 
\Logging\LogInfo("_POST:" . print_r($_POST, true));
$alertMsg = "";
$Permission = \User\Permission::P_OPSServerList;
$channel = $_SESSION['spid'];
$user = new \User\User($_SESSION['UserAccount']);
if (!$user->HavePermission($Permission)) {
    exit;
}
 
if ($_POST["opType"]) {
    if (ServerInfoEdit($_POST["opType"])) {
        \ServerOPS\RefreshServerListIni($channel);
    }
    if ($_POST["opType"] == "add" && $alertMsg) {
        $getParams = "opType=add";
        foreach ($_POST as $key => $value) {
            $getParams .= "&" . $key . "=" . $value;
        }
        $script = "<script>";
        $script .= "if(window.confirm('" . $alertMsg . " 继续添加?')) {window.location.href='serverEdit.php?$getParams';}";
        $script .= "</script>";
        echo $script;
    } else if ($alertMsg) {
        echo "<script>alert('" . $alertMsg . "')</script>";
    }
}
 
$all = "all";
$Statue = array_key_exists("Statue", $_POST) ? $_POST["Statue"] : $all;
$RunningStatus = array_key_exists("RunningStatus", $_POST) ? $_POST["RunningStatus"] : $all;
$Recommend = array_key_exists("Recommend", $_POST) ? $_POST["Recommend"] : $all;
 
// 搜索条件组合 {"Channel":"sohagame", "$or":[{"ServerID":{"$gte":1, "$lte":10}}, {"ServerID":{"$gte":80, "$lte":90}}]}
$find = array("Channel" => $channel);
if ($Statue != $all) {
    $find["Statue"] = intval($Statue);
}
if ($RunningStatus != $all) {
    $find["RunningStatus"] = intval($RunningStatus);
}
if ($Recommend != $all) {
    $find["Recommend"] = intval($Recommend);
}
$serverIDCondArray = array();
$serverIDCondIn = array();
$serverIDCondFind = array();
$serverIDCondNumMax = 20;
for ($i = 1; $i < $serverIDCondNumMax + 1; $i++) {
    if (!array_key_exists("ServerIDGTE" . $i, $_POST)) {
        continue;
    }
    $eValue = intval($_POST["ServerIDE" . $i]);
    $gteValue = intval($_POST["ServerIDGTE" . $i]);
    $lteValue = intval($_POST["ServerIDLTE" . $i]);
    // echo $i, " : ", $gteValue, $lteValue, "<br/>";
    if ($eValue <= 0 && $gteValue <= 0 && $lteValue <= 0) {
        continue;
    }
    if ($gteValue > 0 && $lteValue > 0 && $gteValue > $lteValue) {
        continue;
    }
    $cond = array();
    if ($eValue > 0) {
        array_push($serverIDCondIn, $eValue);
    }
    if ($gteValue > 0) {
        $cond['$gte'] = $gteValue;
    }
    if ($lteValue > 0) {
        $cond['$lte'] = $lteValue;
    }
    array_push($serverIDCondArray, array($eValue, $gteValue, $lteValue));
    array_push($serverIDCondFind, array("ServerID" => $cond));
}
if (count($serverIDCondIn) > 0) {
    array_push($serverIDCondFind, array("ServerID" => array('$in' => $serverIDCondIn)));
}
if (count($serverIDCondFind) > 0) {
    $find['$or'] = $serverIDCondFind;
}
// \Logging\LogInfo("find:" . json_encode($find));
 
$isSearch = true;
if (array_key_exists("submitsearch", $_POST)) {
}
// 设置合服主服
else if (array_key_exists("submitSetMainServerID", $_POST)) {
    $SetMainServerID = intval($_POST["SetMainServerID"]);
    $set = array("MainServerID" => $SetMainServerID);
    if ($_POST["SetMainServerDomain"]) {
        \DBOper\FindOne("GameServers", array("Channel" => $channel, "ServerID" => $SetMainServerID), $mainServerInfo, null, false);
        if (isset($mainServerInfo)) {
            $set = array(
                "MainServerID" => $SetMainServerID,
                "RegionDomain" => $mainServerInfo["RegionDomain"],
                "LoginPort" => $mainServerInfo["LoginPort"],
                "GamePort" => $mainServerInfo["GamePort"]
            );
        }
    }
    if (!\DBOper\Update("GameServers", $find, $set, false, false, true)) {
        $alertMsg = "批量更新合服主服失败!";
        \Logging\LogError($alertMsg . " find=" . json_encode($find) . " set=" . json_encode($set));
    } else {
        $alertMsg = "批量更新合服主服成功!";
        \Logging\LogInfo($alertMsg . " find=" . json_encode($find) . " set=" . json_encode($set));
        \ServerOPS\RefreshServerListIni($channel);
    }
    echo "<script>alert('" . $alertMsg . "')</script>";
}
// 设置状态
else if (array_key_exists("updSelect", $_POST) && $_POST["updSelect"] != "") {
    $set = array();
    $updSelect = $_POST["updSelect"];
    if (substr($updSelect, 0, 6) == "Statue") {
        $set["Statue"] = intval(substr($updSelect, 6));
    } else if (substr($updSelect, 0, 13) == "RunningStatus") {
        $set["RunningStatus"] = intval(substr($updSelect, 13));
    } else if (substr($updSelect, 0, 9) == "Recommend") {
        $set["Recommend"] = intval(substr($updSelect, 9));
    }
    // echo "set: ", json_encode($set), "<br/>";
    if (count($set) > 0) {
        if (!\DBOper\Update("GameServers", $find, $set, false, false, true)) {
            $alertMsg = "批量更新服务器失败!";
            \Logging\LogError($alertMsg . " find=" . json_encode($find) . " set=" . json_encode($set));
        } else {
            $alertMsg = "批量更新服务器成功!";
            \Logging\LogInfo($alertMsg . " find=" . json_encode($find) . " set=" . json_encode($set));
            \ServerOPS\RefreshServerListIni($channel);
        }
        echo "<script>alert('" . $alertMsg . "')</script>";
    }
} else {
    $isSearch = false;
}
 
$pageLimit = 50; # 默认仅展示最近服务器数
if ($isSearch) {
    $pageLimit = 0; # 搜索的直接显示全部,暂不做分页
}
 
\DBOper\Find("GameServers", $find, $serverList, null, array("JsonBranch" => 1, "ServerID" => -1), $pageLimit);
$totalCount = count($serverList);
if (!$isSearch && $totalCount == $pageLimit) {
    $totalCount = \DBOper\Count("GameServers", $find);
}
 
// echo "_POST: ", print_r($_POST, true), "<br/>";
// echo "find: ", json_encode($find), "<br/>";
// echo "allVersionInfo:", print_r($allVersionInfo, true), "<br/>";
// echo "branchNameInfo:", print_r($branchNameInfo, true), "<br/>";
 
//显示表格字段配置 key-参数名,value-说明
$tableArray = array(
    "ServerID" => array("区服", "5%", "center"),
    "ServerName" => array("名称", "10%", "center"),
    "JsonBranch" => array("导出Json分支文件", "14%", "center"),
    "StartDate" => array("开服时间", "11%", "center"),
    "ClearState" => array("清档状态", "5%", "center"),
    "Statue" => array("开放状态", "5%", "center"),
    "RunningStatus" => array("运行状态", "5%", "center"),
    "Recommend" => array("推荐", "3%", "center"),
    "RegionDomain" => array("域名", "19%", "center"),
    "LoginPort" => array("登录端口", "5%", "center"),
    "GamePort" => array("游戏端口", "5%", "center"),
    "MainServerID" => array("所属主服", "5%", "center"),
    "" => array("操作", ""),
);
 
?>
 
<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">
    <link rel="stylesheet" type="text/css" href="/css/button.css">
</head>
 
<body>
    <center>
        <p><b>服务器列表</b></P>
    </center>
 
    <form id="serverlist" action="serverlist.php" method="post">
        开启状态:
        <select name="Statue" id="Statue">
            <?php
            foreach (array($all => "全部") +  \ServerOPS\ServerStatue::$StatueName as $key => $value) {
                echo "<option value=\"" . $key . "\"";
                if ($Statue == $key . "") {
                    echo " selected";
                }
                echo ">" . $value . "</option>";
            }
            ?>
        </select>
        &nbsp;&nbsp;
        运行状态:
        <select name="RunningStatus" id="RunningStatus">
            <?php
            foreach (array($all => "全部") + \ServerOPS\ServerRunningStatus::$RunningStatusName as $key => $value) {
                echo "<option value=\"" . $key . "\"";
                if ($RunningStatus == $key . "") {
                    echo " selected";
                }
                echo ">" . $value . "</option>";
            }
            ?>
        </select>
        &nbsp;&nbsp;
        推荐状态:
        <select name="Recommend" id="Recommend">
            <?php
            foreach (array($all => "全部", "1" => "是", "0" => "否") as $key => $value) {
                echo "<option value=\"" . $key . "\"";
                if ($Recommend == $key . "") {
                    echo " selected";
                }
                echo ">" . $value . "</option>";
            }
            ?>
        </select>
        &nbsp;&nbsp;<input type="button" value="添加服务器ID条件" onclick="AddServerIDCondition('', '', '')" />
        &nbsp;&nbsp;<input type="button" value="重置条件" onclick="ResetCondition()" />
        &nbsp;&nbsp;<input type="submit" name="submitsearch" value="搜索" class="button green medium" />
        <div id="ServerIDCondition"></div>
        <hr />
        <input type="button" value="新建服务器" onclick="window.location.href='serverEdit.php?opType=add'" />
        <input type="button" value="区服分组" onclick="window.location.href='serverGroup.php'" />
        <input type="button" value="刷新选服列表" onclick="window.location.href='refreshServerJson.php'" />
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        </select>
        &nbsp;&nbsp;
        <?php
        echo "<select name=\"updSelect\" onchange=\"CheckUpdMulti(this)\">";
        echo "<option value=\"\">全部设置为</option>";
        echo "<optgroup label=\"开启状态\">";
        foreach (\ServerOPS\ServerStatue::$StatueName as $key => $value) {
            echo "<option value=\"Statue" . $key . "\">" . $value . "</option>";
        }
        echo "</optgroup>";
        echo "<optgroup label=\"运行状态\">";
        foreach (\ServerOPS\ServerRunningStatus::$RunningStatusName as $key => $value) {
            echo "<option value=\"RunningStatus" . $key . "\">" . $value . "</option>";
        }
        echo "</optgroup>";
        echo "<optgroup label=\"推荐状态\">";
        foreach (array("1" => "是", "0" => "否") as $key => $value) {
            echo "<option value=\"Recommend" . $key . "\">" . $value . "</option>";
        }
        echo "</optgroup>";
        echo "</select>";
        ?>
        &nbsp;&nbsp;
        <input type="submit" name="submitSetMainServerID" value="批量设置主服ID" onclick="return CheckUpdMulti(this)" />
        <input type="number" name="SetMainServerID" id="SetMainServerID" value="" placeholder="填入合服主服ID" />
        <input type="checkbox" name="SetMainServerDomain" id="SetMainServerDomain" <?php echo $_POST["SetMainServerDomain"] ? "checked" : ""  ?> />同步修改为主服地址
        <hr />
        <table width="100%">
            <?php
            if ($serverList) {
                if ($isSearch) {
                    echo "<caption>符合条件服务器总数: " . count($serverList) . "</caption>";
                } else {
                    echo "<caption>服务器数: " . count($serverList) . "/" . $totalCount . "</caption>";
                }
                echo "<thead><tr>";
                foreach ($tableArray as $value) {
                    echo "<th width=\"" . $value[1] . "\">" . $value[0] . "</td>";
                }
                echo "</tr></thead>";
            } else {
                echo "无满足条件服务器!<br/>";
            }
 
            foreach ($serverList as $serverInfo) {
                echo "<tr class='trc'>";
                $ServerID = $serverInfo["ServerID"];
                $ServerName = $serverInfo["ServerName"];
                foreach ($tableArray as $key => $value) {
                    if (!$key) {
                        echo "<td align='center'>";
                        echo "&nbsp;<input type=\"button\" value=\"改\" onclick=\"window.location.href='serverEdit.php?opType=upd&ServerID=$ServerID'\" />";
                        echo " <input type=\"button\" value=\"删\" onclick=\"return suredel('$channel', '$ServerID', '$ServerName')\"/>&nbsp;";
                        echo "</td>";
                        continue;
                    }
 
                    $tdContent = $serverInfo[$key];
                    if ($key == "ServerID") {
                        $tdContent = "s" . $tdContent;
                    } else if ($key == "ClearState") {
                        if ($tdContent == 1) {
                            $tdContent = "已同步";
                        } else {
                            $tdContent = "<font color='red'>未处理</font>";
                        }
                    } else if ($key == "Statue") {
                        $statue = $tdContent;
                        $statueName = \ServerOPS\ServerStatue::$StatueName[$statue];
                        if ($statue != \ServerOPS\ServerStatue::Open) {
                            $tdContent = "<font color='red'>" . $statueName . "</font>";
                        } else {
                            $tdContent = $statueName;
                        }
                    } else if ($key == "RunningStatus") {
                        $runningStatus = $tdContent;
                        $runningStatusName = \ServerOPS\ServerRunningStatus::$RunningStatusName[$runningStatus];
                        if ($runningStatus == \ServerOPS\ServerRunningStatus::PreOpen || $runningStatus == \ServerOPS\ServerRunningStatus::Upkeep) {
                            $tdContent = "<font color='red'>" . $runningStatusName . "</font>";
                        } else {
                            $tdContent = $runningStatusName;
                        }
                    } else if ($key == "Recommend") {
                        $tdContent = $tdContent == 1 ? "是" : "否";
                    } elseif ($key == "JsonBranch") {
                        $tdContent = \ServerOPS\GetCommonServerlistJsonFileName($channel, $tdContent);
                    } elseif ($key == "StartDate") {
                        $OpenServerWay = $serverInfo["OpenServerWay"];
                        $RelationServerID = $serverInfo["RelationServerID"];
                        $RelationCreateRoles = $serverInfo["RelationCreateRoles"];
                        if ($OpenServerWay == 1 && $RelationServerID && $RelationCreateRoles && !$serverInfo["ClearState"]) {
                            $tdContent = "指定服:" . $RelationServerID . " 创角:" . $RelationCreateRoles;
                        } else {
                            $tdContent = $tdContent;
                        }
                    }
                    echo "<td align='" . $value[2] . "' style=\"display:table-cell; vertical-align:middle\">" . $tdContent . "</td>";
                }
                echo "</tr>";
            }
            ?>
        </table>
    </form>
    <script type='text/javascript' src="/js/common.js"></script>
    <script type="text/javascript">
        var serverIDCondNum = 0; // 服务器ID条件编号
 
        window.onload = function() {
            var serverIDCondList = JSON.parse('<?php echo json_encode($serverIDCondArray); ?>');
            for (let index = 0; index < serverIDCondList.length; index++) {
                const cond = serverIDCondList[index];
                const eValue = cond[0] > 0 ? cond[0] : "";
                const gteValue = cond[1] > 0 ? cond[1] : "";
                const lteValue = cond[2] > 0 ? cond[2] : "";
                AddServerIDCondition(eValue, gteValue, lteValue);
            }
        }
 
        function doPost(to, p) { // to:提交动作(action),p:参数 
            var myForm = document.createElement("form");
            myForm.method = "post";
            myForm.action = to;
            for (var i in p) {
                var myInput = document.createElement("input");
                myInput.setAttribute("name", i); // 为input对象设置name 
                myInput.setAttribute("value", p[i]); // 为input对象设置value 
                myForm.appendChild(myInput);
            }
            document.body.appendChild(myForm);
            myForm.submit();
            document.body.removeChild(myForm); // 提交后移除创建的form 
        }
 
        function suredel(Channel, ServerID, ServerName) {
            var br = getbr();
            if (!window.confirm("删除服务器建议设置为不开放即可!" + br + "确定直接删除【" + Channel + "】服务器【" + ServerName + "】?")) {
                return false;
            }
            doPost("serverlist.php", {
                "opType": "del",
                "ServerID": ServerID,
            });
            return true;
        }
 
        function AddServerIDCondition(eValue, gteValue, lteValue) {
            var numMax = parseInt("<?php echo $serverIDCondNumMax ?>");
            if (serverIDCondNum >= numMax) {
                alert("服务器ID条件超过最大个数: " + numMax);
                return;
            }
            serverIDCondNum += 1;
            var serverIDCondition = "<div id=\"ServerIDCond" + serverIDCondNum + "\">" +
                "服务器ID条件" + (serverIDCondNum < 10 ? "&nbsp;&nbsp;" + serverIDCondNum : serverIDCondNum) + " => " +
                "&nbsp;&nbsp;等于: " + "<input type=\"number\" name=\"ServerIDE" + serverIDCondNum + "\"" +
                " id=\"ServerIDE" + serverIDCondNum + "\" value=\"" + eValue + "\" min=\"0\" style=\"width: 60px\" />" +
                "&nbsp;&nbsp;大于等于: " + "<input type=\"number\" name=\"ServerIDGTE" + serverIDCondNum + "\"" +
                " id=\"ServerIDGTE" + serverIDCondNum + "\" value=\"" + gteValue + "\" min=\"0\" style=\"width: 60px\" />" +
                "&nbsp;&nbsp;小于等于: " + "<input type=\"number\" name=\"ServerIDLTE" + serverIDCondNum + "\"" +
                " id=\"ServerIDLTE" + serverIDCondNum + "\" value=\"" + lteValue + "\" min=\"0\" style=\"width: 60px\" />" +
                "&nbsp;&nbsp;<a href=\"javascript:DelServerIDCondition(" + serverIDCondNum + ")\">删除</a>";
            "</div>";
            document.getElementById("ServerIDCondition").insertAdjacentHTML("beforeEnd", serverIDCondition);
        }
 
        function DelServerIDCondition(delNum) {
            document.getElementById("ServerIDCondition").removeChild(document.getElementById("ServerIDCond" + delNum));
        }
 
        function ResetCondition() {
            set_select_checked("Statue", '<?php echo $all; ?>');
            set_select_checked("RunningStatus", '<?php echo $all; ?>');
            set_select_checked("Recommend", '<?php echo $all; ?>');
            document.getElementById("ServerIDCondition").innerHTML = "";
            serverIDCondNum = 0;
        }
 
        function set_select_checked(selectId, checkValue) {
            var select = document.getElementById(selectId);
            for (var i = 0; i < select.options.length; i++) {
                if (select.options[i].value == checkValue) {
                    select.options[i].selected = true;
                    break;
                }
            }
        }
 
        function CheckUpdMulti(obj) {
            var br = getbr();
            var setStr = "";
            if (obj.name == "updSelect") {
                var value = obj.value;
                if (!value) {
                    return false;
                }
                if (value.substr(0, 6) == "Statue") {
                    setStr = "开放状态:" + obj.options[obj.selectedIndex].text;
                } else if (value.substr(0, 13) == "RunningStatus") {
                    setStr = "运行状态:" + obj.options[obj.selectedIndex].text;
                } else if (value.substr(0, 9) == "Recommend") {
                    setStr = "推荐状态:" + obj.options[obj.selectedIndex].text;
                } else {
                    alert("无效设置项!");
                    return false;
                }
            } else if (obj.name == "submitSetMainServerID") {
                var SetMainServerID = document.getElementById("SetMainServerID").value;
                if (!SetMainServerID || SetMainServerID < 0) {
                    alert("请输入大于等于0的所属主服ID!");
                    document.getElementById('SetMainServerID').focus();
                    return false;
                }
                setStr = "合服主服ID: " + SetMainServerID;
                if (document.getElementById("SetMainServerDomain").checked) {
                    setStr += "?" + br + "并同步修改为主服地址";
                }
            } else {
                alert("未知批量更新操作控件: " + obj.name + " type:" + obj.type);
                return false;
            }
 
            let gteValue, lteValue;
            var serverCondStr = "";
            var numMax = parseInt("<?php echo $serverIDCondNumMax ?>");
            for (let index = 1; index < numMax + 1; index++) {
                if (!document.getElementById("ServerIDGTE" + index)) {
                    continue;
                }
                eValue = parseInt(document.getElementById("ServerIDE" + index).value);
                gteValue = parseInt(document.getElementById("ServerIDGTE" + index).value);
                lteValue = parseInt(document.getElementById("ServerIDLTE" + index).value);
                eValue = (isNaN(eValue) || eValue < 0) ? 0 : eValue;
                gteValue = (isNaN(gteValue) || gteValue < 0) ? 0 : gteValue;
                lteValue = (isNaN(lteValue) || lteValue < 0) ? 0 : lteValue;
                if (eValue <= 0 && gteValue <= 0 && lteValue <= 0) {
                    continue;
                }
                if (gteValue > 0 && lteValue > 0 && gteValue > lteValue) {
                    alert("服务器ID“大于等于值”不能小于“小于等于值”!");
                    document.getElementById("ServerIDLTE" + index).focus();
                    return false;
                }
                if (serverCondStr != "") {
                    // serverCondStr += "或";
                }
                serverCondStr += "服务器ID ";
                if (eValue > 0) {
                    serverCondStr += eValue;
                }
                if (gteValue > 0 || lteValue > 0) {
                    if (eValue > 0) {
                        serverCondStr += " , ";
                    }
                    if (gteValue > 0 && lteValue > 0) {
                        serverCondStr += gteValue + " ~ " + lteValue;
                    } else if (gteValue > 0) {
                        serverCondStr += ">=" + gteValue;
                    } else {
                        serverCondStr += "<=" + lteValue;
                    }
                }
                serverCondStr += br;
            }
            var StatueSelect = document.getElementById("Statue");
            var RunningStatusSelect = document.getElementById("RunningStatus");
            var RecommendSelect = document.getElementById("Recommend");
 
            var confimStr = ""
            confimStr += "开启状态: " + StatueSelect.options[StatueSelect.selectedIndex].text + br;
            confimStr += "运行状态: " + RunningStatusSelect.options[RunningStatusSelect.selectedIndex].text + br;
            confimStr += "推荐状态: " + RecommendSelect.options[RecommendSelect.selectedIndex].text + br;
            confimStr += serverCondStr;
            confimStr += br + "确定将以上条件服务器设置为 => " + setStr + "?";
 
            if (!window.confirm(confimStr)) {
                return false;
            }
            if (obj.type != "submit") {
                var form = document.getElementById("serverlist");
                form.submit();
            }
            return true;
        }
    </script>
</body>
 
</html>