修复统计问题

master
yulingwei 5 years ago
parent f34975478b
commit 1ad299ffbe

@ -8519,7 +8519,7 @@ class ExportController extends Controller
} else { } else {
$xlsData = M('promote', 'tab_')->alias('p') $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') ->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, '/%')", 'left') ->join("tab_promote p2 on p2.chain like CONCAT(p.chain, p.id, '/%') and p2.level=".($level+1), 'left')
->join("tab_package_download_log pdl on pdl.promote_id = p2.id $pdlMap", 'left') ->join("tab_package_download_log pdl on pdl.promote_id = p2.id $pdlMap", 'left')
->where($map) ->where($map)
->group('p.id') ->group('p.id')

@ -1187,7 +1187,7 @@ class StatisticsController extends ThinkController {
} else { } else {
$list = M('promote', 'tab_')->alias('p') $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') ->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, '/%')", 'left') ->join("tab_promote p2 on p2.chain like CONCAT(p.chain, p.id, '/%') and p2.level=".($level+1), 'left')
->join("tab_package_download_log pdl on pdl.promote_id = p2.id $pdlMap", 'left') ->join("tab_package_download_log pdl on pdl.promote_id = p2.id $pdlMap", 'left')
->where($map) ->where($map)
->page($p, $row) ->page($p, $row)
@ -1196,7 +1196,7 @@ class StatisticsController extends ThinkController {
$total = M('promote', 'tab_')->alias('p') $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') ->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, '/%')", 'left') ->join("tab_promote p2 on p2.chain like CONCAT(p.chain, p.id, '/%') and p2.level=".($level+1), 'left')
->join("tab_package_download_log pdl on pdl.promote_id = p2.id $pdlMap", 'left') ->join("tab_package_download_log pdl on pdl.promote_id = p2.id $pdlMap", 'left')
->where($map) ->where($map)
->select(); ->select();

Loading…
Cancel
Save