hxp
2025-06-04 f4a514d5ac952110da846636ecbb9de951eaf3d2
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
<?php
include_once "/Common/Logging.php";
include_once "/Account/User.php";
include_once "/language/lang.php";
include_once "/serverrep/report.php";
 
\Logging\CreateLogging("rep.firstLoginFirstPayCnt.php");
$Permission = \User\Permission::P_REP_FirstLoginFirstPayCnt;
 
$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 = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14);
 
\Report\GetAccountFirstLoginPayReport($channel, $startDate, $endDate, $fistLoginReportArray, $fistPayReportArray);
// \Logging\LogInfo(print_r($fistLoginReportArray, true));
 
?>
 
<!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="100%">
            <?php
            echo "<caption>【首登新增首充人数】</caption>";
            echo "<thead><tr>";
            echo "<th align='center' width='75'>首登日期</th>";
            echo "<th align='center' width='55'>首登人数</th>";
            foreach ($dayList as $day) {
                $title = $day . "日人数";
                echo "<th align='center' width='70'>" .  $title . "</th>";
            }
            echo "<th align='center' width='70'>总付费人数</th>";
            echo "</tr></thead>";
            $curYMD = date("Y-m-d");
            $curDate = new DateTime();
            foreach ($fistLoginReportArray as $firstYMD => $statYMDInfo) {
                if ($firstYMD < $startDate) {
                    continue;
                }
                $firstPayCntTotal = 0;
                foreach ($statYMDInfo as $statInfo) {
                    $firstPayCntTotal  += ($statInfo["firstPayCnt"] ? $statInfo["firstPayCnt"] : 0);
                }
                echo "<tr class='trc'>";
                echo "<td align='center' width='70'>" . $firstYMD . "</td>";
                $firstYMDTime = strtotime($firstYMD);
                $firstLoginCount = 0;
                foreach ($dayList as $day) {
                    $statYMD = date("Y-m-d", strtotime("+" . ($day - 1) . " days", $firstYMDTime));
                    $statInfo = $statYMDInfo[$statYMD] ? $statYMDInfo[$statYMD] : array();
                    if ($day == 1) {
                        $firstLoginCount = $statInfo["keepCount"] ? $statInfo["keepCount"] : 0;
                        echo "<td align='center' width='70'>" . $firstLoginCount . "</td>";
                    }
 
                    $firstPayCnt = $statInfo["firstPayCnt"] ? $statInfo["firstPayCnt"] : 0;
 
                    if ($statYMD > $curYMD) {
                        $text = "";
                    } else {
                        if ($day == 1) {
                            $text = $firstPayCnt;
                        } else {
                            $text = $firstPayCnt;
                            // if ($firstPayCnt) {
                            //     $ratio = $firstPayCnt / $firstLoginCount;
                            //     $text .= "<br/>" . round($ratio, 2) . "";
                            // }
                        }
                    }
                    echo "<td align='center' width='90'>" .  $text . "</td>";
                }
 
                echo "<td align='center' width='90'>" . $firstPayCntTotal . "</td>";
                echo "</tr>";
            }
            if (count($fistLoginReportArray) == 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>