From d005d38e8fde902f80779bbea053685f52608293 Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期五, 29 十一月 2024 19:16:02 +0800 Subject: [PATCH] 10162 后台优化(修复新增充值用户充值统计错误;修复首充用户留存计算错误;) --- serverrep/report.php | 35 ++++++++++++++++------------------- 1 files changed, 16 insertions(+), 19 deletions(-) diff --git a/serverrep/report.php b/serverrep/report.php index 2387b33..3a92e68 100644 --- a/serverrep/report.php +++ b/serverrep/report.php @@ -92,26 +92,14 @@ $DNU = \DBOper\Count("AccountFirstLogin", array("Channel" => $Channel, "CreateYMD" => $YMD)); \Logging\LogInfo(" 鏃ユ柊澧炵敤鎴锋暟 DNU:" . $DNU); - $DNPU = \DBOper\Count("AccountFirstPay", array("Channel" => $Channel, "PayYMD" => $YMD)); - \Logging\LogInfo(" 鏃ユ柊澧炲厖鍊肩敤鎴锋暟 DNPU:" . $DNPU); - - $ret = \DBOper\Aggregate("AccountFirstPay", array( - array( - '$match' => array("Channel" => $Channel, "PayYMD" => $YMD), - ), - array( - '$group' => array( - '_id' => null, - 'total' => array('$sum' => '$OrderAmount'), - ), - ) - ), $retInfo); - $DRNPU = 0; - if ($ret && isset($retInfo) && count($retInfo) > 0) { - $DRNPU = $retInfo[0]["total"]; + \DBOper\Find("AccountFirstPay", array("Channel" => $Channel, "PayYMD" => $YMD), $ret, array("AccountID" => 1)); + $firstPayAccountIDInfo = array(); + if (isset($ret)) { + foreach ($ret as $firstPayInfo) { + $AccountID = $firstPayInfo["AccountID"]; + $firstPayAccountIDInfo[$AccountID] = 1; + } } - $DRNPU = round($DRNPU, 2); - \Logging\LogInfo(" 鏃ユ柊澧炲厖鍊肩敤鎴峰厖鍊兼�婚 DRNPU:" . $DRNPU); $ret = \DBOper\Aggregate("PayOrder", array( array( @@ -129,13 +117,22 @@ ), $retInfo); $DPU = 0; $DRPU = 0; + $DRNPU = 0; if ($ret && isset($retInfo)) { foreach ($retInfo as $info) { $DPU += 1; + $AccountID = $info["_id"]["AccountID"]; $DRPU += $info["total"]; + if ($firstPayAccountIDInfo[$AccountID]) { + $DRNPU += $info["total"]; + } } } $DRPU = round($DRPU, 2); + $DRNPU = round($DRNPU, 2); + $DNPU = count($firstPayAccountIDInfo); + \Logging\LogInfo(" 鏃ユ柊澧炲厖鍊肩敤鎴锋暟 DNPU:" . $DNPU); + \Logging\LogInfo(" 鏃ユ柊澧炲厖鍊肩敤鎴峰厖鍊兼�婚 DRNPU:" . $DRNPU); \Logging\LogInfo(" 鏃ュ厖鍊肩敤鎴锋暟 DPU:" . $DPU); \Logging\LogInfo(" 鏃ュ厖鍊肩敤鎴锋暟鍏呭�兼�婚 DRPU:" . $DRPU); -- Gitblit v1.8.0