diff --git a/Application/Admin/Controller/ExportController.class.php b/Application/Admin/Controller/ExportController.class.php index 2a6dbf468..c9a91214f 100644 --- a/Application/Admin/Controller/ExportController.class.php +++ b/Application/Admin/Controller/ExportController.class.php @@ -9036,9 +9036,12 @@ class ExportController extends Controller } if ($info['level'] == PromoteModel::LEVEL_GROUP_LEADER) { + $beginThisweek = mktime(0, 0 , 0,date("m"),date("d")-date("w")+1,date("Y")); + $endThisweek = mktime(23,59,59,date("m"),date("d")-date("w")+7,date("Y")); $xlsData = M('promote', 'tab_')->alias('p') - ->field('p.id, p.level, p.account, count(pdl.id) as lowerCount, count(if(pdl.type = 1, 1, null)) as signCount, count(if(pdl.type = 2, 1, null)) as tfCount, count(if(pdl.type = 3, 1, null)) as superSignCount') + ->field('p.id, p.level, p.account, count(u.id) as iosCount, count(if (u.register_time between '. $beginThisweek . ' and ' . $endThisweek .', 1, null)) as weekCount, count(if(pdl.type = 1, 1, null)) as signCount, count(if(pdl.type = 2, 1, null)) as tfCount, count(if(pdl.type = 3, 1, null)) as superSignCount') ->join("tab_package_download_log pdl on pdl.promote_id = p.id $pdlMap", 'left') + ->join("tab_user u on u.promote_id = p.id and u.device_type=2") ->where($map) ->group('p.id') ->select(); @@ -9051,13 +9054,29 @@ class ExportController extends Controller ->group('p.id') ->select(); } - $xlsCell = array( - array('account', PromoteModel::$levelArr[$level]."账号"), - array('lowercount', PromoteModel::$levelArr[$level+1]."数量"), - array('tfcount', 'TF下载数'), - array('supersigncount', "超级签下载数"), - array('signcount', "企业签下载数"), - ); + + if ($info['level'] == PromoteModel::LEVEL_GROUP_LEADER) { + foreach($xlsData as &$item) { + $item['tfcount'] = $item['tfcount'] . "(" . (isset($item['ioscount']) ? round( ($item['tfcount'] / $item['ioscount']) * 100 , 2) : 0) . ")%"; + } + $xlsCell = array( + array('account', PromoteModel::$levelArr[$level]."账号"), + array('ioscount', "iOS用户总数"), + array('weekcount', "新增iOS用户总数"), + array('tfcount', 'TF下载数/iOS用户总数'), + array('supersigncount', "超级签下载数"), + array('signcount', "企业签下载数"), + ); + } else { + $xlsCell = array( + array('account', PromoteModel::$levelArr[$level]."账号"), + array('lowercount', PromoteModel::$levelArr[$level+1]."数量"), + array('tfcount', 'TF下载数'), + array('supersigncount', "超级签下载数"), + array('signcount', "企业签下载数"), + ); + } + $this->exportAddOperationLog('Statistics/packDownload','统计-IOS下载统计-导出'); $this->exportExcel($xlsName, $xlsCell, $xlsData); diff --git a/Application/Admin/Controller/StatisticsController.class.php b/Application/Admin/Controller/StatisticsController.class.php index ec158d31b..bca403702 100644 --- a/Application/Admin/Controller/StatisticsController.class.php +++ b/Application/Admin/Controller/StatisticsController.class.php @@ -1173,16 +1173,20 @@ class StatisticsController extends ThinkController { } if ($info['level'] == PromoteModel::LEVEL_GROUP_LEADER) { + $beginThisweek = mktime(0, 0 , 0,date("m"),date("d")-date("w")+1,date("Y")); + $endThisweek = mktime(23,59,59,date("m"),date("d")-date("w")+7,date("Y")); $list = M('promote', 'tab_')->alias('p') - ->field('p.id, p.level, p.account, count(pdl.id) as lowerCount, count(if(pdl.type = 1, 1, null)) as signCount, count(if(pdl.type = 2, 1, null)) as tfCount, count(if(pdl.type = 3, 1, null)) as superSignCount') + ->field('p.id, p.level, p.account, count(u.id) as iosCount, count(if (u.register_time between '. $beginThisweek . ' and ' . $endThisweek .', 1, null)) as weekCount, count(if(pdl.type = 1, 1, null)) as signCount, count(if(pdl.type = 2, 1, null)) as tfCount, count(if(pdl.type = 3, 1, null)) as superSignCount') ->join("tab_package_download_log pdl on pdl.promote_id = p.id $pdlMap", 'left') + ->join("tab_user u on u.promote_id = p.id and u.device_type=2") ->where($map) ->page($p, $row) ->group('p.id') ->select(); $total = M('promote', 'tab_')->alias('p') - ->field('count(pdl.id) as lowerCount, count(if(pdl.type = 1, 1, null)) as signCount, count(if(pdl.type = 2, 1, null)) as tfCount, count(if(pdl.type = 3, 1, null)) as superSignCount') + ->field('count(distinct(u.id)) as iosCount, count(distinct(if (u.register_time between '. $beginThisweek . ' and ' . $endThisweek .', 1, null))) as weekCount, count(if(pdl.type = 1, 1, null)) as signCount, count(if(pdl.type = 2, 1, null)) as tfCount, count(if(pdl.type = 3, 1, null)) as superSignCount') ->join("tab_package_download_log pdl on pdl.promote_id = p.id $pdlMap", 'left') + ->join("tab_user u on u.promote_id = p.id and u.device_type=2") ->where($map) ->select(); } else { @@ -1263,8 +1267,10 @@ class StatisticsController extends ThinkController { ->page($p, $row) ->select(); + $beginThisweek = mktime(0, 0 , 0,date("m"),date("d")-date("w")+1,date("Y")); + $endThisweek = mktime(23,59,59,date("m"),date("d")-date("w")+7,date("Y")); $total = M('package_download_log', 'tab_')->alias('pdl') - ->field('count(if(pdl.type = 1, 1, null)) as signCount, count(if(pdl.type = 2, 1, null)) as tfCount, count(if(pdl.type = 3, 1, null)) as superSignCount') + ->field('count(distinct(if(u.device_type=2, 1, null))) as iosCount, count(distinct(if (u.device_type=2 and u.register_time between '. $beginThisweek . ' and ' . $endThisweek .', 1, null))) as weekCount, count(if(pdl.type = 1, 1, null)) as signCount, count(if(pdl.type = 2, 1, null)) as tfCount, count(if(pdl.type = 3, 1, null)) as superSignCount') ->join('tab_promote p on p.id = pdl.promote_id') ->join('tab_user u on u.id = pdl.user_id', 'left') ->where($map) diff --git a/Application/Admin/View/Statistics/packdownload.html b/Application/Admin/View/Statistics/packdownload.html index 4d1de96b5..47be3bd97 100644 --- a/Application/Admin/View/Statistics/packdownload.html +++ b/Application/Admin/View/Statistics/packdownload.html @@ -80,8 +80,14 @@ -->