作者 sgj
1 个管道 的构建 通过 耗费 2 秒

圈子设置

... ... @@ -149,6 +149,7 @@ class GroupController extends AdminBaseController
$map['g.group_id']=input('id');
$list=db('group_user')
->alias('g')
->field('g.id as gid,u.*')
->where($map)
->join('user u','g.user_id=u.id')
->paginate('1');
... ... @@ -163,8 +164,7 @@ class GroupController extends AdminBaseController
* 拉黑用户
*/
public function banUser(){
$map['user_id']=input('id');
$map['group_id']=input('group_id');
$map['id']=input('id');
$result=db('group_user')->where($map)->delete();
if ($result==1){
$this->success('删除用户!');
... ... @@ -174,8 +174,8 @@ class GroupController extends AdminBaseController
}
public function groupPeopleAdd(){
dump(input());
$this->success();
}
}
\ No newline at end of file
... ...
... ... @@ -53,6 +53,45 @@ class CommonController extends AdminBaseController
return $this->fetch();
}
public function selectUsersMore()
{
$param = $this->request->param();
$ids = $this->request->param('ids');
$selectedIds = explode(',',$ids);
if (!is_array($selectedIds)) {
$selectedIds = [$selectedIds];
}
$where['user_type'] = ['in','1,2,3'];
$request = input('request.');
if (!empty($request['uid'])) {
$where['id'] = intval($request['uid']);
}
$keywordComplex = [];
if (!empty($request['keyword'])) {
$keyword = $request['keyword'];
$keywordComplex['user_login|user_nickname|mobile'] = ['like', "%$keyword%"];
}
$usersQuery = Db::name('user');
$list = $usersQuery->field('id,user_nickname,user_login,avatar,mobile')
->whereOr($keywordComplex)
->where($where)
->order("create_time DESC")
->paginate(50);
$list->appends($param);
$this->assign('selectedIds', $selectedIds);
$this->assign('uid', isset($param['uid']) ? $param['uid'] : '');
$this->assign('keyword', isset($param['keyword']) ? $param['keyword'] : '');
$this->assign('ids', isset($param['ids']) ? $param['ids'] : '');
$this->assign('list', $list->items());
$this->assign('page', $list->render());
return $this->fetch();
}
public function selectGroup(){
$param = $this->request->param();
$ids = $this->request->param('ids');
... ...
<include file="public@header"/>
</head>
<body>
<div class="wrap">
<ul class="nav nav-tabs">
<li class="active"><a>{$group.name}</a></li>
</ul>
<form class="well form-inline margin-top-20 js-ajax-form" method="post" action="{:url('groupPeopleAdd',['group_id'=>$group.id])}">
添加用户
<input class="form-control" type="text" required="" placeholder="请选择用户" onclick="doSelectUsers();" id="js-users-name-input" readonly="" aria-required="true">
<input class="form-control" type="hidden" name="post[author_id]" value="" name="user_id" id="js-users-id-input"/>
<input type="submit" class="btn btn-primary js-ajax-submit" value="确定"/>
<a class="btn btn-danger" href="{:url('user/adminIndex/index')}">清空</a>
</form>
<form method="post" class="js-ajax-form">
<table class="table table-hover table-bordered">
<thead>
<tr>
<th>ID</th>
<th>{:lang('USERNAME')}</th>
<th>姓名</th>
<th>头像</th>
<th>手机</th>
<th>注册时间</th>
<th>{:lang('LAST_LOGIN_TIME')}</th>
<th>{:lang('LAST_LOGIN_IP')}</th>
<th>{:lang('STATUS')}</th>
<th>{:lang('ACTIONS')}</th>
</tr>
</thead>
<tbody>
<php>
$user_statuses=array("0"=>lang('USER_STATUS_BLOCKED'),"1"=>lang('USER_STATUS_ACTIVATED'),"2"=>lang('USER_STATUS_UNVERIFIED'));
</php>
<foreach name="list" item="vo">
<tr>
<td>{$vo.gid}</td>
<td>{$vo['user_login']?$vo['user_login']:($vo['mobile']?$vo['mobile']:lang('THIRD_PARTY_USER'))}
</td>
<td>{$vo['user_nickname']?$vo['user_nickname']:lang('NOT_FILLED')}</td>
<td><img width="25" height="25" src="{:url('user/public/avatar',array('id'=>$vo['id']))}"/></td>
<td>{$vo.mobile}</td>
<td>{:date('Y-m-d H:i:s',$vo['create_time'])}</td>
<td>{:date('Y-m-d H:i:s',$vo['last_login_time'])}</td>
<td>{$vo.last_login_ip}</td>
<td>{$user_statuses[$vo['user_status']]}</td>
<td>
<neq name="vo.id" value="1">
<empty name="vo.user_status">
<a href="{:url('adminIndex/cancelban',array('id'=>$vo['id']))}"
class="js-ajax-dialog-btn"
data-msg="{:lang('ACTIVATE_USER_CONFIRM_MESSAGE')}">{:lang('ACTIVATE_USER')}</a>
<else/>
<a href="{:url('banUser',array('id'=>$vo['gid']))}" class="js-ajax-dialog-btn"
data-msg="{:lang('BLOCK_USER_CONFIRM_MESSAGE')}">{:lang('BLOCK_USER')}</a>
</empty>
<else/>
<a style="color: #ccc;">{:lang('BLOCK_USER')}</a>
</neq>
</td>
</tr>
</foreach>
</tbody>
</table>
<div class="pagination">{$page}</div>
</form>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script type="application/javascript">
function doSelectUsers() {
var selectedUsersId = $('#js-users-id-input').val();
openIframeLayer("{:url('portal/Common/selectUsersMore')}?ids=" + selectedUsersId, '请选择分类', {
area: ['1200px', '800px'],
btn: ['确定', '取消'],
yes: function (index, layero) {
//do something
var iframeWin = window[layero.find('iframe')[0]['name']];
var selectedUsers = iframeWin.confirm();
if (selectedUsers.selectedUsersId.length == 0) {
layer.msg('请选择分类');
return;
}
$('#js-users-id-input').val(selectedUsers.selectedUsersId.join(','));
$('#js-users-name-input').val(selectedUsers.selectedUsersName.join(' '));
//console.log(layer.getFrameIndex(index));
layer.close(index); //如果设定了yes回调,需进行手工关闭
}
});
}
</script>
</body>
</html>
\ No newline at end of file
... ...
<include file="public@header"/>
</head>
<body>
<div class="wrap js-check-wrap" style="min-width: inherit">
<form class="well form-inline margin-top-20" method="post" action="">
用户ID:
<input class="form-control" type="text" name="uid" style="width: 200px;" value="{$uid}"
placeholder="请输入用户ID">
关键字:
<input class="form-control" type="text" name="keyword" style="width: 200px;" value="{$keyword}"
placeholder="昵称/电话">
<input type="submit" class="btn btn-primary" value="搜索"/>
<a class="btn btn-danger" href="">清空</a>
</form>
<form method="post" class="js-ajax-form" action="">
<table class="table table-hover table-bordered table-list">
<thead>
<tr>
<th width="16">
<label>
<input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x">
</label>
</th>
<th width="50">ID</th>
<th>姓名</th>
<th>头像</th>
<th>电话</th>
</tr>
</thead>
<tbody id="tb">
<foreach name="list" item="vo">
<tr id="check-tr">
<td >
<input type="checkbox" id="in{$vo.id}" class="js-check" data-yid="js-check-y" data-xid="js-check-x" name="ids[]"
value="{$vo.id}" data-name="{$vo.user_login}" <if condition="in_array($vo['id'],$selectedIds)"> checked</if> >
</td>
<td>{$vo.id}</td>
<td>{$vo.user_login|default=$vo.user_nickname}</td>
<td><img width="50px" src="{$vo.avatar}"></td>
<td>{$vo.mobile}</td>
</tr>
</foreach>
</tbody>
</table>
</form>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script>
// $('.js-check').click(function(e) {
// var sel_id='in'+e.currentTarget.defaultValue;
//
// $( ".js-check" ).each( function(res) {
// console.log(res)
// $(".js-check").eq(res).prop("checked",false)
// $('#'+sel_id).prop("checked",true)
// } );
// }
//
// )
$('.data-item-tr').click(function (e) {
console.log(e);
var $this = $(this);
if ($(e.target).is('input')) {
return;
}
var $input = $this.find('input');
if ($input.is(':checked')) {
$input.prop('checked', false);
} else {
$input.prop('checked', true);
}
});
function confirm() {
var selectedUsersId = [];
var selectedUsersName = [];
var selectedUsers = [];
$('.js-check:checked').each(function () {
var $this = $(this);
selectedUsersId.push($this.val());
selectedUsersName.push($this.data('name'));
selectedUsers.push({
id: $this.val(),
name: $this.data('name')
});
});
return {
selectedUsers: selectedUsers,
selectedUsersId: selectedUsersId,
selectedUsersName: selectedUsersName
};
}
</script>
</body>
</html>
\ No newline at end of file
... ...