diff --git a/Application/Admin/Controller/ExportController.class.php b/Application/Admin/Controller/ExportController.class.php index 6fab41881..5b56d145a 100644 --- a/Application/Admin/Controller/ExportController.class.php +++ b/Application/Admin/Controller/ExportController.class.php @@ -8518,8 +8518,8 @@ class ExportController extends Controller ->select(); } else { $xlsData = M('promote', 'tab_')->alias('p') - ->field('p.id, p.level, p.account, count(p2.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') - ->join("tab_promote p2 on p2.chain like CONCAT(p.chain, p.id, '/%') and p2.level=".($level+1), 'left') + ->field('p.id, p.level, p.account, count(if(p2.level = '.($level+1).', 1, null)) 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') + ->join("tab_promote p2 on p2.chain like CONCAT(p.chain, p.id, '/%') and or p2.id = p.id", 'left') ->join("tab_package_download_log pdl on pdl.promote_id = p2.id $pdlMap", 'left') ->where($map) ->group('p.id') diff --git a/Application/Admin/Controller/StatisticsController.class.php b/Application/Admin/Controller/StatisticsController.class.php index 9f090e7e2..8c819db06 100644 --- a/Application/Admin/Controller/StatisticsController.class.php +++ b/Application/Admin/Controller/StatisticsController.class.php @@ -1186,8 +1186,8 @@ class StatisticsController extends ThinkController { ->select(); } else { $list = M('promote', 'tab_')->alias('p') - ->field('p.id, p.level, p.account, count(p2.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') - ->join("tab_promote p2 on p2.chain like CONCAT(p.chain, p.id, '/%') and p2.level=".($level+1), 'left') + ->field('p.id, p.level, p.account, count(if(p2.level = '.($level+1).', 1, null)) 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') + ->join("tab_promote p2 on p2.chain like CONCAT(p.chain, p.id, '/%') or p2.id = p.id", 'left') ->join("tab_package_download_log pdl on pdl.promote_id = p2.id $pdlMap", 'left') ->where($map) ->page($p, $row) @@ -1195,8 +1195,8 @@ class StatisticsController extends ThinkController { ->select(); $total = M('promote', 'tab_')->alias('p') - ->field('count(p2.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') - ->join("tab_promote p2 on p2.chain like CONCAT(p.chain, p.id, '/%') and p2.level=".($level+1), 'left') + ->field('count(if(p2.level = '.($level+1).', 1, null)) 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') + ->join("tab_promote p2 on p2.chain like CONCAT(p.chain, p.id, '/%') or p2.id = p.id", 'left') ->join("tab_package_download_log pdl on pdl.promote_id = p2.id $pdlMap", 'left') ->where($map) ->select();