diff --git a/Application/Admin/Common/extend.php b/Application/Admin/Common/extend.php index e4832f814..e720bc776 100644 --- a/Application/Admin/Common/extend.php +++ b/Application/Admin/Common/extend.php @@ -44,16 +44,11 @@ function get_promote_list_by_id($id=0) { if(is_numeric($id) && $id>=0) { $map['parent_id'] = $id; - $list = $query->where($map)->select(); } elseif(is_array($id)) { $map['parent_id'] = array('in',$id); - $list = $query->where($map)->select(); - } elseif(is_numeric($id) && $id<0){ - $list = $query->where($map)->select(); - } else { - $list = ''; } - return $list; + $list = $query->where($map)->select(); + return $list; } /* @@ -1590,7 +1585,7 @@ function getPowerPromoteIds() if ($myPromote_ids) { if ($userAuth['data_empower_type'] == 2) {//部分会长加上自己创建的会长 - $userAuth['data_president'] .= "," . $myPromote_ids; +// $userAuth['data_president'] .= "," . $myPromote_ids; } elseif ($userAuth['data_empower_type'] == 3) {//自己创建的会长和底下推广员 $userAuth['data_president'] = $myPromote_ids; } @@ -1619,11 +1614,17 @@ function getPowerPromoteIds() return $promoteIds; } +/** + * 为数据权限添加筛选参数 + * @param array $map 查询条件 + * @param string $column 字段名,默认为promote_id + * @return mixed + */ function setPowerPromoteIds(&$map, $column = 'promote_id') { //为数据权限添加 $promoteIds = getPowerPromoteIds(); if (empty($promoteIds)) { - $map[$column] = -1; + $map[$column] = -1;//没权限时将promote_id置为-1 } elseif ($promoteIds != 'all') { if (isset($map[$column])) { if (isset($map['_string'])) {//查询字段中已存在promote_id,不覆盖此条件而处理 @@ -1697,4 +1698,19 @@ function get_admin_listOther() if(empty($list)){return false;} return $list; } + +/** + * 根据会长id底下的推广员id + * @param $promote_id + * @return mixed + */ +function getOffspringByPromoteId($promote_id) { + $promote_ids = M('promote', 'tab_') + ->where(['chain' => ['like', "%/{$promote_id}/%"]]) + ->field('group_concat(id) as promote_ids') + ->find(); + return $promote_ids['promote_ids']; +} + + ?> diff --git a/Application/Admin/Controller/MemberController.class.php b/Application/Admin/Controller/MemberController.class.php index 9166e73c7..fd6c8a73c 100644 --- a/Application/Admin/Controller/MemberController.class.php +++ b/Application/Admin/Controller/MemberController.class.php @@ -1070,17 +1070,26 @@ class MemberController extends ThinkController setPowerPromoteIds($map,'promote_id'); if (isset($_REQUEST['promote_id'])) { - $map['promote_id'] = $_REQUEST['promote_id']; + if (I('promote_level') ==1) { + $promote_ids = getOffspringByPromoteId($_REQUEST['promote_id']); + if (empty($promote_ids)) { + $promote_ids = -1; + } + $map['promote_id'] = ['exp', "in($promote_ids)"]; + } else { + $map['promote_id'] = $_REQUEST['promote_id']; + } unset($_REQUEST['promote_id']); } + // $map['type'] = 1; // $map['login_time'] = ['exp', 'login_time<>0']; $extend = array(); $extend['map'] = $map; $count = M('UserLoginRecord','tab_')->field('user_id')->where($extend['map'])->group('user_id')->select(false); $sql = "select count(user_id) as count from ({$count})t"; + $count = M('UserLoginRecord','tab_')->query($sql); -// var_dump($sql);die(); $this->m_title = '登录记录'; $this->assign('user_count',$count[0]['count']); diff --git a/Application/Admin/View/Member/device_bans_list.html b/Application/Admin/View/Member/device_bans_list.html index 62730c29c..6e4686a3e 100644 --- a/Application/Admin/View/Member/device_bans_list.html +++ b/Application/Admin/View/Member/device_bans_list.html @@ -25,10 +25,6 @@ height:26px;line-height:26px;font-size:12px; } .select2-results__option[aria-selected] {font-size:12px;} - .select2-dropdown { - z-index: 1; - } -