diff --git a/Application/Home/Common/function.php b/Application/Home/Common/function.php index 1bf7886f3..a6007b121 100644 --- a/Application/Home/Common/function.php +++ b/Application/Home/Common/function.php @@ -831,24 +831,24 @@ function isParentPromote($parentId, $promoteId) } //获取所有该类型的渠道 $promoteId-渠道ID $promoteType-1:本账号 2:组长 3:推广员 -function getAllPromoteListByType($promoteType = 1, $retOne = false) +function getAllPromoteListByType($promoteType = 1, $retOne = false, $promoteId = PID) { $childPromoteData = array(); switch ($promoteType) { case 1: - $map['id'] = PID; + $map['id'] = $promoteId; break; case 2: case 3: - $promoteData = D('Promote')->where(array('id' => PID))->find(); + $promoteData = D('Promote')->where(array('id' => $promoteId))->find(); if ($promoteData['grand_id'] > 0) { return []; } elseif ($promoteData['parent_id'] > 0) { $promoteType--; } - $childPromoteIds = getAllPromoteIdsByType((string)PID, $promoteType); + $childPromoteIds = getAllPromoteIdsByType((string)$promoteId, $promoteType); break; } @@ -901,10 +901,10 @@ function getAllPromoteIdsByType($promoteIds, $level = 3, $nowLevel = 1) } //获取所有子渠道列表 $type 1-返回数组 2-返回id数组 3-返回id字符串 -function getAllChildPromoteList($type = 1) +function getAllChildPromoteList($type = 1, $promoteId = PID) { $childPromoteData = array(); - $childPromoteIds = getAllChildPromoteIds((string)PID); + $childPromoteIds = getAllChildPromoteIds((string)$promoteId); if (!empty($childPromoteIds)) { $map['id'] = ['in', $childPromoteIds]; diff --git a/Application/Home/Controller/QueryController.class.php b/Application/Home/Controller/QueryController.class.php index 0daec79f2..d259ad70e 100644 --- a/Application/Home/Controller/QueryController.class.php +++ b/Application/Home/Controller/QueryController.class.php @@ -44,14 +44,21 @@ class QueryController extends BaseController $map['tab_spend.promote_id'] = ['in', $childPromoteIds]; } - $teamLeaderId = I('team_leader_id');//组长账号 + $teamLeaderId = intval(I('team_leader_id'));//组长账号 if (!empty($teamLeaderId)) { $hasTeamLeaderPermission = hasPromotePermission(PID, $teamLeaderId); if ($hasTeamLeaderPermission === false) { $this->error('组长权限异常'); } - $map['tab_spend.promote_id'] = $teamLeaderId; + $childPromoteIds = getAllChildPromoteList(3, $teamLeaderId); + if (empty($childPromoteIds)) { + $map['tab_spend.promote_id'] = $teamLeaderId; + } else { + $childPromoteIds = $teamLeaderId . ',' . $childPromoteIds; + + $map['tab_spend.promote_id'] = ['in', $childPromoteIds]; + } } $promoteId = I('promote_id');//推广员账号 @@ -164,6 +171,9 @@ class QueryController extends BaseController $this->assign('pID', PID); $this->assign('ownId', I('own_id')); $this->assign('payWayData', QueryController::$payWay); + if (!empty(I('team_leader_id'))) { + $this->assign('teamLeaderData', getAllPromoteListByType(1, false, intval(I('team_leader_id')))); + } $this->meta_title = "订单查询"; $this->display(); } @@ -186,14 +196,21 @@ class QueryController extends BaseController $map['tab_user.promote_id'] = ['in', $childPromoteIds]; } - $teamLeaderId = I('team_leader_id');//组长账号 + $teamLeaderId = intval(I('team_leader_id'));//组长账号 if (!empty($teamLeaderId)) { $hasTeamLeaderPermission = hasPromotePermission(PID, $teamLeaderId); if ($hasTeamLeaderPermission === false) { $this->error('组长权限异常'); } - $map['tab_user.promote_id'] = $teamLeaderId; + $childPromoteIds = getAllChildPromoteList(3, $teamLeaderId); + if (empty($childPromoteIds)) { + $map['tab_user.promote_id'] = $teamLeaderId; + } else { + $childPromoteIds = $teamLeaderId . ',' . $childPromoteIds; + + $map['tab_user.promote_id'] = ['in', $childPromoteIds]; + } } $promoteId = I('promote_id');//推广员账号 @@ -277,6 +294,9 @@ class QueryController extends BaseController $this->assign('thisParentPromoteId', $thisParentPromoteId); $this->assign('pID', PID); $this->assign('ownId', I('own_id')); + if (!empty(I('team_leader_id'))) { + $this->assign('teamLeaderData', getAllPromoteListByType(1, false, intval(I('team_leader_id')))); + } $this->meta_title = '注册明细'; $this->display(); } @@ -979,16 +999,25 @@ class QueryController extends BaseController $spendWhere['tab_spend.promote_id'] = ['in', $childPromoteIds]; } - $teamLeaderId = I('team_leader_id');//组长账号 + $teamLeaderId = intval(I('team_leader_id'));//组长账号 if (!empty($teamLeaderId)) { $hasTeamLeaderPermission = hasPromotePermission(PID, $teamLeaderId); if ($hasTeamLeaderPermission === false) { $this->error('组长权限异常'); } - $userPlayInfoWhere['tab_user_play_info.promote_id'] = $teamLeaderId; - $userGameLoginWhere['tab_user_game_login_record.promote_id'] = $teamLeaderId; - $spendWhere['tab_spend.promote_id'] = $teamLeaderId; + $childPromoteIds = getAllChildPromoteList(3, $teamLeaderId); + if (empty($childPromoteIds)) { + $userPlayInfoWhere['tab_user_play_info.promote_id'] = $teamLeaderId; + $userGameLoginWhere['tab_user_game_login_record.promote_id'] = $teamLeaderId; + $spendWhere['tab_spend.promote_id'] = $teamLeaderId; + } else { + $childPromoteIds = $teamLeaderId . ',' . $childPromoteIds; + + $userPlayInfoWhere['tab_user_play_info.promote_id'] = ['in', $childPromoteIds]; + $userGameLoginWhere['tab_user_game_login_record.promote_id'] = ['in', $childPromoteIds]; + $spendWhere['tab_spend.promote_id'] = ['in', $childPromoteIds]; + } } $promoteId = I('promote_id');//推广员账号 @@ -998,24 +1027,12 @@ class QueryController extends BaseController $this->error('推广员权限异常'); } - if (!empty($userPlayInfoWhere['tab_apply.promote_id'])) { - $userPlayInfoWhere['_string'] = 'tab_user_play_info.promote_id = ' . $promoteId; - $userGameLoginWhere['_string'] = 'tab_user_game_login_record.promote_id = ' . $promoteId; - $spendWhere['_string'] = 'tab_spend.promote_id = ' . $promoteId; - } else { - $userPlayInfoWhere['tab_user_play_info.promote_id'] = $promoteId; - $userGameLoginWhere['tab_user_game_login_record.promote_id'] = $promoteId; - $spendWhere['tab_spend.promote_id'] = $promoteId; - } + $userPlayInfoWhere['tab_user_play_info.promote_id'] = $promoteId; + $userGameLoginWhere['tab_user_game_login_record.promote_id'] = $promoteId; + $spendWhere['tab_spend.promote_id'] = $promoteId; } if (!empty(I('own_id'))) { - if (!empty($userPlayInfoWhere['_string'])) { - unset($userPlayInfoWhere['_string']); - unset($userGameLoginWhere['_string']); - unset($spendWhere['_string']); - } - $userPlayInfoWhere['tab_user_play_info.promote_id'] = I('own_id'); $userGameLoginWhere['tab_user_game_login_record.promote_id'] = I('own_id'); $spendWhere['tab_spend.promote_id'] = I('own_id'); @@ -1203,6 +1220,9 @@ class QueryController extends BaseController $this->assign('serverData', $serverData['data']); $this->assign('thisParentPromoteId', $thisParentPromoteId); $this->assign('pID', PID); + if (!empty(I('team_leader_id'))) { + $this->assign('teamLeaderData', getAllPromoteListByType(1, false, intval(I('team_leader_id')))); + } $this->display(); } @@ -1237,10 +1257,20 @@ class QueryController extends BaseController $this->error('组长权限异常'); } - $map['tab_apply.promote_id'] = $teamLeaderId; - $userPlayInfoMap['tab_user_play_info.promote_id'] = $teamLeaderId; - $userGameLoginMap['tab_user_game_login_record.promote_id'] = $teamLeaderId; - $spendMap['tab_spend.promote_id'] = $teamLeaderId; + $childPromoteIds = getAllChildPromoteList(3, $teamLeaderId); + if (empty($childPromoteIds)) { + $map['tab_apply.promote_id'] = $teamLeaderId; + $userPlayInfoMap['tab_user_play_info.promote_id'] = $teamLeaderId; + $userGameLoginMap['tab_user_game_login_record.promote_id'] = $teamLeaderId; + $spendMap['tab_spend.promote_id'] = $teamLeaderId; + } else { + $childPromoteIds = $teamLeaderId . ',' . $childPromoteIds; + + $map['tab_apply.promote_id'] = ['in', $childPromoteIds]; + $userPlayInfoMap['tab_user_play_info.promote_id'] = ['in', $childPromoteIds]; + $userGameLoginMap['tab_user_game_login_record.promote_id'] = ['in', $childPromoteIds]; + $spendMap['tab_spend.promote_id'] = ['in', $childPromoteIds]; + } } $promoteId = intval(I('promote_id'));//推广员账号 @@ -1250,21 +1280,14 @@ class QueryController extends BaseController $this->error('推广员权限异常'); } - $map['_string'] = 'tab_apply.promote_id = ' . $promoteId; - $userPlayInfoMap['_string'] = 'tab_user_play_info.promote_id = ' . $promoteId; - $userGameLoginMap['_string'] = 'tab_user_game_login_record.promote_id = ' . $promoteId; - $spendMap['_string'] = 'tab_spend.promote_id = ' . $promoteId; + $map['tab_apply.promote_id'] = $promoteId; + $userPlayInfoMap['tab_user_play_info.promote_id'] = $promoteId; + $userGameLoginMap['tab_user_game_login_record.promote_id'] = $promoteId; + $spendMap['tab_spend.promote_id'] = $promoteId; } $ownId = intval(I('own_id'));//本账号 if (!empty($ownId)) { - if (!empty($map['_string'])) { - unset($map['_string']); - unset($userPlayInfoMap['_string']); - unset($userGameLoginMap['_string']); - unset($spendMap['_string']); - } - $map['tab_apply.promote_id'] = $ownId; $userPlayInfoMap['tab_user_play_info.promote_id'] = $ownId; $userGameLoginMap['tab_user_game_login_record.promote_id'] = $ownId; @@ -1457,6 +1480,9 @@ class QueryController extends BaseController $this->assign('serverData', $serverData['data']); $this->assign('thisParentPromoteId', $thisParentPromoteId); $this->assign('pID', PID); + if (!empty(I('team_leader_id'))) { + $this->assign('teamLeaderData', getAllPromoteListByType(1, false, intval(I('team_leader_id')))); + } $this->display(); } @@ -2146,4 +2172,21 @@ class QueryController extends BaseController $this->assign('count', $count); $this->display(); } + + public function getChildPromoteList() + { + $promoteId = I('post.promote_id', 0); + if ($promoteId == 0) { + $data['status'] = 0; + $data['msg'] = '数据异常'; + + $this->ajaxReturn($data); + } + + $promoteList = getAllPromoteListByType(3, false, $promoteId); + $data['status'] = 1; + $data['data'] = $promoteList; + + $this->ajaxReturn($data); + } } diff --git a/Application/Home/View/default/Query/dailySummary.html b/Application/Home/View/default/Query/dailySummary.html index 035a716d2..54ff2d148 100644 --- a/Application/Home/View/default/Query/dailySummary.html +++ b/Application/Home/View/default/Query/dailySummary.html @@ -89,7 +89,12 @@
@@ -447,6 +452,36 @@ setValue('server_id', {$Think.request.server_id |default = '""'}); setValue('row', '{:I("get.row",10)}'); + $('#team_leader_id').change(function () { + var promoteId = parseInt($(this).val()); + var promoteValue = $(this).find("option:selected").text(); + + $.ajax({ + url: "{:U('getChildPromoteList')}", + type: "post", + data: {promote_id:promoteId}, + dataType: 'json', + success: function (data) { + var html = ""; + html += ""; + + if (data.status == 1) { + var promoteData = data.data; + + if (promoteData.length > 0) { + for (var i in promoteData) { + html += ""; + } + } + } + + $("#promote_id").empty(); + $('#promote_id').html(html); + $("#promote_id").select2(); + } + }); + }); + $('#own').on('click', function () { var ownId = $('#own_id').val(); var checkBox = $(this).children('i'); diff --git a/Application/Home/View/default/Query/recharge.html b/Application/Home/View/default/Query/recharge.html index ca694215b..df8f19978 100644 --- a/Application/Home/View/default/Query/recharge.html +++ b/Application/Home/View/default/Query/recharge.html @@ -117,7 +117,12 @@
@@ -273,6 +278,36 @@ endDate: date }); + $('#team_leader_id').change(function () { + var promoteId = parseInt($(this).val()); + var promoteValue = $(this).find("option:selected").text(); + + $.ajax({ + url: "{:U('getChildPromoteList')}", + type: "post", + data: {promote_id:promoteId}, + dataType: 'json', + success: function (data) { + var html = ""; + html += ""; + + if (data.status == 1) { + var promoteData = data.data; + + if (promoteData.length > 0) { + for (var i in promoteData) { + html += ""; + } + } + } + + $("#promote_id").empty(); + $('#promote_id').html(html); + $("#promote_id").select2(); + } + }); + }); + $('#own').on('click',function () { var ownId = $('#own_id').val(); var checkBox = $(this).children('i'); diff --git a/Application/Home/View/default/Query/register.html b/Application/Home/View/default/Query/register.html index 668855eff..41e8643b2 100644 --- a/Application/Home/View/default/Query/register.html +++ b/Application/Home/View/default/Query/register.html @@ -36,27 +36,32 @@
+
" + promoteValue + ""; + + if (data.status == 1) { + var promoteData = data.data; + + if (promoteData.length > 0) { + for (var i in promoteData) { + html += ""; + } + } + } + + $("#promote_id").empty(); + $('#promote_id').html(html); + $("#promote_id").select2(); + } + }); + }); + $('#own').on('click',function () { var ownId = $('#own_id').val(); var checkBox = $(this).children('i'); diff --git a/Application/Home/View/default/Query/summary.html b/Application/Home/View/default/Query/summary.html index 15c191cf8..2ee6d53d6 100644 --- a/Application/Home/View/default/Query/summary.html +++ b/Application/Home/View/default/Query/summary.html @@ -79,7 +79,12 @@
@@ -234,6 +239,36 @@ setValue('server_id', {$Think.request.server_id |default = '""'}); setValue('row', '{:I("get.row",10)}'); + $('#team_leader_id').change(function () { + var promoteId = parseInt($(this).val()); + var promoteValue = $(this).find("option:selected").text(); + + $.ajax({ + url: "{:U('getChildPromoteList')}", + type: "post", + data: {promote_id:promoteId}, + dataType: 'json', + success: function (data) { + var html = ""; + html += ""; + + if (data.status == 1) { + var promoteData = data.data; + + if (promoteData.length > 0) { + for (var i in promoteData) { + html += ""; + } + } + } + + $("#promote_id").empty(); + $('#promote_id').html(html); + $("#promote_id").select2(); + } + }); + }); + $('#own').on('click',function () { var ownId = $('#own_id').val(); var checkBox = $(this).children('i');