|
|
|
@ -1166,8 +1166,8 @@ class StatisticsController extends ThinkController {
|
|
|
|
|
$pdlMap .= " and pdl.create_time >={$startTime}";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($endTime = I('create_time_start')) {
|
|
|
|
|
$endTime += strtotime($endTime) + 86400;
|
|
|
|
|
if ($endTime = I('create_time_end')) {
|
|
|
|
|
$endTime = strtotime($endTime) + 86400;
|
|
|
|
|
$pdlMap .= " and pdl.create_time < {$endTime}";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1179,7 +1179,6 @@ class StatisticsController extends ThinkController {
|
|
|
|
|
->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')
|
|
|
|
|
->join("tab_package_download_log pdl on pdl.promote_id = p.id $pdlMap", 'left')
|
|
|
|
@ -1195,7 +1194,6 @@ class StatisticsController extends ThinkController {
|
|
|
|
|
->group('p.id')
|
|
|
|
|
->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, '/%')", 'left')
|
|
|
|
@ -1231,7 +1229,9 @@ class StatisticsController extends ThinkController {
|
|
|
|
|
$info = M('promote', 'tab_')->where(['id'=>$pid])->find();
|
|
|
|
|
if (empty($info)) return $this->error('未找到该用户');
|
|
|
|
|
//if ($info['level'] != PromoteModel::LEVEL_GROUP_LEADER) {return $this->error('无效的pid');} // 跳转玩家资料页面
|
|
|
|
|
$map['pdl.promote_id'] = $pid;
|
|
|
|
|
// 获取包括他自己的下级id
|
|
|
|
|
$promote_ids = M('promote', 'tab_')->where("chain like '{$info['chain']}{$pid}/%' or (id={$pid}) ")->field('id')->select();
|
|
|
|
|
$promote_ids ? $map['pdl.promote_id'] = ['in', array_column($promote_ids, 'id')] : null;
|
|
|
|
|
$info['chain'] = $info['level'] == PromoteModel::LEVEL_PRESIDENT ? [$info['id']] : array_merge(explode('/', trim($info['chain'], '/')), [$info['id']]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1239,6 +1239,16 @@ class StatisticsController extends ThinkController {
|
|
|
|
|
$map['u.account'] = I('user_account');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($startTime = I('create_time_start')) {
|
|
|
|
|
$startTime = strtotime($startTime);
|
|
|
|
|
$map['_string'] .= " and pdl.create_time >={$startTime}";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($endTime = I('create_time_end')) {
|
|
|
|
|
$endTime = strtotime($endTime) + 86400;
|
|
|
|
|
$map['_string'] .= " and pdl.create_time < {$endTime}";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$list = M('package_download_log', 'tab_')->alias('pdl')
|
|
|
|
|
->field('pdl.promote_id, pdl.create_time, pdl.type, p.chain, u.account, p.level')
|
|
|
|
|
->join('tab_promote p on p.id = pdl.promote_id')
|
|
|
|
@ -1250,11 +1260,13 @@ class StatisticsController extends ThinkController {
|
|
|
|
|
$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')
|
|
|
|
|
->join('tab_promote p on p.id = pdl.promote_id')
|
|
|
|
|
->join('tab_user u on u.id = pdl.user_id', 'left')
|
|
|
|
|
->where($map)
|
|
|
|
|
->select();
|
|
|
|
|
|
|
|
|
|
$count = M('package_download_log', 'tab_')->alias('pdl')
|
|
|
|
|
->join('tab_promote p on p.id = pdl.promote_id')
|
|
|
|
|
->join('tab_user u on u.id = pdl.user_id', 'left')
|
|
|
|
|
->where($map)
|
|
|
|
|
->count();
|
|
|
|
|
|
|
|
|
|