diff --git a/Application/Home/Controller/DownloadController.class.php b/Application/Home/Controller/DownloadController.class.php index ba12f01d4..a7ccef0bf 100644 --- a/Application/Home/Controller/DownloadController.class.php +++ b/Application/Home/Controller/DownloadController.class.php @@ -2401,6 +2401,9 @@ public function iosDetailExcelInfo($id,$map) { $accessNum = count($rs)?:0 ; $perSize = 5000;//每次查询的条数 $pages = ceil($accessNum / $perSize); + if ($pages == 0) { + $pages = 1; + } for($i = 1; $i <= $pages; $i++) { $data = M('promote', 'tab_')->field(['id'])->where($map1) ->limit(($i-1)*$perSize ,$perSize)->select(); @@ -2429,13 +2432,14 @@ public function iosDetailExcelInfo($id,$map) { $tfCounts = M('package_download_log', 'tab_')->where($tfMap)->count(); //TF下载量 $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) { + $usersCounts = M('user', 'tab_')->where(['promote_id' => $id, 'device_type'=>2])->count(); + $tfpercent = number_format((intval($tfCounts) / intval($usersCounts)),2,'.','') * 100; + + if (intval($usersCounts) == 0) { $tfpercent = 0; } $csvData['userscounts'] = intval($usersCounts); - $csvData['ioscount'] = $iosCount; + $csvData['ioscount'] = $iosCount; $csvData['tfcounts'] = intval($tfCounts).'('.$tfpercent.'%)'; $csvData['supercounts'] = intval($superCounts); $csvData['companycounts'] = intval($companyCounts); @@ -2480,7 +2484,7 @@ public function iosDetailExcelInfo($id,$map) { $allData['account'] = '汇总'; $allData['userscounts'] = $allUsersCounts; $allData['iosycounts'] = $allIosCounts; - $allData['tfcounts'] = $allTFCounts; + $allData['tfcounts'] = $allTFCounts.'('.(number_format((intval($allTFCounts) / intval($allUsersCounts)),2,'.','') * 100).'%)'; $allData['supercounts'] = $allSuperCounts; $allData['companycounts'] = $allCompanyCounts; diff --git a/Application/Home/Controller/QueryController.class.php b/Application/Home/Controller/QueryController.class.php index ee9e7b7f5..3998fc6ec 100644 --- a/Application/Home/Controller/QueryController.class.php +++ b/Application/Home/Controller/QueryController.class.php @@ -2581,15 +2581,16 @@ class QueryController extends BaseController $tfCounts = M('package_download_log', 'tab_')->where($tfMap)->count(); //TF下载量 $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, 'device_type' => 2])->count(); $listData[$key]['userscounts'] = intval($usersCounts); + $listData[$key]['tfcounts'] = intval($tfCounts); + $listData[$key]['tfpercent'] = number_format((intval($tfCounts) / intval($usersCounts)),2,'.','') * 100; + + if (intval($usersCounts) == 0) { + $listData[$key]['tfpercent'] = 0; + } if($promote['level'] == 1) { $listData[$key]['belongs_president'] = $promote['account']; $listData[$key]['belongs_department'] = "无所属部门长"; @@ -2620,7 +2621,11 @@ class QueryController extends BaseController $listData[$key]['belongs_group'] = $groupAccount; } } - + $totalpercent = number_format($allTFCounts/$allUsersCounts,2,'.','') * 100; + if ($allUsersCounts == 0) { + $totalpercent = '0'; + } + $this->assign('totalpercent', $totalpercent); $this->assign('listdata', $listData); $this->assign('totaluserscounts', $allUsersCounts); $this->assign('totaltfcounts', $allTFCounts); diff --git a/Application/Home/View/default/Query/iosDownLoadData.html b/Application/Home/View/default/Query/iosDownLoadData.html index 96d0bf0f5..85cdfb140 100644 --- a/Application/Home/View/default/Query/iosDownLoadData.html +++ b/Application/Home/View/default/Query/iosDownLoadData.html @@ -46,7 +46,7 @@