|
|
|
@ -2279,78 +2279,50 @@ class DownloadController extends BaseController
|
|
|
|
|
* 数据汇总添加下载
|
|
|
|
|
* @author sunke
|
|
|
|
|
*/
|
|
|
|
|
public function summary_data_export() {
|
|
|
|
|
$promoteId = I('promote_id',0);
|
|
|
|
|
$teamLeaderId = I('team_leader_id',0);
|
|
|
|
|
$own_id = I('own_id',0);
|
|
|
|
|
$relation_game_id = I('relation_game_id',0);
|
|
|
|
|
$sdk_version = I('sdk_version',0);
|
|
|
|
|
$begtime = I('begtime','');
|
|
|
|
|
$endtime = I('endtime','');
|
|
|
|
|
// $childPromoteIds = getAllChildPromoteList(3);
|
|
|
|
|
$map1['chain'] = ['like','%'.'/'.PID.'/'.'%'];
|
|
|
|
|
$rs = M('promote','tab_')->where($map1)->field('id,account,nickname')->select();
|
|
|
|
|
$childPromoteIds = '';
|
|
|
|
|
if(empty($rs)) {
|
|
|
|
|
$map['tab_apply.promote_id'] = PID;
|
|
|
|
|
}else {
|
|
|
|
|
foreach ($rs as $rsKey => $rsValue) {
|
|
|
|
|
$id = $rsValue['id'];
|
|
|
|
|
$childPromoteIds .= $id.',';
|
|
|
|
|
}
|
|
|
|
|
$childPromoteIds = rtrim($childPromoteIds, ',');
|
|
|
|
|
$childPromoteIds .= ',' . PID;
|
|
|
|
|
$map['tab_apply.promote_id'] = ['in', $childPromoteIds];
|
|
|
|
|
}
|
|
|
|
|
public function summary_data_export()
|
|
|
|
|
{
|
|
|
|
|
$ownId = intval(I('own_id'), 0);//本账号
|
|
|
|
|
$relationGameId = intval(I('relation_game_id', 0));
|
|
|
|
|
$sdkVersion = intval(I('sdk_version', 0));
|
|
|
|
|
$serverId = I('server_id', '');
|
|
|
|
|
$nowTime = date('Y-m-d');
|
|
|
|
|
$initBegTime = date('Y-m-d', strtotime('-6 day', strtotime($nowTime)));
|
|
|
|
|
$initBegTime = empty(I('begtime')) ? $initBegTime : I('begtime');
|
|
|
|
|
$initEndTime = $nowTime;
|
|
|
|
|
$initEndTime = empty(I('endtime')) ? $initEndTime : I('endtime');
|
|
|
|
|
$begTime = strtotime($initBegTime);
|
|
|
|
|
$endTime = strtotime($initEndTime);
|
|
|
|
|
$endTime += 3600 * 24;
|
|
|
|
|
$levelPromote = $this->getLevelPromote();
|
|
|
|
|
$queryPromote = $this->getQueryPromote($levelPromote);
|
|
|
|
|
$map2[] = [
|
|
|
|
|
'_logic' => 'or',
|
|
|
|
|
'id' => $queryPromote['id'],
|
|
|
|
|
'chain' => ['like', $queryPromote['chain'] . $queryPromote['id'] . '/%']
|
|
|
|
|
];
|
|
|
|
|
$ids = M('promote', 'tab_')->where($map2)->getField('id', true);
|
|
|
|
|
if(empty($ids)) {
|
|
|
|
|
$ids = array();
|
|
|
|
|
}
|
|
|
|
|
if(empty($levelPromote)) {
|
|
|
|
|
array_push($ids,PID);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
// array_push($ids,$queryPromote['id']);
|
|
|
|
|
if (!empty($ids)) {
|
|
|
|
|
$map['tab_apply.promote_id'] = ['in',$ids];
|
|
|
|
|
$loginPromote = $this->getLoginPromote();
|
|
|
|
|
|
|
|
|
|
$params = [];
|
|
|
|
|
$map = [];
|
|
|
|
|
$map = ['_string' => '1=1'];
|
|
|
|
|
if ($ownId) {
|
|
|
|
|
$params['promote_ids'] = $queryPromote['id'];
|
|
|
|
|
} else {
|
|
|
|
|
$map['_string'] = '1<>1';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!empty($own_id)) {
|
|
|
|
|
if (!empty($map['_string'])) {
|
|
|
|
|
unset($map['_string']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$map['tab_apply.promote_id'] = $queryPromote['id'];//本账号
|
|
|
|
|
|
|
|
|
|
$subMap['chain'] = ['like', $queryPromote['chain'] . $queryPromote['id'] . '/%'];
|
|
|
|
|
$ids = M('promote', 'tab_')->where($subMap)->getField('id', true);
|
|
|
|
|
$ids[] = $queryPromote['id'];
|
|
|
|
|
$params['promote_ids'] = $ids;
|
|
|
|
|
}
|
|
|
|
|
empty($relation_game_id) || $map['tab_game.relation_game_id'] = $relation_game_id;
|
|
|
|
|
empty($sdk_version) || $map['tab_game.sdk_version'] = $sdk_version;
|
|
|
|
|
if(empty($begtime) && empty($endtime)) {
|
|
|
|
|
$nowTime = date('Y-m-d');
|
|
|
|
|
$begtime1 = date('Y-m-d', strtotime('-6 day', strtotime($nowTime)));
|
|
|
|
|
$endtime1 = $nowTime;
|
|
|
|
|
$map["apply_time"] = ["between",[strtotime($begtime1),strtotime($endtime1) + 3600*24]];
|
|
|
|
|
if ($relationGameId > 0) {
|
|
|
|
|
$map['relation_game_id'] = $relationGameId;
|
|
|
|
|
}
|
|
|
|
|
if(!empty($begtime) && !empty($endtime)) {
|
|
|
|
|
$map["apply_time"] = ["between",[strtotime($begtime),strtotime($endtime) + 3600 * 24]];
|
|
|
|
|
if ($sdkVersion > 0) {
|
|
|
|
|
$map['sdk_version'] = $sdkVersion;
|
|
|
|
|
}
|
|
|
|
|
$serverField = '';
|
|
|
|
|
$serverJoin = '';
|
|
|
|
|
if (!empty(I('server_id'))) {
|
|
|
|
|
$map['tab_server.id'] = I('server_id');
|
|
|
|
|
if (!empty($serverId)) {
|
|
|
|
|
$params['server_id'] = $serverId;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$conditions = json_encode($map,TRUE);
|
|
|
|
|
$params['begin_time'] = $begTime;
|
|
|
|
|
$params['end_time'] = $endTime - 1;
|
|
|
|
|
|
|
|
|
|
$conditions = json_encode(['map' => $map, 'params' => $params], true);
|
|
|
|
|
$addtime = time();
|
|
|
|
|
$data = [
|
|
|
|
|
'logid' => 'hz_'.time(),
|
|
|
|
@ -3219,51 +3191,26 @@ public function iosDetailExcelInfo($id,$map) {
|
|
|
|
|
$xlsCell[] = array('spend_discount','折扣币充值');
|
|
|
|
|
$xlsCell[] = array('spend_voucher','代金券使用');
|
|
|
|
|
}
|
|
|
|
|
if(!empty($map['tab_apply.promote_id'][1])) {
|
|
|
|
|
$params['promote_ids'] = $map['tab_apply.promote_id'][1];
|
|
|
|
|
}
|
|
|
|
|
$serverJoin = '';
|
|
|
|
|
$initBegTime = date('Y-m-d', strtotime('-6 day', strtotime($nowTime)));
|
|
|
|
|
$initBegTime = empty(I('begtime')) ? $initBegTime : I('begtime');
|
|
|
|
|
$initEndTime = $nowTime;
|
|
|
|
|
$initEndTime = empty(I('endtime')) ? $initEndTime : I('endtime');
|
|
|
|
|
$begTime = strtotime($initBegTime);
|
|
|
|
|
$endTime = strtotime($initEndTime);
|
|
|
|
|
$params['begin_time'] = $begTime;
|
|
|
|
|
$params['end_time'] = $endTime -1;
|
|
|
|
|
if(!empty($map['apply_time'][1])) {
|
|
|
|
|
$begTime = $map['apply_time'][1][0];
|
|
|
|
|
$endTime = $map['apply_time'][1][1];
|
|
|
|
|
$params['begin_time'] = $begTime;
|
|
|
|
|
$params['end_time'] = $endTime -1;
|
|
|
|
|
unset($map['apply_time']);
|
|
|
|
|
}
|
|
|
|
|
if(!empty($map['tab_server.server_id'])) {
|
|
|
|
|
$serverJoin = 'tab_server on tab_server.game_id = tab_apply.game_id';
|
|
|
|
|
$params['server_id'] = $map['tab_server.server_id'];
|
|
|
|
|
|
|
|
|
|
$loginPromote = $this->getLoginPromote();
|
|
|
|
|
$map = json_decode(json_encode($map), true);
|
|
|
|
|
$gameMap = $map['map'];
|
|
|
|
|
$params = $map['params'];
|
|
|
|
|
|
|
|
|
|
$promoteService = new PromoteService();
|
|
|
|
|
$allGameIs = $promoteService->getHistoryGameIds($loginPromote);
|
|
|
|
|
if ($allGameIs && count($allGameIs) > 0) {
|
|
|
|
|
$gameMap['_string'] .= ' and id in(' . implode(',', $allGameIs) . ')';
|
|
|
|
|
} else {
|
|
|
|
|
$gameMap['_string'] .= '1=0';
|
|
|
|
|
}
|
|
|
|
|
$data = M('Apply', 'tab_')
|
|
|
|
|
->field('tab_apply.game_id,tab_apply.game_name,tab_apply.sdk_version')
|
|
|
|
|
->join('tab_game as g on g.id = tab_apply.game_id')
|
|
|
|
|
->join($serverJoin)//关联区服表
|
|
|
|
|
->where($map)
|
|
|
|
|
->group('tab_apply.game_id')
|
|
|
|
|
->order('g.sort desc,g.id desc')
|
|
|
|
|
->select();
|
|
|
|
|
$allGameIs = M('Apply', 'tab_')
|
|
|
|
|
->field('distinct tab_apply.game_id')
|
|
|
|
|
->join('tab_game as g on g.id = tab_apply.game_id')
|
|
|
|
|
->join($serverJoin)
|
|
|
|
|
->where($map)
|
|
|
|
|
->select();
|
|
|
|
|
$allGameIs = array_column($allGameIs, 'game_id');
|
|
|
|
|
|
|
|
|
|
$data = M('game', 'tab_')->where($gameMap)->order('sort desc,id desc')->select();
|
|
|
|
|
|
|
|
|
|
$records = [];
|
|
|
|
|
if (!empty($data)) {
|
|
|
|
|
if (intval($endTime - $begTime) / (24 * 3600) <= 31) {
|
|
|
|
|
$gameIds = [];
|
|
|
|
|
foreach ($data as $list) {
|
|
|
|
|
$gameIds[] = $list['game_id'];
|
|
|
|
|
}
|
|
|
|
|
$gameIds = array_column($data, 'id');
|
|
|
|
|
$params['game_ids'] = $gameIds;
|
|
|
|
|
$userRepository = new UserRepository();
|
|
|
|
|
$spendRepository = new SpendRepository();
|
|
|
|
@ -3273,6 +3220,7 @@ public function iosDetailExcelInfo($id,$map) {
|
|
|
|
|
$newDeviceNumList = $userRepository->getNewCreateRoleDeviceCountByGame($params);//新创角设备
|
|
|
|
|
$newIpNumList = $userRepository->getNewCreateRoleIpCountByGame($params);//新创角IP
|
|
|
|
|
$loginUserNumList = $userRepository->getLoginCountGroupByGame($params);//登录用户数
|
|
|
|
|
if ($this->canViewUserRecharge) {
|
|
|
|
|
$spendUserNumList = $spendRepository->getPayUserCountGroupByGame($params);//充值人数
|
|
|
|
|
$spendNumList = $spendRepository->getPayCountGroupByGame($params);//充值次数
|
|
|
|
|
$spendAllAmountList = $spendRepository->getPayAmountGroupByGameAndType($params);//充值总额
|
|
|
|
@ -3282,27 +3230,33 @@ public function iosDetailExcelInfo($id,$map) {
|
|
|
|
|
$spendGenericList = $spendRepository->getPayAmountGroupByGameAndType($params);//通用币充值
|
|
|
|
|
$params['pay_way'] = -1;
|
|
|
|
|
$spendBindingList = $spendRepository->getPayAmountGroupByGameAndType($params);//绑定币充值
|
|
|
|
|
foreach ($data as &$list) {
|
|
|
|
|
}
|
|
|
|
|
foreach ($data as $list) {
|
|
|
|
|
$gameId = $list['game_id'];
|
|
|
|
|
$records[] = [
|
|
|
|
|
$record = [
|
|
|
|
|
'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,
|
|
|
|
|
'sdk_version' => $list['sdk_version'] == 1 ? '安卓' : '苹果',
|
|
|
|
|
'role_num' => intval($roleNumList[$gameId]),
|
|
|
|
|
'user_num' => intval($userNumList[$gameId]),
|
|
|
|
|
'new_user_num' => intval($newUserNumList[$gameId]),
|
|
|
|
|
'new_device_num' => intval($newDeviceNumList[$gameId]),
|
|
|
|
|
'new_ip_num' => intval($newIpNumList[$gameId]),
|
|
|
|
|
'login_user_num' => intval($loginUserNumList[$gameId]),
|
|
|
|
|
];
|
|
|
|
|
if ($this->canViewUserRecharge) {
|
|
|
|
|
if ($this->canViewUserRecharge) {
|
|
|
|
|
$record['spend_user_num'] = intval($spendUserNumList[$gameId]);
|
|
|
|
|
$record['spend_num'] = intval($spendNumList[$gameId]);
|
|
|
|
|
$record['spend_all_amount'] = $spendAllAmountList[$gameId];
|
|
|
|
|
$record['spend_cash'] = $spendCashList[$gameId];
|
|
|
|
|
$record['spend_generic'] = $spendGenericList[$gameId];
|
|
|
|
|
$record['spend_binding'] = $spendBindingList[$gameId];
|
|
|
|
|
$record['spend_discount'] = 0;
|
|
|
|
|
$record['spend_voucher'] = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$records[] = $record;
|
|
|
|
|
}
|
|
|
|
|
$params['all_data'] = 1;
|
|
|
|
|
$params['game_ids'] = $allGameIs;
|
|
|
|
@ -3316,14 +3270,6 @@ public function iosDetailExcelInfo($id,$map) {
|
|
|
|
|
$allData['login_user_num'] = $userRepository->getLoginCountGroupByGame($params);//登录用户数
|
|
|
|
|
|
|
|
|
|
if($this->canViewUserRecharge) {
|
|
|
|
|
$record['spend_user_num'] = $spendUserNumList[$gameId];
|
|
|
|
|
$record['spend_num'] = $spendNumList[$gameId];
|
|
|
|
|
$record['spend_all_amount'] = $spendAllAmountList[$gameId];
|
|
|
|
|
$record['spend_cash'] = $spendCashList[$gameId];
|
|
|
|
|
$record['spend_generic'] = $spendGenericList[$gameId];
|
|
|
|
|
$record['spend_binding'] = $spendBindingList[$gameId];
|
|
|
|
|
$record['spend_discount'] = 0;
|
|
|
|
|
$record['spend_voucher'] = 0;
|
|
|
|
|
$allData['spend_user_num'] = $spendRepository->getPayUserCountByGame($params);//充值人数
|
|
|
|
|
$allData['spend_num'] = $spendRepository->getPayCountByGame($params);//充值次数
|
|
|
|
|
unset($params['pay_way']);
|
|
|
|
@ -3338,24 +3284,10 @@ public function iosDetailExcelInfo($id,$map) {
|
|
|
|
|
$allData['spend_voucher'] = '0.00';
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
$records[] = $record;
|
|
|
|
|
$records[] = $allData;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$xlsData = [];
|
|
|
|
|
foreach ($records as $key1 => $value1) {
|
|
|
|
|
if($value1["sdk_version"] == 1) {
|
|
|
|
|
$value1["sdk_version"] = "安卓";
|
|
|
|
|
}
|
|
|
|
|
if($value1["sdk_version"] == 2) {
|
|
|
|
|
$value1["sdk_version"] = "苹果";
|
|
|
|
|
}
|
|
|
|
|
$xlsData[] = $value1;
|
|
|
|
|
}
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $xlsData,$id);
|
|
|
|
|
$this->exportExcel($xlsName, $xlsCell, $records,$id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|