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", "统计周期内,每充值用户平均收入,累计充值总额/充值用户数量 计算得出。"), ); ?>