diff --git a/Application/Home/Controller/DownloadController.class.php b/Application/Home/Controller/DownloadController.class.php index 3388bde9e..ba12f01d4 100644 --- a/Application/Home/Controller/DownloadController.class.php +++ b/Application/Home/Controller/DownloadController.class.php @@ -255,19 +255,15 @@ class DownloadController extends BaseController { $map['chain'] = ['like', $queryPromote['chain'] . $queryPromote['id'] . '/%']; } $createTime = I('create_time', ''); - if ($createTime != '') { - $createTimeRow = explode(' 至 ', $createTime); - $createTimeBegin = 0; - $createTimeEnd = 0; - if (count($createTimeRow) == 2) { - $createTimeBegin = strtotime($createTimeRow[0] . ' 00:00:00'); - $createTimeEnd = strtotime($createTimeRow[1] . ' 23:59:59'); - } else { - $createTimeBegin = strtotime($createTimeRow[0] . ' 00:00:00'); - $createTimeEnd = strtotime($createTimeRow[0] . ' 23:59:59'); - } - $map['create_time'] = ['between', [$createTimeBegin, $createTimeEnd]]; - } + $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; + $map['create_time'] = ['between', [$begTime, $endTime]]; $map['pid'] = PID; $conditions = json_encode($map,TRUE); $addtime = time(); @@ -2343,7 +2339,8 @@ public function iosDetailExcelInfo($id,$map) { $xlsName ="IOS下载数统计"; $xlsCell = array( '推广员账号', - '玩家人数', + 'IOS用户总数', + '新增IOS用户总数', 'TF下载次数', '超级签下载次数', '企业签下载次数', @@ -2357,10 +2354,15 @@ public function iosDetailExcelInfo($id,$map) { $map1['chain'] = $map['chain']; } if (!empty($map['create_time'])) { - $map1['create_time'] = $map['create_time']; + // $map1['create_time'] = $map['create_time']; $tfMap['create_time'] = $map['create_time']; $companyMap['create_time'] = $map['create_time']; $superMap['create_time'] = $map['create_time']; + $allTFMap['create_time'] = $map['create_time']; + $companyMap['create_time'] = $map['create_time']; + $allSuperMap['create_time'] = $map['create_time']; + $iosTimeMap['register_time'] = $map['create_time']; + $alliosMap['register_time'] = $map['create_time']; } if (!empty($map['id'])) { $map1['id'] = $map['id']; @@ -2372,6 +2374,7 @@ public function iosDetailExcelInfo($id,$map) { $allids = array_column($rs, 'id'); array_push($allids, PID); $allUserMap['promote_id'] = ['in', $allids]; + $allUserMap['device_type'] = 2; $allTFMap['promote_id'] = ['in', $allids]; $allTFMap['type'] = 2; $allSuperMap['promote_id'] = ['in', $allids]; @@ -2382,6 +2385,9 @@ public function iosDetailExcelInfo($id,$map) { $allTFCounts = M('package_download_log', 'tab_')->where($allTFMap)->count(); $allSuperCounts = M('package_download_log', 'tab_')->where($allSuperMap)->count(); $allCompanyCounts = M('package_download_log', 'tab_')->where($companyMap)->count(); + $alliosMap['promote_id'] = ['in', $allids]; + $alliosMap['device_type'] = 2; + $allIosCounts = M('user', 'tab_')->where($alliosMap)->count(); $csvFileName = $xlsName.'.csv'; header('Content-Description: File Transfer'); header('Content-Type: application/vnd.ms-excel'); @@ -2406,13 +2412,14 @@ public function iosDetailExcelInfo($id,$map) { $promote1 = M('promote', 'tab_')->field('account, level, parent_id, chain')->where(['id' => $id])->select(); $promote = $promote1[0]; $chain = $promote['chain']; - //$csvData['promote_id'] = $id; if($id == PID) { $csvData['account'] = $promote['account'].'[自己]'; }else { $csvData['account'] = $promote['account']; } - + $iosTimeMap['promote_id'] = $id; + $iosTimeMap['device_type'] = 2; + $iosCount = M('user', 'tab_')->where($iosTimeMap)->count(); $tfMap['promote_id'] = $id; $tfMap['type'] = 2; $companyMap['promote_id'] = $id; @@ -2423,8 +2430,13 @@ public function iosDetailExcelInfo($id,$map) { $companyCounts = M('package_download_log', 'tab_')->where($companyMap)->count(); //企业签下载量 $superCounts = M('package_download_log', 'tab_')->where($superMap)->count(); //超级签下载量 $usersCounts = M('user', 'tab_')->where(['promote_id' => $id])->count(); + $tfpercent = 1; + if ($iosCount == 0) { + $tfpercent = 0; + } $csvData['userscounts'] = intval($usersCounts); - $csvData['tfcounts'] = intval($tfCounts); + $csvData['ioscount'] = $iosCount; + $csvData['tfcounts'] = intval($tfCounts).'('.$tfpercent.'%)'; $csvData['supercounts'] = intval($superCounts); $csvData['companycounts'] = intval($companyCounts); @@ -2467,6 +2479,7 @@ public function iosDetailExcelInfo($id,$map) { } $allData['account'] = '汇总'; $allData['userscounts'] = $allUsersCounts; + $allData['iosycounts'] = $allIosCounts; $allData['tfcounts'] = $allTFCounts; $allData['supercounts'] = $allSuperCounts; $allData['companycounts'] = $allCompanyCounts; diff --git a/Application/Home/Controller/QueryController.class.php b/Application/Home/Controller/QueryController.class.php index 242eb2795..ee9e7b7f5 100644 --- a/Application/Home/Controller/QueryController.class.php +++ b/Application/Home/Controller/QueryController.class.php @@ -2491,7 +2491,6 @@ class QueryController extends BaseController } public function iosDownLoadData() { - $page = intval(I('get.p', 1)); $page = $page ? $page : 1; //默认显示第一页数据arraypage $row = intval(I('get.row', 10)); @@ -2504,31 +2503,32 @@ class QueryController extends BaseController }else { $map['chain'] = ['like', $queryPromote['chain'] . $queryPromote['id'] . '/%']; } - $createTime = I('create_time', ''); - if ($createTime != '') { - $createTimeRow = explode(' 至 ', $createTime); - $createTimeBegin = 0; - $createTimeEnd = 0; - if (count($createTimeRow) == 2) { - $createTimeBegin = strtotime($createTimeRow[0] . ' 00:00:00'); - $createTimeEnd = strtotime($createTimeRow[1] . ' 23:59:59'); - } else { - $createTimeBegin = strtotime($createTimeRow[0] . ' 00:00:00'); - $createTimeEnd = strtotime($createTimeRow[0] . ' 23:59:59'); - } - $tfMap['create_time'] = ['between', [$createTimeBegin, $createTimeEnd]]; - $companyMap['create_time'] = ['between', [$createTimeBegin, $createTimeEnd]]; - $superMap['create_time'] = ['between', [$createTimeBegin, $createTimeEnd]]; + $iostime = time(); + $sunday = strtotime('-1 sunday', $iostime) + 24 * 3600; + if (I('begtime') && I('endtime')) { + $iostime = strtotime(I('endtime')); + $sunday = strtotime(I('begtime')); } + $iosTimeMap['register_time'] = ['between', [$sunday, $iostime]]; + $createTime = I('create_time', ''); + $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; + $tfMap['create_time'] = ['between', [$begTime, $endTime]]; + $companyMap['create_time'] = ['between', [$begTime, $endTime]]; + $superMap['create_time'] = ['between', [$begTime, $endTime]]; + $query = M('promote', 'tab_')->field(['id'])->where($map); list($promotes, $pagination, $count) = $this->paginate($query); $ids = array_column($promotes, 'id'); if ($page == 1) { array_push($ids, PID); } - // var_dump($ids);die(); - // $ids = M('promote', 'tab_')->where($map)->getField('id', true); - // $ids[] = $queryPromote['id']; $allPromote = M('promote', 'tab_')->field(['id'])->where($map)->select(); $allids = array_column($allPromote, 'id'); array_push($allids, PID); @@ -2538,13 +2538,22 @@ class QueryController extends BaseController // $data = M('package_download_log','tab_')->where($map)->select(); $listData = []; $allUserMap['promote_id'] = ['in', $allids]; + $allUserMap['device_type'] = 2; $allTFMap['promote_id'] = ['in', $allids]; $allTFMap['type'] = 2; + $allTFMap['create_time'] = ['between', [$begTime, $endTime]]; $allSuperMap['promote_id'] = ['in', $allids]; $allSuperMap['type'] = 3; + $allSuperMap['create_time'] = ['between', [$begTime, $endTime]]; $companyMap['promote_id'] = ['in', $allids]; $companyMap['type'] = 1; + $companyMap['create_time'] = ['between', [$begTime, $endTime]]; + $alliosMap['promote_id'] = ['in', $allids]; + $alliosMap['device_type'] = 2; + $alliosMap['register_time'] = ['between', [$sunday, $iostime]]; $allUsersCounts = M('user', 'tab_')->where($allUserMap)->count(); + $allIosCounts = M('user', 'tab_')->where($alliosMap)->count(); + $allTFCounts = M('package_download_log', 'tab_')->where($allTFMap)->count(); $allSuperCounts = M('package_download_log', 'tab_')->where($allSuperMap)->count(); $allCompanyCounts = M('package_download_log', 'tab_')->where($companyMap)->count(); @@ -2559,6 +2568,10 @@ class QueryController extends BaseController }else { $listData[$key]['account'] = $promote['account']; } + $iosTimeMap['promote_id'] = $id; + $iosTimeMap['device_type'] = 2; + $iosCount = M('user', 'tab_')->where($iosTimeMap)->count(); + $listData[$key]['ioscount'] = $iosCount; $tfMap['promote_id'] = $id; $tfMap['type'] = 2; $companyMap['promote_id'] = $id; @@ -2569,9 +2582,13 @@ class QueryController extends BaseController $companyCounts = M('package_download_log', 'tab_')->where($companyMap)->count(); //企业签下载量 $superCounts = M('package_download_log', 'tab_')->where($superMap)->count(); //超级签下载量 $listData[$key]['tfcounts'] = intval($tfCounts); + $listData[$key]['tfpercent'] = (intval($tfcounts) / intval($iosCount)) * 100; + if (intval($iosCount) == 0) { + $listData[$key]['tfpercent'] = 0; + } $listData[$key]['companycounts'] = intval($companyCounts); $listData[$key]['supercounts'] = intval($superCounts); - $usersCounts = M('user', 'tab_')->where(['promote_id' => $id])->count(); + $usersCounts = M('user', 'tab_')->where(['promote_id' => $id, 'device_type' => 2])->count(); $listData[$key]['userscounts'] = intval($usersCounts); if($promote['level'] == 1) { $listData[$key]['belongs_president'] = $promote['account']; @@ -2610,6 +2627,10 @@ class QueryController extends BaseController $this->assign('totalsupercounts', $allSuperCounts); $this->assign('pagination', $pagination); $this->assign('totalcompanycounts', $allCompanyCounts); + $this->assign('initBegTime', $initBegTime); + $this->assign('initEndTime', $initEndTime); + $this->assign('allIosCounts', $allIosCounts); + $this->assign('tfpercent', $tfpercent); $this->display(); } @@ -2619,22 +2640,21 @@ class QueryController extends BaseController $belongs_department = $_REQUEST['belongs_department']; $belongs_group = $_REQUEST['belongs_group']; $createTime = I('create_time', ''); - if ($createTime != '') { - $createTimeRow = explode(' 至 ', $createTime); - $createTimeBegin = 0; - $createTimeEnd = 0; - if (count($createTimeRow) == 2) { - $createTimeBegin = strtotime($createTimeRow[0] . ' 00:00:00'); - $createTimeEnd = strtotime($createTimeRow[1] . ' 23:59:59'); - } else { - $createTimeBegin = strtotime($createTimeRow[0] . ' 00:00:00'); - $createTimeEnd = strtotime($createTimeRow[0] . ' 23:59:59'); - } - $map['create_time'] = ['between', [$createTimeBegin, $createTimeEnd]]; - $tfMap['create_time'] = ['between', [$createTimeBegin, $createTimeEnd]]; - $superMap['create_time'] = ['between', [$createTimeBegin, $createTimeEnd]]; - $companyMap['create_time'] = ['between', [$createTimeBegin, $createTimeEnd]]; - } + + $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; + + $map['create_time'] = ['between', [$begTime, $endTime]]; + $tfMap['create_time'] = ['between', [$begTime, $endTime]]; + $superMap['create_time'] = ['between', [$begTime, $endTime]]; + $companyMap['create_time'] = ['between', [$begTime, $endTime]]; + if(!empty(I('user_account'))) { $user_id = M('user', 'tab_')->where(['account'=>I('user_account')])->getField('id'); $map['user_id'] = $user_id; diff --git a/Application/Home/View/default/Query/iosDownLoadData.html b/Application/Home/View/default/Query/iosDownLoadData.html index 5b25bb354..96d0bf0f5 100644 --- a/Application/Home/View/default/Query/iosDownLoadData.html +++ b/Application/Home/View/default/Query/iosDownLoadData.html @@ -25,9 +25,15 @@