Commit 52f6bd7d authored by hujun's avatar hujun

edit

parent b0585786
<?php
/**
* Created by PhpStorm.
* User: fuju
* User: hujun
* Date: 2018/1/16
* Time: 13:51
*/
namespace app\index\controller;
class Auth
use app\index\extend\Basic;
use app\index\untils\AuthUntils;
use app\model\AuthGroup;
class Auth extends Basic
{
/**
* 权限列表页
*
* @return type
*/
public function index(){
return view('index');
}
public function getAuth() {
$data['status'] = 200;
$data['msg'] = '';
$params = $this->request->param();
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
$auth_group = New AuthGroup();
$data = $auth_group->getList($pageNo, $pageSize, '','*');
return $this->response(200, '', $data);
}
}
\ No newline at end of file
This diff is collapsed.
{layout name="global/frame_tpl" /}
<input type="hidden" class="page-load" id="auth" />
<div id="page-content-wrapper">
<div class="container">
<div class="col-lg-10 col-lg-offset-0">
<table class="table table-responsive table-bordered table-hover dataTable">
<thead>
<tr>
<th class="text-center">ID</th>
<th class="text-center">角色名</th>
<th class="text-center">描述</th>
<th class="text-center">状态</th>
<th class="text-center">操作</th>
</tr>
</thead>
<tbody id="auth_list">
</tbody>
</table>
</div>
</div>
</div>
\ No newline at end of file
......@@ -18,20 +18,23 @@
<!--</ul>-->
<!--</li>-->
<li role="presentation" class="active">
<a href="/admin.php/index/banner"> 首页轮播图</a>
<a href="/admin.php/index/banner.html"> 首页轮播图</a>
</li>
<li role="presentation">
<a href="/admin.php/index/users_list"> 用户列表</a>
<a href="/admin.php/index/users_list.html"> 用户列表</a>
</li>
<li role="presentation">
<a href="/admin.php/index/watch_shop"> 预约看铺列表</a>
<a href="/admin.php/index/watch_shop.html"> 预约看铺列表</a>
</li>
<li role="presentation">
<a href="/admin.php/index/transfer_list"> 委托转铺列表</a>
<a href="/admin.php/index/transfer_list.html"> 委托转铺列表</a>
</li>
<li role="presentation">
<a href="/admin.php/index/version"> 版本号管理</a>
<a href="/admin.php/index/version.html"> 版本号管理</a>
</li>
<li role="presentation">
<a href="/admin.php/index/auth.html">权限管理</a>
</li>
</ul>
......
<?php
// 权限模型
// +----------------------------------------------------------------------
// | Copyright (c) 2016-2017 http://www.eacoo123.com, All rights reserved.
// +----------------------------------------------------------------------
// | [EacooPHP] 并不是自由软件,可免费使用,未经许可不能去掉EacooPHP相关版权。
// | 禁止在EacooPHP整体或任何部分基础上发展任何派生、修改或第三方版本用于重新分发
// +----------------------------------------------------------------------
// | Author: 心云间、凝听 <981248356@qq.com>
// +----------------------------------------------------------------------
namespace app\admin\model;
// 权限模型
use app\common\model\Base;
class AuthGroup extends Base
namespace app\model;
use think\Model;
class AuthGroup extends Model
{
const TYPE_ADMIN = 1; // 管理员用户组类型标识
const MEMBER = 'users';
const MEMBER = 'agents';
const AUTH_GROUP_ACCESS = 'auth_group_access'; // 关系表表名
const AUTH_EXTEND = 'auth_extend'; // 动态权限扩展信息表
const AUTH_GROUP = 'auth_group'; // 用户组表名
const AUTH_EXTEND_CATEGORY_TYPE = 1; // 分类权限标识
const AUTH_EXTEND_MODEL_TYPE = 2; //分类权限标识
// 定义时间戳字段名
protected $createTime = '';
protected $updateTime = '';
protected $insert =['status'=>1];
/**
......@@ -34,7 +19,6 @@ class AuthGroup extends Base
* 默认返回正常状态的管理员用户组列表
* @param array $where 查询条件,供where()方法使用
*
* @author 朱亚杰 <zhuyajie@topthink.net>
*/
public function getGroups($where=array()){
$map = array('status'=>1);
......@@ -44,7 +28,6 @@ class AuthGroup extends Base
/**
* 把用户添加到用户组,支持批量添加用户到用户组
* @author 朱亚杰 <zhuyajie@topthink.net>
*
* 示例: 把uid=1的用户添加到group_id为1,2的组 `AuthGroupModel->addToGroup(1,'1,2');`
*/
......@@ -73,15 +56,6 @@ class AuthGroup extends Base
}
}
// $user_auth_role = db('users')->where(array('uid'=>$u))->value('auth_groups');
// if ($user_auth_role) {
// $user_auth_role = explode(',', $user_auth_role);
// $user_auth_role = array_merge($user_auth_role,$gid);
// } else{
// $user_auth_role = $gid;
// }
// db('users')->where(array('uid'=>$u))->update(['auth_groups',implode(',',$user_auth_role)]);//同时将用户角色关联(16/07/06新增)
}
if (!empty($add) && is_array($add)) {
......@@ -129,7 +103,6 @@ class AuthGroup extends Base
* 将用户从用户组中移除
* @param int|string|array $gid 用户组id
* @param int|string|array $cid 分类id
* @author 朱亚杰 <xcoolcc@gmail.com>
*/
public function removeFromGroup($uid,$gid){
$del_result = model(self::AUTH_GROUP_ACCESS)->where( array( 'uid'=>$uid,'group_id'=>$gid) )->delete();
......@@ -143,12 +116,11 @@ class AuthGroup extends Base
}
return $del_result;
}
/**
/**
* 获取某个用户组的用户列表
*
* @param int $group_id 用户组id
*
* @author 朱亚杰 <zhuyajie@topthink.net>
*/
static public function userInGroup($group_id){
$prefix = config('database.prefix');
......@@ -165,7 +137,6 @@ class AuthGroup extends Base
/**
* 检查id是否全部存在
* @param array|string $gid 用户组id列表
* @author 朱亚杰 <zhuyajie@topthink.net>
*/
public function checkId($modelname,$mid,$msg = '以下id不存在:'){
if(is_array($mid)){
......@@ -186,12 +157,31 @@ class AuthGroup extends Base
return false;
}
}
/**
/**
* 检查用户组是否全部存在
* @param array|string $gid 用户组id列表
* @author 朱亚杰 <zhuyajie@topthink.net>
*/
public function checkGroupId($gid){
return $this->checkId('AuthGroup',$gid, '以下用户组id不存在:');
}
/**
* 返回权限分组
*
* @param type $pageNo
* @param type $pageSize
* @param type $order_
* @param type $field
* @param type $params
* @return type
*/
public function getList($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field = '', $params = '') {
return $this->field($field)
->where($params)
->order($order_)
->limit($pageSize)
->page($pageNo)
->select();
}
}
......@@ -3,8 +3,6 @@
namespace app\admin\model;
use think\Model;
class AuthGroupAccess extends Base
{
// 设置完整的数据表(包含前缀)
......
This diff is collapsed.
<script id="watch_list_tpl" type="text/template">
<script id="auth_list_tpl" type="text/template">
[% if(it) { %]
[% for(var item in it){ %]
<tr>
<td>[%= it[item]['house_title'] %]</td>
<td>[%= it[item]['appellation'] %]</td>
<td>[%= it[item]["phone"] %]</td>
<td>[%= it[item]["expect_time"] %]</td>
<td>[%= it[item]["other_require"] %]</td>
<td>[%= it[item]["create_time"] %]</td>
<tr class="text-center">
<td>[%= it[item]['id'] %]</td>
<td>[%= it[item]['title'] %]</td>
<td>
<a class="btn1 btn-success " href="#modal-process" data-toggle="modal" data-id="[%= it[item]['id'] %]" onclick="alertFollow(this)">跟进</a>
<a data-toggle="modal" data-id="[%= it[item]['id'] %]"
[% if (it[item]["applies_id"] == 0){ %]
href="#modal-watch" class="btn1 btn-danger add_applies">转为报备</a>
[% }else{ %]
class="btn1 btn-info">已转为报备</a>
[% if(it[item]['description']) { %]
[%= it[item]['description'] %]
[% } %]
</td>
<td>[%= it[item]["status"] %]</td>
<td>
<a title="编辑" class="btn btn-success btn-xs" href="/admin.php/admin/auth/roleedit/group_id/1.html" style="margin-right:6px;">编辑</a>
<a title="权限分配" class="btn btn-info btn-xs" href="/admin.php/admin/auth/access/group_id/1.html" style="margin-right:6px;">权限分配</a>
<a title="成员授权" class="btn btn-primary btn-xs" href="/admin.php/admin/auth/accessuser/group_id/1.html" style="margin-right:6px;">成员授权</a>
</td>
</tr>
[% } %]
[% }else{ %]
......@@ -24,4 +22,4 @@
<td colspan="8" style="text-align:center;"> 暂无数据</td>
</tr>
[% } %]
</script>
\ No newline at end of file
</script>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment