|
|
|
@ -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)
|
|
|
|
|