推广后台->数据管理->数据汇总|每日概况--更新

master
chenxiaojun 5 years ago
parent 7220247ecd
commit a32565e2e1

@ -1067,7 +1067,7 @@ class QueryController extends BaseController
$initEndTime = empty(I('endtime')) ? $initEndTime : I('endtime'); $initEndTime = empty(I('endtime')) ? $initEndTime : I('endtime');
$begTime = strtotime($initBegTime); $begTime = strtotime($initBegTime);
$endTime = strtotime($initEndTime); $endTime = strtotime($initEndTime);
$endTime += + 3600 * 24; $endTime += +3600 * 24;
$levelPromote = $this->getLevelPromote(); $levelPromote = $this->getLevelPromote();
$queryPromote = $this->getQueryPromote($levelPromote); $queryPromote = $this->getQueryPromote($levelPromote);
@ -1301,65 +1301,67 @@ class QueryController extends BaseController
$allData['spend_discount'] = 0; $allData['spend_discount'] = 0;
$allData['spend_voucher'] = 0; $allData['spend_voucher'] = 0;
if (!empty($data)) { if (!empty($data)) {
$gameIds = []; if (intval($endTime - $begTime) / (24 * 3600) <= 30) {
foreach ($data as $list) { $gameIds = [];
$gameIds[] = $list['game_id']; foreach ($data as $list) {
} $gameIds[] = $list['game_id'];
$params['game_ids'] = $gameIds; }
$params['game_ids'] = $gameIds;
$userRepository = new UserRepository();
$spendRepository = new SpendRepository(); $userRepository = new UserRepository();
$roleNumList = $userRepository->getCreateRoleCountByGame($params);//创角数 $spendRepository = new SpendRepository();
$userNumList = $userRepository->getCreateRoleUserCountByGame($params);//创角用户 $roleNumList = $userRepository->getCreateRoleCountByGame($params);//创角数
$newUserNumList = $userRepository->getNewCreateRoleUserCountByGame($params);//新创角用户 $userNumList = $userRepository->getCreateRoleUserCountByGame($params);//创角用户
$newDeviceNumList = $userRepository->getNewCreateRoleDeviceCountByGame($params);//新创角设备 $newUserNumList = $userRepository->getNewCreateRoleUserCountByGame($params);//新创角用户
$newIpNumList = $userRepository->getNewCreateRoleIpCountByGame($params);//新创角IP $newDeviceNumList = $userRepository->getNewCreateRoleDeviceCountByGame($params);//新创角设备
$loginUserNumList = $userRepository->getLoginCountGroupByGame($params);//登录用户数 $newIpNumList = $userRepository->getNewCreateRoleIpCountByGame($params);//新创角IP
$spendUserNumList = $spendRepository->getPayUserCountGroupByGame($params);//充值人数 $loginUserNumList = $userRepository->getLoginCountGroupByGame($params);//登录用户数
$spendNumList = $spendRepository->getPayCountGroupByGame($params);//充值次数 $spendUserNumList = $spendRepository->getPayUserCountGroupByGame($params);//充值人数
$spendAllAmountList = $spendRepository->getPayAmountGroupByGameAndType($params);//充值总额 $spendNumList = $spendRepository->getPayCountGroupByGame($params);//充值次数
$params['pay_way'] = ['in', '1,2,3,4,5,6']; $spendAllAmountList = $spendRepository->getPayAmountGroupByGameAndType($params);//充值总额
$spendCashList = $spendRepository->getPayAmountGroupByGameAndType($params);//现金充值 $params['pay_way'] = ['in', '1,2,3,4,5,6'];
$params['pay_way'] = 0; $spendCashList = $spendRepository->getPayAmountGroupByGameAndType($params);//现金充值
$spendGenericList = $spendRepository->getPayAmountGroupByGameAndType($params);//通用币充值 $params['pay_way'] = 0;
$params['pay_way'] = -1; $spendGenericList = $spendRepository->getPayAmountGroupByGameAndType($params);//通用币充值
$spendBindingList = $spendRepository->getPayAmountGroupByGameAndType($params);//绑定币充值 $params['pay_way'] = -1;
foreach ($data as &$list) { $spendBindingList = $spendRepository->getPayAmountGroupByGameAndType($params);//绑定币充值
$gameId = $list['game_id']; foreach ($data as &$list) {
$records[] = [ $gameId = $list['game_id'];
'game_id' => $gameId, $records[] = [
'game_name' => $list['game_name'], 'game_id' => $gameId,
'sdk_version' => $list['sdk_version'], 'game_name' => $list['game_name'],
'role_num' => $roleNumList[$gameId], 'sdk_version' => $list['sdk_version'],
'user_num' => $userNumList[$gameId], 'role_num' => $roleNumList[$gameId],
'new_user_num' => $newUserNumList[$gameId], 'user_num' => $userNumList[$gameId],
'new_device_num' => $newDeviceNumList[$gameId], 'new_user_num' => $newUserNumList[$gameId],
'new_ip_num' => $newIpNumList[$gameId], 'new_device_num' => $newDeviceNumList[$gameId],
'login_user_num' => $loginUserNumList[$gameId], 'new_ip_num' => $newIpNumList[$gameId],
'spend_user_num' => $spendUserNumList[$gameId], 'login_user_num' => $loginUserNumList[$gameId],
'spend_num' => $spendNumList[$gameId], 'spend_user_num' => $spendUserNumList[$gameId],
'spend_all_amount' => $spendAllAmountList[$gameId], 'spend_num' => $spendNumList[$gameId],
'spend_cash' => $spendCashList[$gameId], 'spend_all_amount' => $spendAllAmountList[$gameId],
'spend_generic' => $spendGenericList[$gameId], 'spend_cash' => $spendCashList[$gameId],
'spend_binding' => $spendBindingList[$gameId], 'spend_generic' => $spendGenericList[$gameId],
'spend_discount' => 0, 'spend_binding' => $spendBindingList[$gameId],
'spend_voucher' => 0, 'spend_discount' => 0,
]; 'spend_voucher' => 0,
];
$allData['role_num'] += $roleNumList[$gameId];
$allData['user_num'] += $userNumList[$gameId]; $allData['role_num'] += $roleNumList[$gameId];
$allData['new_user_num'] += $newUserNumList[$gameId]; $allData['user_num'] += $userNumList[$gameId];
$allData['new_device_num'] += $newDeviceNumList[$gameId]; $allData['new_user_num'] += $newUserNumList[$gameId];
$allData['new_ip_num'] += $newIpNumList[$gameId]; $allData['new_device_num'] += $newDeviceNumList[$gameId];
$allData['login_user_num'] += $loginUserNumList[$gameId]; $allData['new_ip_num'] += $newIpNumList[$gameId];
$allData['spend_user_num'] += $spendUserNumList[$gameId]; $allData['login_user_num'] += $loginUserNumList[$gameId];
$allData['spend_num'] += $spendNumList[$gameId]; $allData['spend_user_num'] += $spendUserNumList[$gameId];
$allData['spend_all_amount'] = bcadd($allData['spend_all_amount'], $spendAllAmountList[$gameId], 2); $allData['spend_num'] += $spendNumList[$gameId];
$allData['spend_cash'] = bcadd($allData['spend_cash'], $spendCashList[$gameId], 2); $allData['spend_all_amount'] = bcadd($allData['spend_all_amount'], $spendAllAmountList[$gameId], 2);
$allData['spend_generic'] = bcadd($allData['spend_generic'], $spendGenericList[$gameId], 2); $allData['spend_cash'] = bcadd($allData['spend_cash'], $spendCashList[$gameId], 2);
$allData['spend_binding'] = bcadd($allData['spend_binding'], $spendBindingList[$gameId], 2); $allData['spend_generic'] = bcadd($allData['spend_generic'], $spendGenericList[$gameId], 2);
$allData['spend_discount'] = bcadd($allData['spend_discount'], 0, 2); $allData['spend_binding'] = bcadd($allData['spend_binding'], $spendBindingList[$gameId], 2);
$allData['spend_voucher'] = bcadd($allData['spend_voucher'], 0, 2); $allData['spend_discount'] = bcadd($allData['spend_discount'], 0, 2);
$allData['spend_voucher'] = bcadd($allData['spend_voucher'], 0, 2);
}
} }
} }

Loading…
Cancel
Save