【用户】-【玩家组】-【登录记录】-选择会长只显示这个会长的登录记录

改为展示这个会长及其所属推广员的登录记录
master
liuweiwen 5 years ago
parent 4d06b52b9d
commit 86dd4a2952

@ -44,15 +44,10 @@ 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 = '';
}
$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'];
}
?>

@ -1070,17 +1070,26 @@ class MemberController extends ThinkController
setPowerPromoteIds($map,'promote_id');
if (isset($_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']);

@ -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;
}
</style>
<!-- 标题栏 -->
<div class="cf main-place top_nav_list navtab_list">

Loading…
Cancel
Save