Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujun
tl_estate
Commits
52f6bd7d
Commit
52f6bd7d
authored
Jan 16, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
edit
parent
b0585786
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
97 additions
and
64 deletions
+97
-64
Auth.php
application/index/controller/Auth.php
+25
-3
AuthUntils.php
application/index/untils/AuthUntils.php
+0
-0
index.html
application/index/view/auth/index.html
+22
-0
navigation.html
application/index/view/global/navigation.html
+8
-5
AuthGroup.php
application/model/AuthGroup.php
+28
-38
AuthGroupAccess.php
application/model/AuthGroupAccess.php
+0
-2
auth.js
public/resource/js/auth.js
+0
-0
auth_template_tpl.html
public/resource/template/auth_template_tpl.html
+14
-16
No files found.
application/index/controller/Auth.php
View file @
52f6bd7d
<?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
application/index/untils/AuthUntils.php
View file @
52f6bd7d
This diff is collapsed.
Click to expand it.
application/index/view/auth/index.html
0 → 100644
View file @
52f6bd7d
{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
application/index/view/global/navigation.html
View file @
52f6bd7d
...
...
@@ -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>
...
...
application/model/AuthGroup.php
View file @
52f6bd7d
<?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
=
'
user
s'
;
const
MEMBER
=
'
agent
s'
;
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
();
}
}
application/model/AuthGroupAccess.php
View file @
52f6bd7d
...
...
@@ -3,8 +3,6 @@
namespace
app\admin\model
;
use
think\Model
;
class
AuthGroupAccess
extends
Base
{
// 设置完整的数据表(包含前缀)
...
...
public/resource/js/auth.js
View file @
52f6bd7d
This diff is collapsed.
Click to expand it.
public/resource/template/auth_template_tpl.html
View file @
52f6bd7d
<script
id=
"
watc
h_list_tpl"
type=
"text/template"
>
<script
id=
"
aut
h_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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment