<?php
|
include_once "/Common/Logging.php";
|
include_once "/Account/User.php";
|
include_once "/language/lang.php";
|
|
\Logging\CreateLogging("ctgreportall.php");
|
$Permission = \User\Permission::P_CTGReportAll;
|
|
$alertMsg = "";
|
$channel = $_SESSION['spid'];
|
$UserAccount = $_SESSION['UserAccount'];
|
$user = new \User\User($UserAccount);
|
if (!$user->HavePermission($Permission)) {
|
exit;
|
}
|
|
$serversArray = $user->GetServers();
|
|
// 默认当天
|
$startDate = array_key_exists("startDate", $_POST) ? $_POST["startDate"] : \CommFunc\CalcToStrDateTime("-7 days", "Y-m-d");
|
$endDate = array_key_exists("endDate", $_POST) ? $_POST["endDate"] : date("Y-m-d");
|
$payOrderTypeGroup = $_POST["payOrderTypeGroup"];
|
|
$reportInfo = null;
|
$errorServerInfo = array();
|
$payOrderTypes = array();
|
if (array_key_exists("submit", $_POST)) {
|
$_POST["eventType"] = "CTGReportAll";
|
$_POST["queryAllData"] = "on"; // 设置可查询备份数据
|
// echo "_POST:", print_r($_POST, true), "<br/>";
|
\CommFunc\QueryEventData($user, $retInfo);
|
|
if (isset($retInfo)) {
|
// \Logging\LogInfo("返回查询结果: " . print_r($retInfo, true));
|
$reportInfo = array();
|
foreach ($retInfo as $serverName => $ret) {
|
if (is_array($ret) && $ret["OK"] == 1) {
|
foreach ($ret["reportInfo"] as $key => $orderInfoDict) {
|
if (!array_key_exists($key, $reportInfo)) {
|
$reportInfo[$key] = array();
|
}
|
$repOrderInfoDict = $reportInfo[$key];
|
foreach ($orderInfoDict as $orderInfo => $retData) {
|
if (!array_key_exists($orderInfo, $repOrderInfoDict)) {
|
$repOrderInfoDict[$orderInfo] = $retData;
|
} else {
|
$retDataTotal = $repOrderInfoDict[$orderInfo];
|
foreach ($retData as $k => $v) {
|
if ($k == "orderCoin") {
|
continue;
|
}
|
$retDataTotal[$k] = ($retDataTotal[$k] ? $retDataTotal[$k] : 0) + $v;
|
}
|
$repOrderInfoDict[$orderInfo] = $retDataTotal;
|
}
|
foreach ($repOrderInfoDict[$orderInfo] as $k => $v) {
|
if (\CommFunc\startsWith($k, "payOrderType")) {
|
$payOrderTypes[$k] = intval(substr($k, strlen("payOrderType")));
|
}
|
}
|
}
|
$reportInfo[$key] = $repOrderInfoDict;
|
}
|
foreach ($reportInfo as $key => $repOrderInfoDict) {
|
//排序 根据 payCount 倒序排序 SORT_ASC 和 SORT_DESC
|
array_multisort(array_column($repOrderInfoDict, 'payCount'), SORT_DESC, $repOrderInfoDict);
|
$reportInfo[$key] = $repOrderInfoDict;
|
}
|
} else {
|
$errorServerInfo[$serverName] = $ret;
|
}
|
}
|
}
|
}
|
|
// \Logging\LogInfo("reportInfo: " . print_r($reportInfo, true));
|
// \Logging\LogInfo("errorServerInfo: " . print_r($errorServerInfo, true));
|
// \Logging\LogInfo("payOrderTypes: " . print_r($payOrderTypes, true));
|
|
//显示表格字段配置 key-参数名,value-说明
|
$tableArray = array(
|
"Num" => array("编号", "5%", "center"),
|
"orderInfo" => array("商品编号", "5%", "center"),
|
"orderCoin" => array("orderCoin", "5%", "center"),
|
"payCount" => array("总次数", "5%", "center"),
|
);
|
if (!$payOrderTypeGroup) {
|
ksort($payOrderTypes);
|
foreach ($payOrderTypes as $k => $payOrderType) {
|
$payName = \CommFunc\getPayOrderTypeName($payOrderType);
|
$tableArray[$k] = array($payName . "次数", "5%", "center");
|
}
|
}
|
|
?>
|
|
<!DOCTYPE html>
|
<html>
|
|
<head>
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
<title><?php echo \Lang\gettext("充值分析"); ?></title>
|
<link rel="gettext" type="application/x-po" href="../language/<?php echo \Lang\getLang(); ?>/LC_MESSAGES/<?php echo \Lang\getjspodomain(); ?>.po" />
|
|
</head>
|
|
<body>
|
<center>
|
<p><b><?php echo \Lang\gettext("充值分析"); ?></b></P>
|
</center>
|
<form id="ctgreportall" action="ctgreportall.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" />
|
<input type="checkbox" name="payOrderTypeGroup" <?php echo $payOrderTypeGroup ? "checked" : "" ?> />按支付类型分组<br />
|
<hr />
|
<?php
|
if (count($errorServerInfo)) {
|
echo \Lang\gettext("服务器错误信息") . "<br/>";
|
echo "<font color='red'>";
|
foreach ($errorServerInfo as $serverName => $errInfo) {
|
echo $serverName;
|
if (is_array($errInfo)) {
|
echo " => " . json_encode($errInfo);
|
} else {
|
echo " => " . $errInfo;
|
}
|
echo "<br/>";
|
}
|
echo "</font>";
|
echo "<hr/>";
|
}
|
?>
|
|
<?php
|
if (isset($reportInfo)) {
|
if (count($reportInfo) == 0) {
|
echo \Lang\gettext("无充值记录") . "<br/>";
|
}
|
foreach ($reportInfo as $payOrderTypeKey => $orderInfoDict) {
|
if ($payOrderTypeKey == "") {
|
$caption = "所有";
|
} else {
|
$caption = \CommFunc\getPayOrderTypeName(intval($payOrderTypeKey));
|
}
|
$caption = "【" . $caption . "订单】";
|
echo "<table width=\"50%\" border frame=box rules=all>";
|
echo "<caption>" . $caption . "</caption>";
|
echo "<thead><tr>";
|
foreach ($tableArray as $value) {
|
echo "<th width=\"" . $value[1] . "\">" . $value[0] . "</td>";
|
}
|
echo "</tr></thead>";
|
$Num = 0;
|
foreach ($orderInfoDict as $orderInfo => $orderData) {
|
echo "<tr'>";
|
foreach ($tableArray as $key => $value) {
|
$tdContent = $orderData[$key];
|
if ($key == "Num") {
|
$Num += 1;
|
$tdContent = $Num;
|
}
|
// else if ($key == "payOrderType") {
|
// $tdContent = \CommFunc\getPayOrderTypeName($tdContent);
|
// }
|
// else if ($key == "orderCoin") {
|
// $tdContent = $tdContent / \CommFunc\getPayOrderCoinRate($orderData["payOrderType"]);
|
// }
|
else if ($key == "orderInfo") {
|
$tdContent = $orderInfo;
|
}
|
echo "<td align='" . $value[2] . "'>" . $tdContent . "</td>";
|
}
|
echo "</tr>";
|
}
|
echo "</table>";
|
echo "<hr/>";
|
}
|
}
|
?>
|
<?php
|
include_once "/Common/SelectServer.php";
|
?>
|
<input type="submit" name="submit" id="submit" value="<?php echo \Lang\gettext("查询多服"); ?>" onclick="return checkMultiSubmit()" />
|
<br />
|
<br />
|
</form>
|
</body>
|
<script type='text/javascript' src='/language/gettext.js'></script>
|
<script type='text/javascript' src="/js/calendar.js"></script>
|
<script type='text/javascript' src="/js/common.js"></script>
|
<script type='text/javascript' src="/Common/selectserver.js"></script>
|
<script type="text/javascript">
|
function checkMultiSubmit() {
|
|
if (!checkHaveServerSelected()) {
|
return false;
|
}
|
|
if (!setSubmitQuerying("submit")) {
|
return false;
|
}
|
|
return true;
|
}
|
</script>
|
|
</html>
|