<?php
|
include_once "/Common/Logging.php";
|
include_once "/Account/User.php";
|
include_once "/db/DBOper.php";
|
include_once "/db/DataMgr.php";
|
include_once "/language/lang.php";
|
|
\Logging\CreateLogging("payrank.php");
|
$Permission = \User\Permission::P_PayRank;
|
|
$spid = $_SESSION['spid'];
|
$UserAccount = $_SESSION['UserAccount'];
|
$user = new \User\User($UserAccount);
|
if (!$user->HavePermission($Permission)) {
|
exit;
|
}
|
$server_id = $_SESSION['server_id'];
|
|
$isSpecialAccount = False;
|
\CommFunc\GetConfig("ServerInfo", "SpecialAccountList", $SpecialAccountList);
|
$SpecialAccountList = explode(",", $SpecialAccountList);
|
// 特殊账号,只能看本服
|
if (in_array($UserAccount, $SpecialAccountList)) {
|
$isSpecialAccount = True;
|
}
|
|
$match = array("Channel" => $spid);
|
|
$limit = 100;
|
if (array_key_exists("limit", $_POST)) {
|
$limit = intval($_POST["limit"]);
|
}
|
|
$onlyServerID = $_POST["onlyServerID"];
|
if ($onlyServerID == "on" || $isSpecialAccount) {
|
$serversCfg = $user->GetServersCfg($spid);
|
if (array_key_exists($server_id, $serversCfg)) {
|
$match["ServerID"] = intval($serversCfg[$server_id]["ServerID"]);
|
}
|
}
|
|
// $startDate = $_POST["startDate"];
|
$startDate = array_key_exists("startDate", $_POST) ? $_POST["startDate"] : \CommFunc\CalcToStrDateTime("-7 days", "Y-m-d");
|
$endDate = $_POST["endDate"];
|
$payTime = array();
|
if ($startDate) {
|
$payTime['$gte'] = $startDate . " 00:00:00";
|
}
|
if ($endDate) {
|
$payTime['$lte'] = $endDate . " 23:59:59";
|
}
|
if (count($payTime)) {
|
$match["PayTime"] = $payTime;
|
}
|
|
\Logging\LogInfo("_POST: " . print_r($_POST, true));
|
\Logging\LogInfo("match: " . print_r($match, true));
|
|
$skip = 0;
|
|
$ret = \DBOper\Aggregate("PayOrder", array(
|
array(
|
'$match' => $match,
|
),
|
array(
|
'$group' => array(
|
'_id' => array('AccountID' => '$AccountID', 'ServerID' => '$ServerID'),
|
'total' => array('$sum' => '$OrderAmount'),
|
),
|
),
|
array(
|
'$sort' => array(
|
'total' => -1,
|
),
|
),
|
array(
|
'$limit' => $limit,
|
)
|
), $retInfo);
|
|
// \Logging\LogInfo("ret" . print_r($ret, true));
|
// \Logging\LogInfo("retInfo" . print_r($retInfo, true));
|
|
// echo "_POST:", json_encode($_POST), "<br/>";
|
// echo "find:", json_encode($find), "<br/>";
|
|
//显示表格字段配置 key-参数名,value-说明
|
$tableArray = array(
|
"Num" => array(\Lang\gettext("编号"), "3%", "center"),
|
"AccountGroup" => array(\Lang\gettext("分组"), "5%", "center"),
|
"PlayerName" => array(\Lang\gettext("玩家名"), "10%", "center"),
|
"_id" => array(\Lang\gettext("游戏账号"), "15%", "center"),
|
"total" => array(\Lang\gettext("充值总金额"), "5%", "center"),
|
);
|
|
CommFunc\GetConfig("ServerInfo", "CoupontypeGroup", $CoupontypeGroup);
|
$CoupontypeGroup = json_decode($CoupontypeGroup, true);
|
if (!isset($CoupontypeGroup)) {
|
unset($tableArray['AccountGroup']);
|
}
|
|
?>
|
|
<html>
|
|
<head>
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
<title><?php echo \Lang\gettext("充值排行"); ?></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><?php echo \Lang\gettext("充值排行"); ?></b></P>
|
</center>
|
<hr />
|
<form id="payrank" action="payrank.php" method="post">
|
<?php echo \Lang\gettext("查询时间"); ?>:
|
<input type="text" name="startDate" id="startDate" onclick="new Calendar().show(this);" readonly value="<?php echo $startDate; ?>" size="8" />
|
~
|
<input type="text" name="endDate" id="endDate" onclick="new Calendar().show(this);" readonly value="<?php echo $endDate; ?>" size="8" />
|
前x名: <input type="number" name="limit" id="limit" value="<?php echo $limit ?>" min="1" />
|
<?php
|
if (!$isSpecialAccount) {
|
// 仅显示本服
|
echo " ";
|
echo '<input type="checkbox" name="onlyServerID" id="onlyServerID" ' . ($onlyServerID == "on" ? "checked" : "") . ' />' . \Lang\gettext("仅显示本服");
|
}
|
?>
|
<input type="submit" name="submit" value="<?php echo \Lang\gettext("查询"); ?>" class="button green medium" />
|
<hr />
|
<table width="50%">
|
<?php
|
if ($retInfo) {
|
echo "<thead><tr>";
|
foreach ($tableArray as $value) {
|
echo "<th width=\"" . $value[1] . "\">" . $value[0] . "</td>";
|
}
|
echo "</tr></thead>";
|
} else {
|
echo \Lang\gettext("暂无订单"), "<br/>";
|
}
|
|
$Num = $skip;
|
$roleInfoArray = array();
|
foreach ($retInfo as $info) {
|
$Num += 1;
|
echo "<tr class='trc'>";
|
foreach ($tableArray as $key => $value) {
|
$tdContent = $info[$key];
|
if ($key == "Num") {
|
$tdContent = $Num;
|
} elseif ($key == "AccountGroup") {
|
$idInfo = $info["_id"];
|
$Coupontype = \DataMgr\GetCoupontypeGroup($spid, $idInfo["AccountID"], $idInfo["ServerID"]);
|
$tdContent = array_key_exists($Coupontype, $CoupontypeGroup) ? $CoupontypeGroup[$Coupontype] : "";
|
} elseif ($key == "PlayerName") {
|
$idInfo = $info["_id"];
|
$accountKey = $idInfo["AccountID"] . "@" . $spid;
|
$find = array("Channel" => $spid, "AccountID" => $idInfo["AccountID"]);
|
if (!$roleInfoArray[$accountKey] && \DBOper\FindOne("GameRoles", $find, $findData) && isset($findData)) {
|
$roleInfoArray[$accountKey] = $findData;
|
}
|
$tdContent = "";
|
if ($roleInfoArray[$accountKey] && $roleInfoArray[$accountKey]["s" . $idInfo["ServerID"]]) {
|
$tdContent = $roleInfoArray[$accountKey]["s" . $idInfo["ServerID"]]["PlayerName"];
|
}
|
} elseif ($key == "_id") {
|
$tdContent = $tdContent["AccountID"] . "@" . $spid . "@s" . $tdContent["ServerID"];
|
}
|
echo "<td align='" . $value[2] . "' style=\"display:table-cell; vertical-align:middle\">";
|
echo "<div id='" . $key . "_" . $Num . "'>" . $tdContent . "</div>";
|
echo "</td>";
|
}
|
echo "</tr>";
|
}
|
?>
|
</table>
|
</form>
|
</body>
|
|
<script type='text/javascript' src="/js/calendar.js"></script>
|
<script type='text/javascript' src="/js/common.js"></script>
|
<script type="text/javascript">
|
|
</script>
|
|
</html>
|