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

master
chenxiaojun 5 years ago
parent 7220247ecd
commit a32565e2e1

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

Loading…
Cancel
Save