<?php
|
include_once "/Common/Logging.php";
|
include_once "/Account/User.php";
|
include_once "/db/DBOper.php";
|
include_once "/language/lang.php";
|
|
\Logging\CreateLogging("payoverview.php");
|
$Permission = \User\Permission::P_PayOverview;
|
|
$spid = $_SESSION['spid'];
|
$UserAccount = $_SESSION['UserAccount'];
|
$user = new \User\User($UserAccount);
|
if (!$user->HavePermission($Permission)) {
|
exit;
|
}
|
|
$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");
|
|
// 只显示成功的订单; 1-成功;2-失败
|
$match = array("Channel" => $spid, "State" => 1, "PayTime" => array('$gte' => $startDate . " 00:00:00", '$lte' => $endDate . " 23:59:59"));
|
$ret = \DBOper\Aggregate("PayOrder", array(
|
array(
|
'$match' => $match,
|
),
|
array(
|
'$group' => array(
|
'_id' => array('AccountID' => '$AccountID'),
|
'total' => array('$sum' => '$OrderAmount'),
|
),
|
),
|
), $retInfo);
|
|
$payCount = 0;
|
$payTotal = 0;
|
$payUserCount = 0;
|
$ARPPU = 0;
|
if (isset($retInfo)) {
|
$payUserCount = count($retInfo);
|
foreach ($retInfo as $info) {
|
$payTotal += floatval($info["total"]);
|
}
|
if ($payTotal > 0 && $payUserCount > 0) {
|
$ARPPU = round($payTotal / $payUserCount, 2);
|
}
|
}
|
|
$payCount = \DBOper\Count("PayOrder", $match);
|
?>
|
|
<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/button.css">
|
</head>
|
|
<body>
|
<center>
|
<p><b><?php echo \Lang\gettext("充值总览"); ?></b></P>
|
</center>
|
<hr />
|
<form id="payoverview" action="payoverview.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="submit" name="submit" value="<?php echo \Lang\gettext("查询"); ?>" class="button green medium" />
|
<hr />
|
</form>
|
<?php
|
echo "<table border frame=box rules=all>";
|
echo "<tr><td align='center' width='100'>" . \Lang\gettext("充值总额") . "</td><td align='center' width='200'>" . $payTotal . "</td></tr>";
|
echo "<tr><td align='center'>" . \Lang\gettext("充值人数") . "</td><td align='center'>" . $payUserCount . "</td></tr>";
|
echo "<tr><td align='center'>" . "<span title='" . \Lang\gettext("充值总额") . "/" . \Lang\gettext("充值人数") . "'>" . \Lang\gettext("ARPPU") . "</span>"
|
. "</td>" . "<td align='center'>" . $ARPPU . "</td></tr>";
|
echo "<tr><td align='center'>" . \Lang\gettext("充值条数") . "</td><td align='center'>" . $payCount . "</td></tr>";
|
echo "</table>";
|
?>
|
</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">
|
</script>
|
|
</html>
|