From f15c6e68eb2d27cd60c3e85ffe38251f80a5d9ab Mon Sep 17 00:00:00 2001 From: sunke <18850253506@163.com> Date: Wed, 30 Oct 2019 13:38:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B3=A8=E5=86=8C=E6=98=8E=E7=BB=86=EF=BC=8C?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E6=9F=A5=E8=AF=A2=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E7=AD=89=E7=BA=A7=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Home/Controller/QueryController.class.php | 146 ++++++++++-------- .../Home/View/default/Query/recharge.html | 30 +++- .../Home/View/default/Query/register.html | 30 +++- 3 files changed, 138 insertions(+), 68 deletions(-) diff --git a/Application/Home/Controller/QueryController.class.php b/Application/Home/Controller/QueryController.class.php index 277118a0d..a2212198d 100644 --- a/Application/Home/Controller/QueryController.class.php +++ b/Application/Home/Controller/QueryController.class.php @@ -37,44 +37,54 @@ class QueryController extends BaseController $row = 10; } - $childPromoteIds = getAllChildPromoteList(3); - if (empty($childPromoteIds)) { - $map['tab_spend.promote_id'] = PID; - } else { - $childPromoteIds .= ',' . PID; - - $map['tab_spend.promote_id'] = ['in', $childPromoteIds]; - } - - $teamLeaderId = intval(I('team_leader_id'));//组长账号 - if (!empty($teamLeaderId)) { - $hasTeamLeaderPermission = hasPromotePermission(PID, $teamLeaderId); - if ($hasTeamLeaderPermission === false) { - $this->error('组长权限异常'); - } - - $childPromoteIds = getAllChildPromoteList(3, $teamLeaderId); - if (empty($childPromoteIds)) { - $map['tab_spend.promote_id'] = $teamLeaderId; - } else { - $childPromoteIds = $teamLeaderId . ',' . $childPromoteIds; - - $map['tab_spend.promote_id'] = ['in', $childPromoteIds]; +// $childPromoteIds = getAllChildPromoteList(3); +// if (empty($childPromoteIds)) { +// $map['tab_spend.promote_id'] = PID; +// } else { +// $childPromoteIds .= ',' . PID; +// +// $map['tab_spend.promote_id'] = ['in', $childPromoteIds]; +// } + + + $map1['chain'] = ['like','%'.PID.'/'.'%']; + $rs = M('promote','tab_')->where($map1)->field('id,account,nickname')->select(); + $childPromoteIds = ''; + if(empty($rs)) { + $map['tab_user.promote_id'] = PID; + }else { + foreach ($rs as $rsKey => $rsValue) { + $id = $rsValue['id']; + $childPromoteIds .= $id.','; } + $childPromoteIds = rtrim($childPromoteIds, ','); + $childPromoteIds .= ',' . PID; + $map['tab_spend.promote_id'] = ['in', $childPromoteIds]; } - $promoteId = I('promote_id');//推广员账号 - if (!empty($promoteId)) { - $hasPromotePermission = hasPromotePermission(PID, $promoteId); - if ($hasPromotePermission === false) { - $this->error('推广员权限异常'); - } - - $map['tab_spend.promote_id'] = $promoteId; + $levelPromote = I('level_promote', []); + $promote = $this->getLoginPromote(); + $queryPromote = $this->getQueryPromote($levelPromote); + $map2['chain'] = ['like', $queryPromote['chain'].$queryPromote['id'].'/%']; + $ids = M('promote', 'tab_')->where($map2)->getField('id', true); + if(empty($ids)) { + $ids = array(); + } + if(empty($levelPromote)) { + array_push($ids,PID); + + } + array_push($ids,$queryPromote['id']); + if (!empty($ids)) { + $map['tab_spend.promote_id'] = ['in',$ids]; + + }else { + $map['_string'] = '1<>1'; } + if (!empty(I('own_id'))) { - $map['tab_spend.promote_id'] = I('own_id');//本账号 + $map['tab_spend.promote_id'] = $promote['id'];//本账号 } if (!empty(I('begtime')) && empty(I('endtime'))) { @@ -183,44 +193,52 @@ class QueryController extends BaseController $row = 10; } - $childPromoteIds = getAllChildPromoteList(3); - if (empty($childPromoteIds)) { + //$childPromoteIds = getAllChildPromoteList(3); +// if (empty($childPromoteIds)) { +// $map['tab_user.promote_id'] = PID; +// } else { +// $childPromoteIds .= ',' . PID; +// +// $map['tab_user.promote_id'] = ['in', $childPromoteIds]; +// } + // $map['tab_user.promote_id'] = ['like','%'.PID.'/'.'%']; + $map1['chain'] = ['like','%'.PID.'/'.'%']; + $rs = M('promote','tab_')->where($map1)->field('id,account,nickname')->select(); + $childPromoteIds = ''; + if(empty($rs)) { $map['tab_user.promote_id'] = PID; - } else { - $childPromoteIds .= ',' . PID; - - $map['tab_user.promote_id'] = ['in', $childPromoteIds]; - } - - $teamLeaderId = intval(I('team_leader_id'));//组长账号 - if (!empty($teamLeaderId)) { - $hasTeamLeaderPermission = hasPromotePermission(PID, $teamLeaderId); - if ($hasTeamLeaderPermission === false) { - $this->error('组长权限异常'); - } - - $childPromoteIds = getAllChildPromoteList(3, $teamLeaderId); - if (empty($childPromoteIds)) { - $map['tab_user.promote_id'] = $teamLeaderId; - } else { - $childPromoteIds = $teamLeaderId . ',' . $childPromoteIds; - - $map['tab_user.promote_id'] = ['in', $childPromoteIds]; + }else { + foreach ($rs as $rsKey => $rsValue) { + $id = $rsValue['id']; + $childPromoteIds .= $id.','; } + $childPromoteIds = rtrim($childPromoteIds, ','); + $childPromoteIds .= ',' . PID; + $map['tab_user.promote_id'] = ['in', $childPromoteIds]; } - $promoteId = I('promote_id');//推广员账号 - if (!empty($promoteId)) { - $hasPromotePermission = hasPromotePermission(PID, $promoteId); - if ($hasPromotePermission === false) { - $this->error('推广员权限异常'); - } - - $map['tab_user.promote_id'] = $promoteId; + $levelPromote = I('level_promote', []); + $promote = $this->getLoginPromote(); + $queryPromote = $this->getQueryPromote($levelPromote); + $map2['chain'] = ['like', $queryPromote['chain'].$queryPromote['id'].'/%']; + $ids = M('promote', 'tab_')->where($map2)->getField('id', true); + if(empty($ids)) { + $ids = array(); + } + if(empty($levelPromote)) { + array_push($ids,PID); + + } + array_push($ids,$queryPromote['id']); + if (!empty($ids)) { + $map['tab_user.promote_id'] = ['in',$ids]; + + }else { + $map['_string'] = '1<>1'; } - + if (!empty(I('own_id'))) { - $map['tab_user.promote_id'] = I('own_id');//本账号 + $map['tab_user.promote_id'] = $promote['id'];//本账号 } if (!empty(I('begtime')) && empty(I('endtime'))) { diff --git a/Application/Home/View/default/Query/recharge.html b/Application/Home/View/default/Query/recharge.html index d31c923b3..aaed2cbbb 100644 --- a/Application/Home/View/default/Query/recharge.html +++ b/Application/Home/View/default/Query/recharge.html @@ -65,7 +65,7 @@