hxp
2024-11-19 3c433d5045813bd41d407b34a381cf100465621f
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
<?php
include_once '/Common/CommFunc.php';
include_once '/Common/Logging.php';
include_once "/Common/ServerOPS.php";
 
header("Content-type: text/html; charset=utf-8");
 
\Logging\CreateLogging("center.server_list.php");
// ?game=xbqy&flag=test_1_1.100.1
// \Logging\LogInfo("_GET: " . print_r($_GET, true));
 
$game = $_GET["game"];
$flag = $_GET["flag"];
 
$gameName = \CommFunc\GetGameName();
if ($game != $gameName || !$flag) {
    \Logging\LogError("param error!" . print_r($_GET, true));
    exit;
}
 
$flagInfo = explode("_", $flag);
if (count($flagInfo) != 3) {
    \Logging\LogError("flag error!" . print_r($_GET, true));
    exit;
}
 
$channel = $flagInfo[0];
$branch = intval($flagInfo[1]);
$versioncode = $flagInfo[2];
 
$VersionState = 0;
$JsonBranch = 0;
// 优先读指定版本信息
if (\DBOper\FindOne("GameVersion", array("Channel" => $channel, "BranchNum" => $branch, "Version" => $versioncode), $versionInfo)) {
    $VersionState = $versionInfo["VersionState"] ? intval($versionInfo["VersionState"]) : 0;
}
 
// 版本状态
if ($VersionState > 0 && \DBOper\FindOne("GameVersionState", array("Channel" => $channel, "BranchNum" => $branch, "VersionState" => $VersionState), $stateInfo)) {
    $JsonBranch = $stateInfo["JsonBranch"];
}
// 没有指定版本,默认取分支信息
else if (DBOper\FindOne("GamePackBranch", array("Channel" => $channel, "BranchNum" => $branch), $branchData)) {
    $JsonBranch = $branchData["JsonBranch"];
}
 
if ($JsonBranch <= 0) {
    \Logging\LogError("db JsonBranch value not set! channel:" . $channel . " branch:" . $branch . " versioncode:" . $versioncode);
    exit;
}
 
$jsonFile = \ServerOPS\GetCommonServerlistJsonFileName($channel, $JsonBranch);
 
// http://pub.game.secondworld.net.cn:11000/common/xbqy_test.json||http://pub.game.secondworld.net.cn:11000/region_player/?game=xbqy&channel=test&branch=1
// 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'];
 
$httpHost = 'http://' . $_SERVER['HTTP_HOST'];
 
$ret = $httpHost . "/Common/serverjson/" . $jsonFile . "||"
    . $httpHost . "/center/region_player.php?game=" . $game . "&channel=" . $channel . "&branch=" . $branch;
 
echo $ret;
exit;