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
<?php
include_once "/Common/Logging.php";
include_once "/language/lang.php";
include_once "/Common/CommFunc.php";
include_once "../cfg/GMT_QueryBillboardCross.php";
 
header("Content-type: text/html; charset=utf-8");
 
\Logging\CreateLogging("GMT_QueryBillboardCross.php");
 
\CommFunc\SessionStart();
 
$resultInfo = $_POST;
$ResultMsg = $resultInfo["ResultMsg"];
 
#date_default_timezone_set("PRC");
 
$billboardKeyCh = array(
    'Index' => \Lang\gettext('Index'),
    'Rank' => \Lang\gettext('排名'),
    'Name1' => \Lang\gettext('玩家'),
    'ID' => \Lang\gettext('ID'),
    'ID2' => \Lang\gettext('ID2'),
    'Name2' => \Lang\gettext('账号'),
    'Type2' => \Lang\gettext('职业'),
    'CmpValue' => \Lang\gettext('比较值1'),
    'CmpValue2' => \Lang\gettext('比较值2'),
    'CmpValue3' => \Lang\gettext('更新时间'),
    'Value1' => \Lang\gettext('其他值1'),
    'Value2' => \Lang\gettext('其他值2'),
    'Value3' => \Lang\gettext('其他值3'),
    'Value4' => \Lang\gettext('其他值4'),
    'Value5' => \Lang\gettext('其他值5'),
    'Value6' => \Lang\gettext('其他值6'),
    'Value7' => \Lang\gettext('其他值7'),
    'Value8' => \Lang\gettext('其他值8'),
);
 
$billboardCh = GetbillboardCh();
 
$bbName = "";
$bbType = null;
$groupList = array();
$dataTotalDict = array();
$resultList = array();
$groupValue1 = null;
$groupValue2 = null;
$dataTotal = null;
$groupValueMark = "";
if ($ResultMsg) {
    $bbType = $ResultMsg["billboardType"];
    $groupList = $ResultMsg["groupList"];
    $dataTotalDict = $ResultMsg["dataTotalDict"];
    $resultList = $ResultMsg["billboardInfo"];
    $groupValue1 = $ResultMsg["groupValue1"];
    $groupValue2 = $ResultMsg["groupValue2"];
    $dataTotal = $ResultMsg["dataTotal"];
    $billboardKeyChPri = $billboardCh[$bbType];
    $billboardKeyChPri = array_key_exists($bbType, $billboardCh) ? $billboardCh[$bbType] : array();
    $bbName = $billboardKeyChPri['BBName'];
    $groupValueMark = $billboardKeyChPri['GroupValueMark'];
}
$groupCount = count($groupList);
$retCount = count($resultList);
 
$cmpValue3CalcTime = 3786883200; //2090-01-01 00:00:00 的时间戳,用于存比较值3更新时间的计算值
 
function cmp($a, $b)
{
    if ($a[1] == $b[1]) {
        if ($a[2] == $b[2]) {
            return 0;
        }
        return ($a[2] < $b[2]) ? -1 : 1;
    }
    return ($a[1] < $b[1]) ? -1 : 1;
}
if ($groupList) {
    usort($groupList, 'cmp');
}
?>
 
<br />
<hr />
 
<a href="/GMToolClient/queryBillboardCross.php"><?php echo \Lang\gettext("查询跨服排行榜"); ?></a>
<br /><br />
 
<?php
 
function showGroup()
{
    global $bbName, $groupCount, $groupList, $dataTotalDict, $groupValue1, $groupValue2, $bbType, $ResultMsg, $groupValueMark;
    if ($bbName) {
        echo "【" . $bbName . "】<br/>";
    }
    echo \Lang\gettext("榜单类型") . ": " . $bbType . "<br/>";
    echo \Lang\gettext("总分组数") . ": " . $groupCount . "<br/>";
    echo \Lang\gettext("分组格式") . ": " . $groupValueMark . "<br/>";
 
    $startRank = $ResultMsg["startRank"];
    $queryCount = $ResultMsg["queryCount"];
    for ($i = 0; $i < $groupCount; $i++) {
        $groupInfo = $groupList[$i];
        $groupV1 = $groupInfo[1];
        $groupV2 = $groupInfo[2];
        $dataCount = $dataTotalDict[$bbType . "-" . $groupV1 . "-" . $groupV2];
        if ($dataCount <= 0) {
            continue;
        }
        // if ($groupV1 == $groupValue1 and $groupV2 == $groupValue2) {
        //     continue;
        // }
        echo \Lang\gettext("分组名称") . ": <a href='javascript:doPost(\"/Common/GMCmdProcess.php\", 
            {
                \"billboardType\":$bbType, 
                \"pack_type\":\"GMT_QueryBillboardCross\",
                \"Permission\":\"P_QueryBillboardCross\",
                \"groupValue1\":$groupV1,
                \"groupValue2\":$groupV2,
                \"startRank\":$startRank,
                \"queryCount\":$queryCount,
            })'>"
            . $bbType . "-" . $groupV1 . "-" . $groupV2 . "</a> 总条数:" . $dataCount . "<br/>";
    }
}
 
showGroup();
 
if ($groupValue1 != null) {
    echo "<br/>";
    echo \Lang\gettext("查询分组") . ": " . $bbType . "-" . $groupValue1 . "-" . $groupValue2;
    echo "&nbsp;&nbsp;&nbsp;&nbsp;";
    echo \Lang\gettext("数据条数") . ": " . $retCount . " / " . $dataTotal . "<br/>";
    echo "<table id=\"tf\" class=\"border-table\">";
    echo "<tr>";
    foreach ($billboardKeyCh as $key => $value) {
        // 没有指定要显示的key
        if (($key == "CmpValue2" or \CommFunc\startsWith($key, "Value")) and !array_key_exists($key, $billboardKeyChPri)) {
            continue;
        }
        $keyCh = $value;
        if (array_key_exists($key, $billboardKeyChPri)) {
            // 指定榜单字段名
            $keyCh = $billboardKeyChPri[$key];
        }
        echo "<td align='center'>" . $keyCh . "</td>";
    }
    echo "</tr>";
 
    for ($i = 0; $i < $retCount; $i++) {
        $dataInfo = $resultList[$i];
        echo "<tr>";
        echo "<td align='center'>" . ($dataInfo["Index"] ? $dataInfo["Index"] : 0) . "</td>";
 
        foreach ($billboardKeyCh as $key => $value) {
            if ($key == "Index") {
                continue;
            }
            // 没有指定要显示的key
            if (($key == "CmpValue2" or \CommFunc\startsWith($key, "Value")) and !array_key_exists($key, $billboardKeyChPri)) {
                continue;
            }
            $widgetName = "lab" . $key . $i;
            $tdContent = $dataInfo[$key];
            if ($key == "CmpValue3" and !array_key_exists($key, $billboardKeyChPri)) {
                $updTime = $cmpValue3CalcTime  - $tdContent;
                $tdContent = date("Y-m-d H:i:s", $updTime); // 更新数据时间
            }
            $tdContent = '<label name="' . $widgetName . '" id="' . $widgetName . '"/>' . $tdContent . '</label>';
            if ($key == "Name1" || $key == "Name2") {
                $align = "left";
            } else {
                $align = "center";
            }
            echo "<td align='" . $align . "'>" . $tdContent . "</td>";
        }
        echo "</tr>";
    }
    echo "</table>";
    if ($retCount >= 20) {
        showGroup();
    }
} else if ($groupCount > 0) {
    echo "<br/>" . \Lang\gettext("点击分组名称可查询对应分组榜单排行数据") . "! <br/>";
}
 
?>
 
<hr />
<script>
    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 
    }
</script>
<style type="text/css">
    .border-table {
        border-collapse: collapse;
        border: none;
    }
 
    .border-table td {
        border: solid #000 1px;
    }
</style>