hxp
2025-06-09 6c3f6335c70859ded94a1ad8d218acb0ac34239c
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
<?php
include_once "/Common/Logging.php";
include_once "/Account/User.php";
include_once "/language/lang.php";
include_once "/serverrep/report.php";
 
\Logging\CreateLogging("rep.allview.php");
$Permission = \User\Permission::P_REP_DailyUser;
 
$alertMsg = "";
$channel = $_SESSION['spid'];
$UserAccount = $_SESSION['UserAccount'];
$user = new \User\User($UserAccount);
if (!$user->HavePermission($Permission)) {
    exit;
}
 
// 固定显示今日实时数据 + 昨日数据 + 额外指定查询日期范围
$todayDate = date("Y-m-d");
$yesterdayDate = date("Y-m-d", strtotime("-1 days"));
 
$reportDict = \Report\GetDailyReport($channel, $yesterdayDate, $todayDate, true);
\Logging\LogInfo($yesterdayDate . " ~ " . $todayDate . " reportDict: " . print_r($reportDict, true));
 
$statDataArray = array(
    $todayDate => null,
    $yesterdayDate => null,
);
 
foreach ($statDataArray as $key => $value) {
    if (!isset($reportDict[$key])) {
        continue;
    }
    $dataInfo = $reportDict[$key];
    $statDataArray[$key] = array(
        "AU" => $dataInfo["DAU"],
        "NU" => $dataInfo["DNU"],
        "PU" => $dataInfo["DPU"],
        "NPU" => $dataInfo["DNPU"],
        "RPU" => $dataInfo["DRPU"],
        "RNPU" => $dataInfo["DRNPU"],
    );
}
 
$startDate = $todayDate;
$endDate = $todayDate;
if (array_key_exists("startDate", $_POST) || array_key_exists("endDate", $_POST)) {
    $startDate = array_key_exists("startDate", $_POST) ? $_POST["startDate"] : $todayDate;
    $endDate = array_key_exists("endDate", $_POST) ? $_POST["endDate"] : $todayDate;
    $statDataArray[$startDate . " ~ " . $endDate] = array(
        "AU" => \Report\QueryActiveUserCount($channel, $startDate, $endDate),
        "NU" => \Report\QueryNewUserCount($channel, $startDate, $endDate),
        "PU" => \Report\QueryPayUserCount($channel, $startDate, $endDate),
        "NPU" => \Report\QueryNewPayUserCount($channel, $startDate, $endDate),
        "RPU" => \Report\QueryPayTotal($channel, $startDate, $endDate),
        "RNPU" => "-", // 周期查询的该值暂不统计
    );
}
 
// 计算其他值
foreach ($statDataArray as $key => $dataInfo) {
    $dataInfo["ARPU"] = $dataInfo["AU"] > 0 ? round($dataInfo["RPU"] / $dataInfo["AU"], 2) : 0;
    $dataInfo["ARPPU"] = $dataInfo["PU"] > 0 ? round($dataInfo["RPU"] / $dataInfo["PU"], 2) : 0;
    $statDataArray[$key] = $dataInfo;
}
\Logging\LogInfo("statDataArray: " . print_r($statDataArray, true));
 
$lineArray = array(
    "活跃用户数量" => array("AU", "统计周期内,登录过游戏的用户数"),
    "新增用户数量" => array("NU", "统计周期内,新增的首登用户数"),
    "充值用户数量" => array("PU", "统计周期内,有充值的用户数"),
    "新增充值用户" => array("NPU", "统计周期内,新增的首次充值用户数"),
    "累计充值总额" => array("RPU", "统计周期内,累计充值总额"),
    "新增充值用户充值" => array("RNPU", "统计周期内,新增充值用户累计充值总额"),
    "ARPU" => array("ARPU", "统计周期内,每用户平均收入,累计充值总额/活跃用户数量 计算得出。"),
    "ARPPU" => array("ARPPU", "统计周期内,每充值用户平均收入,累计充值总额/充值用户数量 计算得出。"),
);
?>
 
<!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("查询"); ?>" />
        <hr />
        <table width="50%">
            <?php
            echo "<thead><tr>";
            echo "<th align='center' width='200'></th>";
            foreach ($statDataArray as $key => $dataInfo) {
                $title = $key;
                if ($title == $todayDate) {
                    $title = "今天(" . $todayDate . ")";
                } else if ($title == $yesterdayDate) {
                    $title = "昨天(" . $yesterdayDate . ")";
                }
                echo "<th align='center' width='300'>" .  $title . "</th>";
            }
            echo "</tr></thead>";
            foreach ($lineArray as $key => $value) {
                $dataKey = $value[0];
                $spanTitle = $value[1];
                echo "<tr class='trc'>";
                echo "<td align='center'><span title='" . $spanTitle . "'>" . $key . "</span></td>";
                foreach ($statDataArray as $key => $dataInfo) {
                    echo "<td align='center'>" . $dataInfo[$dataKey] . "</td>";
                }
                echo "</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>