<?php
|
include_once "/Common/Logging.php";
|
include_once "/Account/User.php";
|
include_once "/language/lang.php";
|
include_once "/serverrep/report.php";
|
|
\Logging\CreateLogging("rep.keeplogin.php");
|
$Permission = \User\Permission::P_REP_KeepLogin;
|
|
$alertMsg = "";
|
$channel = $_SESSION['spid'];
|
$UserAccount = $_SESSION['UserAccount'];
|
$user = new \User\User($UserAccount);
|
if (!$user->HavePermission($Permission)) {
|
exit;
|
}
|
|
$startDate = array_key_exists("startDate", $_POST) ? $_POST["startDate"] : date("Y-m-d", strtotime("-7 days"));
|
$endDate = array_key_exists("endDate", $_POST) ? $_POST["endDate"] : date("Y-m-d");
|
$dayList = json_decode($_POST["dayList"], true);
|
if (!isset($dayList)) {
|
$dayList = array(2, 3, 4, 5, 6, 7, 8, 10, 15);
|
}
|
$maxDay = max($dayList);
|
if (!in_array(1, $dayList)) {
|
array_push($dayList, 1);
|
}
|
sort($dayList);
|
\Logging\LogInfo("dayList: " . print_r($dayList, true) . " maxDay:" . $maxDay);
|
|
\Report\GetAccountFirstLoginPayReport($channel, $startDate, $endDate, $fistLoginReportArray, $fistPayReportArray);
|
|
|
?>
|
|
<!DOCTYPE html>
|
<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="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 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" value="<?php echo \Lang\gettext("查询"); ?>" />
|
<p />
|
指定显示留存天: <input type="text" name="dayList" id="dayList" value="<?php echo json_encode($dayList) ?>" size="50" />
|
<hr />
|
<table width="100%">
|
<?php
|
echo "<caption>【创角留存】</caption>";
|
echo "<thead><tr>";
|
echo "<th align='center' width='70'>创角日期</th>";
|
foreach ($dayList as $day) {
|
if ($day == 1) {
|
$title = "首登人数";
|
} else if ($day == 1) {
|
$title = "次日留存";
|
} else {
|
$title = "第" . $day . "日留存";
|
}
|
echo "<th align='center' width='70'>" . $title . "</th>";
|
}
|
echo "</tr></thead>";
|
foreach ($fistLoginReportArray as $firstYMD => $statYMDInfo) {
|
echo "<tr class='trc'>";
|
echo "<td align='center' width='70'>" . $firstYMD . "</td>";
|
$firstYMDTime = strtotime($firstYMD);
|
$firstCount = 0;
|
foreach ($dayList as $day) {
|
$statYMD = date("Y-m-d", strtotime("+" . ($day - 1) . " days", $firstYMDTime));
|
if ($day == 1) {
|
$statInfo = $statYMDInfo[$firstYMD] ? $statYMDInfo[$firstYMD] : array();
|
$firstCount = $statInfo["keepCount"] ? $statInfo["keepCount"] : 0;
|
$text = $firstCount;
|
} else {
|
$statInfo = $statYMDInfo[$statYMD] ? $statYMDInfo[$statYMD] : array();
|
$statCount = $statInfo["keepCount"] ? $statInfo["keepCount"] : 0;
|
if ($statCount == 0 || $firstCount == 0) {
|
$text = "";
|
} else {
|
$keepPer = round($statCount / $firstCount * 100, 2);
|
// $text = $keepPer . "%<br/>(" . $statCount . ")<br/>";
|
$text = $keepPer . "%";
|
}
|
}
|
echo "<td align='center' width='90'>" . $text . "</td>";
|
}
|
echo "</tr>";
|
}
|
if (count($fistLoginReportArray) == 0) {
|
echo "<tr class='trc'><td>无数据</td></tr>";
|
}
|
?>
|
</table>
|
<hr />
|
|
<table width="100%">
|
<?php
|
echo "<caption>【首充留存】</caption>";
|
echo "<thead><tr>";
|
echo "<th align='center' width='70'>首充日期</th>";
|
foreach ($dayList as $day) {
|
if ($day == 1) {
|
$title = "首充人数";
|
} else if ($day == 1) {
|
$title = "次日留存";
|
} else {
|
$title = "第" . $day . "日留存";
|
}
|
echo "<th align='center' width='70'>" . $title . "</th>";
|
}
|
echo "</tr></thead>";
|
foreach ($fistPayReportArray as $firstYMD => $statYMDInfo) {
|
echo "<tr class='trc'>";
|
echo "<td align='center' width='70'>" . $firstYMD . "</td>";
|
$firstYMDTime = strtotime($firstYMD);
|
$firstCount = 0;
|
foreach ($dayList as $day) {
|
$statYMD = date("Y-m-d", strtotime("+" . ($day - 1) . " days", $firstYMDTime));
|
if ($day == 1) {
|
$statInfo = $statYMDInfo[$firstYMD] ? $statYMDInfo[$firstYMD] : array();
|
$firstCount = $statInfo["keepCount"] ? $statInfo["keepCount"] : 0;
|
$text = $firstCount;
|
} else {
|
$statInfo = $statYMDInfo[$statYMD] ? $statYMDInfo[$statYMD] : array();
|
$statCount = $statInfo["keepCount"] ? $statInfo["keepCount"] : 0;
|
if ($statCount == 0 || $firstCount == 0) {
|
$text = "";
|
} else {
|
$keepPer = round($statCount / $firstCount * 100, 2);
|
// $text = $keepPer . "%<br/>(" . $statCount . ")<br/>";
|
$text = $keepPer . "%";
|
}
|
}
|
echo "<td align='center' width='90'>" . $text . "</td>";
|
}
|
echo "</tr>";
|
}
|
if (count($fistPayReportArray) == 0) {
|
echo "<tr class='trc'><td>无数据</td></tr>";
|
}
|
?>
|
</table>
|
<hr />
|
</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">
|
</script>
|
|
</html>
|