|
|
|
@ -1067,6 +1067,7 @@ class QueryController extends BaseController
|
|
|
|
|
$initEndTime = empty(I('endtime')) ? $initEndTime : I('endtime');
|
|
|
|
|
$begTime = strtotime($initBegTime);
|
|
|
|
|
$endTime = strtotime($initEndTime);
|
|
|
|
|
$endTime += + 3600 * 24;
|
|
|
|
|
$levelPromote = $this->getLevelPromote();
|
|
|
|
|
$queryPromote = $this->getQueryPromote($levelPromote);
|
|
|
|
|
|
|
|
|
@ -1083,12 +1084,12 @@ class QueryController extends BaseController
|
|
|
|
|
|
|
|
|
|
$params['promote_id'] = $ids;
|
|
|
|
|
}
|
|
|
|
|
if ($relationGameId > 0 || $serverId > 0) {
|
|
|
|
|
if ($relationGameId > 0 || $sdkVersion > 0) {
|
|
|
|
|
if ($sdkVersion > 0) {
|
|
|
|
|
$map['sdk_version'] = $sdkVersion;
|
|
|
|
|
}
|
|
|
|
|
if ($relationGameId > 0) {
|
|
|
|
|
$map = ['relation_game_id' => $relationGameId];
|
|
|
|
|
$map['relation_game_id'] = $relationGameId;
|
|
|
|
|
}
|
|
|
|
|
$gameIds = M('Game', 'tab_')->where($map)->getField('id', true);
|
|
|
|
|
if (empty($gameIds)) {
|
|
|
|
@ -1102,7 +1103,7 @@ class QueryController extends BaseController
|
|
|
|
|
$params['end_time'] = $endTime;
|
|
|
|
|
|
|
|
|
|
$summaryData = [];
|
|
|
|
|
$dayList = $this->getDayList($begTime, $endTime + 3600 * 24);
|
|
|
|
|
$dayList = $this->getDayList($begTime, $endTime);
|
|
|
|
|
$params['dayList'] = $dayList;
|
|
|
|
|
|
|
|
|
|
$records = [];
|
|
|
|
@ -1114,8 +1115,8 @@ class QueryController extends BaseController
|
|
|
|
|
$newUserNumList = $userRepository->getNewCreateRoleUserCountByDay($params);//新创角用户
|
|
|
|
|
$newDeviceNumList = $userRepository->getNewCreateRoleDeviceCountByDay($params);//新创角设备
|
|
|
|
|
$newIpNumList = $userRepository->getNewCreateRoleIpCountByDay($params);//新创角IP
|
|
|
|
|
$loginUserNumList = $userRepository->getLoginCountGroupByDay($params);//登录用户数
|
|
|
|
|
$spendUserNumList = $spendRepository->getPayUserCountGroupByDay($params);//充值人数
|
|
|
|
|
$loginUserNumList = $userRepository->getLoginCountGroupByDayNew($params);//登录用户数
|
|
|
|
|
$spendUserNumList = $spendRepository->getPayUserCountGroupByDayNew($params);//充值人数
|
|
|
|
|
$spendNumList = $spendRepository->getPayCountGroupByDay($params);//充值次数
|
|
|
|
|
$spendAllAmountList = $spendRepository->getPayAmountGroupByDayAndType($params);//充值总额
|
|
|
|
|
$params['pay_way'] = ['in', '1,2,3,4,5,6'];
|
|
|
|
@ -1222,6 +1223,7 @@ class QueryController extends BaseController
|
|
|
|
|
$initEndTime = empty(I('endtime')) ? $initEndTime : I('endtime');
|
|
|
|
|
$begTime = strtotime($initBegTime);
|
|
|
|
|
$endTime = strtotime($initEndTime);
|
|
|
|
|
$endTime += 3600 * 24;
|
|
|
|
|
$levelPromote = $this->getLevelPromote();
|
|
|
|
|
$queryPromote = $this->getQueryPromote($levelPromote);
|
|
|
|
|
|
|
|
|
@ -1242,9 +1244,7 @@ class QueryController extends BaseController
|
|
|
|
|
$ownId = intval(I('own_id'), 0);//本账号
|
|
|
|
|
if ($ownId) {
|
|
|
|
|
$map['a.promote_id'] = $queryPromote['id'];
|
|
|
|
|
$userPlayInfoMap['tab_user_play_info.promote_id'] = $queryPromote['id'];
|
|
|
|
|
$userGameLoginMap['tab_user_game_login_record.promote_id'] = $queryPromote['id'];
|
|
|
|
|
$spendMap['tab_spend.promote_id'] = $queryPromote['id'];
|
|
|
|
|
$params['promote_ids'] = $queryPromote['id'];
|
|
|
|
|
} else {
|
|
|
|
|
$map['chain'] = ['like', $queryPromote['chain'] . $queryPromote['id'] . '/%'];
|
|
|
|
|
$ids = M('promote', 'tab_')->where($map)->getField('id', true);
|
|
|
|
@ -1252,9 +1252,7 @@ class QueryController extends BaseController
|
|
|
|
|
|
|
|
|
|
$map = [];
|
|
|
|
|
$map['a.promote_id'] = ['in', $ids];
|
|
|
|
|
$userPlayInfoMap['tab_user_play_info.promote_id'] = ['in', $ids];
|
|
|
|
|
$userGameLoginMap['tab_user_game_login_record.promote_id'] = ['in', $ids];
|
|
|
|
|
$spendMap['tab_spend.promote_id'] = ['in', $ids];
|
|
|
|
|
$params['promote_ids'] = $ids;
|
|
|
|
|
}
|
|
|
|
|
if ($relationGameId > 0) {
|
|
|
|
|
$map['g.relation_game_id'] = $relationGameId;
|
|
|
|
@ -1266,19 +1264,11 @@ class QueryController extends BaseController
|
|
|
|
|
if ($serverId > 0) {
|
|
|
|
|
$serverJoin = 'tab_server as s on s.game_id = a.game_id';
|
|
|
|
|
$map['s.server_id'] = $serverId;
|
|
|
|
|
$userPlayInfoMap['tab_user_play_info.server_id'] = $serverId;
|
|
|
|
|
$userGameLoginMap['tab_user_game_login_record.server_id'] = $serverId;
|
|
|
|
|
$spendMap['tab_spend.server_id'] = $serverId;
|
|
|
|
|
$params['server_id'] = $serverId;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$userPlayInfoMap2 = $userPlayInfoMap;
|
|
|
|
|
$userPlayInfoMap['tab_user_play_info.create_time'] = ['between', [$begTime, $endTime + 86399]];
|
|
|
|
|
$userGameLoginMap['tab_user_game_login_record.login_time'] = ['between', [$begTime, $endTime + 86399]];
|
|
|
|
|
$spendMap['tab_spend.pay_time'] = ['between', [$begTime, $endTime + 86399]];
|
|
|
|
|
$spendMap['tab_spend.pay_status'] = 1;
|
|
|
|
|
$userPlayInfoModel = M('UserPlayInfo', 'tab_');
|
|
|
|
|
$userGameLoginModel = M('UserGameLoginRecord', 'tab_');
|
|
|
|
|
$spendModel = M('Spend', 'tab_');
|
|
|
|
|
$params['begin_time'] = $begTime;
|
|
|
|
|
$params['end_time'] = $endTime;
|
|
|
|
|
|
|
|
|
|
$data = M('Apply', 'tab_')->alias('a')
|
|
|
|
|
->field('a.game_id,a.game_name,a.sdk_version')
|
|
|
|
@ -1295,6 +1285,7 @@ class QueryController extends BaseController
|
|
|
|
|
->where($map)
|
|
|
|
|
->count('distinct a.game_id');
|
|
|
|
|
|
|
|
|
|
$records = [];
|
|
|
|
|
$allData['role_num'] = 0;
|
|
|
|
|
$allData['user_num'] = 0;
|
|
|
|
|
$allData['new_user_num'] = 0;
|
|
|
|
@ -1310,68 +1301,65 @@ 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) {
|
|
|
|
|
$userPlayInfoMap['tab_user_play_info.game_id'] = $list['game_id'];
|
|
|
|
|
$userPlayInfoMap2['tab_user_play_info.game_id'] = $list['game_id'];
|
|
|
|
|
$userGameLoginMap['tab_user_game_login_record.game_id'] = $list['game_id'];
|
|
|
|
|
$spendMap['tab_spend.game_id'] = $list['game_id'];
|
|
|
|
|
|
|
|
|
|
$thisData = $userPlayInfoModel
|
|
|
|
|
->field('count(*) as role_num,count(distinct tab_user_play_info.user_id) as user_num')
|
|
|
|
|
->where($userPlayInfoMap)
|
|
|
|
|
->find();
|
|
|
|
|
$list['role_num'] = $thisData['role_num'];//创角数
|
|
|
|
|
$list['user_num'] = $thisData['user_num'];//创角用户
|
|
|
|
|
|
|
|
|
|
$thisData = $userPlayInfoModel
|
|
|
|
|
->field('tab_user_play_info.create_time,count(distinct tab_user_play_info.user_id) as new_user_num,
|
|
|
|
|
count(distinct tab_user_play_info.create_device_number) as new_device_num,
|
|
|
|
|
count(distinct tab_user_play_info.create_ip) as new_ip_num')
|
|
|
|
|
->where($userPlayInfoMap2)
|
|
|
|
|
->having('tab_user_play_info.create_time between ' . $begTime . ' and ' . ($endTime + 86399))
|
|
|
|
|
->order('tab_user_play_info.id')
|
|
|
|
|
->find();
|
|
|
|
|
$list['new_user_num'] = empty($thisData['new_user_num']) ? 0 : $thisData['new_user_num'];//新创角用户
|
|
|
|
|
$list['new_device_num'] = empty($thisData['new_device_num']) ? 0 : $thisData['new_device_num'];//新创角设备
|
|
|
|
|
$list['new_ip_num'] = empty($thisData['new_ip_num']) ? 0 : $thisData['new_ip_num'];//新增创角IP
|
|
|
|
|
|
|
|
|
|
$list['login_user_num'] = count($userGameLoginModel
|
|
|
|
|
->where($userGameLoginMap)
|
|
|
|
|
->group('tab_user_game_login_record.game_id,tab_user_game_login_record.user_id')
|
|
|
|
|
->select());//登录用户数
|
|
|
|
|
|
|
|
|
|
$thisData = $spendModel
|
|
|
|
|
->field('count(distinct tab_spend.user_id) as spend_user_num,count(*) as spend_num,
|
|
|
|
|
sum(tab_spend.pay_amount) as spend_all_amount,
|
|
|
|
|
sum(if(tab_spend.pay_way > 0,tab_spend.pay_amount,0)) as spend_cash,
|
|
|
|
|
sum(if(tab_spend.pay_way = 0,tab_spend.pay_amount,0)) as spend_generic,
|
|
|
|
|
sum(if(tab_spend.pay_way = -1,tab_spend.pay_amount,0)) as spend_binding')
|
|
|
|
|
->where($spendMap)
|
|
|
|
|
->find();
|
|
|
|
|
$list['spend_user_num'] = $thisData['spend_user_num'];//充值人数
|
|
|
|
|
$list['spend_num'] = $thisData['spend_num'];//充值次数
|
|
|
|
|
$list['spend_all_amount'] = $thisData['spend_all_amount'];//充值总额
|
|
|
|
|
$list['spend_cash'] = $thisData['spend_cash'];//现金充值
|
|
|
|
|
$list['spend_generic'] = $thisData['spend_generic'];//通用币
|
|
|
|
|
$list['spend_binding'] = $thisData['spend_binding'];//绑定币
|
|
|
|
|
|
|
|
|
|
$list['spend_discount'] = 0;//折扣币
|
|
|
|
|
$list['spend_voucher'] = 0;//代金券
|
|
|
|
|
|
|
|
|
|
$allData['role_num'] += $list['role_num'];
|
|
|
|
|
$allData['user_num'] += $list['user_num'];
|
|
|
|
|
$allData['new_user_num'] += $list['new_user_num'];
|
|
|
|
|
$allData['new_device_num'] += $list['new_device_num'];
|
|
|
|
|
$allData['new_ip_num'] += $list['new_ip_num'];
|
|
|
|
|
$allData['login_user_num'] += $list['login_user_num'];
|
|
|
|
|
$allData['spend_user_num'] += $list['spend_user_num'];
|
|
|
|
|
$allData['spend_num'] += $list['spend_num'];
|
|
|
|
|
$allData['spend_all_amount'] = bcadd($allData['spend_all_amount'], $list['spend_all_amount'], 2);
|
|
|
|
|
$allData['spend_cash'] = bcadd($allData['spend_cash'], $list['spend_cash'], 2);
|
|
|
|
|
$allData['spend_generic'] = bcadd($allData['spend_generic'], $list['spend_generic'], 2);
|
|
|
|
|
$allData['spend_binding'] = bcadd($allData['spend_binding'], $list['spend_binding'], 2);
|
|
|
|
|
$allData['spend_discount'] = bcadd($allData['spend_discount'], $list['spend_discount'], 2);
|
|
|
|
|
$allData['spend_voucher'] = bcadd($allData['spend_voucher'], $list['spend_voucher'], 2);
|
|
|
|
|
$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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1385,7 +1373,7 @@ class QueryController extends BaseController
|
|
|
|
|
$this->assign('loginPromote', $loginPromote);
|
|
|
|
|
$this->assign('ownId', $ownId);
|
|
|
|
|
$this->assign('allData', $allData);
|
|
|
|
|
$this->assign('listData', $data);
|
|
|
|
|
$this->assign('listData', $records);
|
|
|
|
|
$this->assign('count', $count);
|
|
|
|
|
$this->assign('setdate', date("Y-m-d"));
|
|
|
|
|
$this->assign('initBegTime', $initBegTime);
|
|
|
|
|