diff --git a/Application/Admin/Controller/ExportController.class.php b/Application/Admin/Controller/ExportController.class.php index 6822f0519..bdf138d3e 100644 --- a/Application/Admin/Controller/ExportController.class.php +++ b/Application/Admin/Controller/ExportController.class.php @@ -8504,8 +8504,8 @@ class ExportController extends Controller $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}"; } @@ -8548,7 +8548,9 @@ class ExportController extends Controller $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']]); } @@ -8556,12 +8558,21 @@ class ExportController extends Controller $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') ->join('tab_user u on u.id = pdl.user_id', 'left') ->where($map) - ->page($p, $row) ->select(); $parentIds = []; diff --git a/Application/Admin/Controller/StatisticsController.class.php b/Application/Admin/Controller/StatisticsController.class.php index 7aa097771..0067d5ca9 100644 --- a/Application/Admin/Controller/StatisticsController.class.php +++ b/Application/Admin/Controller/StatisticsController.class.php @@ -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') @@ -1194,7 +1193,6 @@ class StatisticsController extends ThinkController { ->page($p, $row) ->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') @@ -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(); diff --git a/Application/Admin/View/Statistics/packdownload.html b/Application/Admin/View/Statistics/packdownload.html index 46f52a638..547b1ede4 100644 --- a/Application/Admin/View/Statistics/packdownload.html +++ b/Application/Admin/View/Statistics/packdownload.html @@ -62,6 +62,7 @@ url="{:U('Statistics/packdownload','model='.$model['name'] . '&row=' . I('row'),false)}"> 搜索 + 返回 @@ -118,7 +119,7 @@ 查看所有下级 - 查看下级 + 查看所有下级 diff --git a/Application/Admin/View/Statistics/packuserdownload.html b/Application/Admin/View/Statistics/packuserdownload.html index a915c742c..18004bded 100644 --- a/Application/Admin/View/Statistics/packuserdownload.html +++ b/Application/Admin/View/Statistics/packuserdownload.html @@ -80,6 +80,7 @@ url="{:U('Statistics/packuserdownload','model='.$model['name'] . '&row=' . I('row'),false)}"> 搜索 + 返回 @@ -258,8 +259,8 @@ // 清除下级联动数据 var childrens = $(obj).parents('.search_label_rehab').nextAll().children('.promote-id'); $.each(childrens, function(index, item){ - $(item).empty().select2(); - $("#select2-"+$(item).attr('id')+"-container").html($(item).attr('data-title')); + var title = $(item).attr('data-title'); + $(item).empty().html("").select2(); }); var next = $(obj).parents('.search_label_rehab').next().children('.promote-id');