| | |
| | | return;
|
| | | }
|
| | |
|
| | | $dayActiveAccIDList = array(); // 统计日期活跃账号ID列表 [accountID, ..]
|
| | | $dayActiveAccIDDict = array(); // 统计日期活跃账号充值额度 {accountID:充值总额, ...}
|
| | | $queryFirstLoginAccIDList = array(); // 需要查询首登日期的账号列表 [accountID, ..]
|
| | | $queryFirstPayAccIDList = array(); // 需要查询首充日期的账号列表 [accountID, ..]
|
| | | foreach ($activeRetArray as $activeInfo) {
|
| | | $AccountID = $activeInfo["AccountID"];
|
| | |
|
| | | array_push($dayActiveAccIDList, $AccountID);
|
| | | $dayActiveAccIDDict[$AccountID] = 0;
|
| | |
|
| | | if (!isset($accountFirstLoginDateInfo[$AccountID])) {
|
| | | array_push($queryFirstLoginAccIDList, $AccountID);
|
| | |
| | | $accountFirstPayDict[$firstPayInfo["AccountID"]] = 1;
|
| | | }
|
| | |
|
| | | if (
|
| | | !\DBOper\Find(
|
| | | "PayOrder",
|
| | | $ret = \DBOper\Aggregate("PayOrder", array(
|
| | | array(
|
| | | "Channel" => $Channel, "State" => 1, "PayTime" => array('$gte' => $YMD . " 00:00:00", '$lte' => $YMD . " 23:59:59"),
|
| | | "AccountID" => array('$in' => $dayActiveAccIDList)
|
| | | '$match' => array(
|
| | | "Channel" => $Channel, "State" => 1, "PayTime" => array('$gte' => $YMD . " 00:00:00", '$lte' => $YMD . " 23:59:59")
|
| | | ),
|
| | | $payRetArray,
|
| | | array("AccountID" => 1, "PayTime" => 1, "OrderAmount" => 1)
|
| | | ) || !isset($payRetArray)
|
| | | ) {
|
| | | ),
|
| | | array(
|
| | | '$group' => array(
|
| | | '_id' => array('AccountID' => '$AccountID'),
|
| | | 'total' => array('$sum' => '$OrderAmount'),
|
| | | ),
|
| | | ),
|
| | | ), $retInfo);
|
| | | if (!$ret || !isset($retInfo)) {
|
| | | return;
|
| | | }
|
| | |
|
| | | $accountPayDict = array(); // 统计日期活跃账号充值额 {accountID:充值总额, ...}
|
| | | foreach ($payRetArray as $payInfo) {
|
| | | $AccountID = $payInfo["AccountID"];
|
| | | $OrderAmount = $payInfo["OrderAmount"];
|
| | |
|
| | | $accountPayDict[$AccountID] = $accountPayDict[$AccountID] + $OrderAmount;
|
| | | foreach ($retInfo as $info) {
|
| | | $AccountID = $info["_id"]["AccountID"];
|
| | | if (isset($dayActiveAccIDDict[$AccountID])) {
|
| | | $dayActiveAccIDDict[$AccountID] = floatval($info["total"]);
|
| | | }
|
| | | }
|
| | |
|
| | | // 汇总信息
|
| | | for ($i = 0; $i < count($dayActiveAccIDList); $i++) {
|
| | | $AccountID = $dayActiveAccIDList[$i];
|
| | | foreach ($dayActiveAccIDDict as $AccountID => $payTotal) {
|
| | | // 首登
|
| | | $FirstLoginYMD = $accountFirstLoginDateInfo[$AccountID];
|
| | | if ($FirstLoginYMD) {
|
| | |
| | | }
|
| | | $statInfo = $statYMDInfo[$YMD];
|
| | | $statInfo["keepCount"] = ($statInfo["keepCount"] ? $statInfo["keepCount"] : 0) + 1;
|
| | |
|
| | | $payTotal = $accountPayDict[$AccountID] ? $accountPayDict[$AccountID] : 0;
|
| | | $statInfo["payTotal"] = ($statInfo["payTotal"] ? $statInfo["payTotal"] : 0) + $payTotal;
|
| | | if ($payTotal > 0) {
|
| | | $statInfo["payCnt"] = ($statInfo["payCnt"] ? $statInfo["payCnt"] : 0) + 1;
|