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
eca7a534
Commit
eca7a534
authored
Jan 31, 2018
by
zfc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
权限接口需要
parent
94a5defb
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
19 deletions
+48
-19
Agent.php
application/index/controller/Agent.php
+12
-15
Auth.php
application/index/controller/Auth.php
+34
-2
AAgents.php
application/model/AAgents.php
+1
-1
route.php
application/route.php
+1
-1
No files found.
application/index/controller/Agent.php
View file @
eca7a534
...
@@ -101,10 +101,10 @@ class Agent extends Basic
...
@@ -101,10 +101,10 @@ class Agent extends Basic
* */
* */
public
function
saveAgent
(
$group_id
=
0
){
public
function
saveAgent
(
$group_id
=
0
){
$group_id
=
$this
->
request
->
param
(
'id'
);
$table
=
New
AAgents
;
$table
=
New
AAgents
;
if
(
IS_POST
&&
$group_id
==
0
)
{
if
(
$this
->
request
->
isPost
()
)
{
$data
=
input
(
'post.'
);
$data
=
input
(
'post.'
);
...
@@ -171,32 +171,29 @@ class Agent extends Basic
...
@@ -171,32 +171,29 @@ class Agent extends Basic
/**
/**
* 批量变更角色
* 批量变更角色
* @post ids 用户组id
* @post ids 用户组id
* @post idname 实际id名(auth_group_access表无id)
* @post group_id 变更的角色组id
* @post group_id 变更的角色组id
*/
*/
public
function
updateRole
(){
public
function
updateRole
(){
$table
=
New
AAgents
;
$table
=
New
AAgents
;
$table2
=
New
AuthGroupAccess
;
$data
=
$this
->
request
->
param
();
$data
=
$this
->
request
->
param
();
$ids
=
$data
[
'ids'
];
$ids
=
$data
[
'ids'
];
//1.清空原有数据
if
(
!
empty
(
$ids
)
&&!
empty
(
$data
[
'group_id'
])){
if
(
!
empty
(
$ids
)
&&!
empty
(
$data
[
'group_id'
])){
if
(
$table2
->
delUid
(
$data
[
'idname'
],
$ids
)){
if
(
$table
->
saveStatus
(
'auth_group_id'
,
$data
[
'group_id'
],
$ids
)){
//2.从新分发角色
$data2
[
'group_id'
]
=
$data
[
'group_id'
];
return
$this
->
response
(
200
,
'成功'
,
$data
);
if
(
$table
->
addAllAccess
(
$ids
,
$data2
)){
return
$this
->
response
(
200
,
'成功'
,
$data
);
}
else
{
return
$this
->
response
(
100
,
'失败'
,
$data
);
}
}
}
return
$this
->
response
(
100
,
'失败'
,
$data
);
}
else
{
return
$this
->
response
(
100
,
'数据为空'
,
$data
);
}
}
}
}
//
//
...
...
application/index/controller/Auth.php
View file @
eca7a534
...
@@ -58,8 +58,18 @@ class Auth extends Basic
...
@@ -58,8 +58,18 @@ class Auth extends Basic
$params
=
$this
->
request
->
param
();
$params
=
$this
->
request
->
param
();
$pageNo
=
empty
(
$params
[
'pageNo'
])
?
1
:
$params
[
'pageNo'
];
$pageNo
=
empty
(
$params
[
'pageNo'
])
?
1
:
$params
[
'pageNo'
];
$pageSize
=
empty
(
$params
[
'pageSize'
])
?
15
:
$params
[
'pageSize'
];
$pageSize
=
empty
(
$params
[
'pageSize'
])
?
15
:
$params
[
'pageSize'
];
$auth_group
=
New
AuthGroup
();
$auth_group
=
New
AuthGroup
();
$where
=
'status <> 0'
;
$where
=
'status <> 0'
;
$search
=
$params
[
'search'
];
if
(
!
empty
(
$search
)){
// Session::set("search.agent",$search);
$where
.=
" and id='
$search
' or title like '%
$search
%' "
;
$data
[
'search'
]
=
$search
;
}
$data
[
'list'
]
=
$auth_group
->
getList
(
$pageNo
,
$pageSize
,
'id desc'
,
'*'
,
$where
);
$data
[
'list'
]
=
$auth_group
->
getList
(
$pageNo
,
$pageSize
,
'id desc'
,
'*'
,
$where
);
$data
[
'total'
]
=
$auth_group
->
getTotal
(
$where
);
$data
[
'total'
]
=
$auth_group
->
getTotal
(
$where
);
return
$this
->
response
(
200
,
''
,
$data
);
return
$this
->
response
(
200
,
''
,
$data
);
...
@@ -133,7 +143,15 @@ class Auth extends Basic
...
@@ -133,7 +143,15 @@ class Auth extends Basic
if
(
$err
!=
1
){
if
(
$err
!=
1
){
return
$this
->
response
(
100
,
$err
);
return
$this
->
response
(
100
,
$err
);
}
}
$id
=
isset
(
$data
[
'id'
])
&&
$data
[
'id'
]
>
0
?
$data
[
'id'
]
:
false
;
//新增或者编辑数据
if
(
empty
(
$data
[
'id'
])){
$data
[
'create_time'
]
=
date
(
'Y-m-d H:i:s'
,
time
());
$data
[
'update_time'
]
=
date
(
'Y-m-d H:i:s'
,
time
());
$id
=
''
;
}
else
{
$data
[
'update_time'
]
=
date
(
'Y-m-d H:i:s'
,
time
());
$id
=
$data
[
'id'
];
}
if
(
$table
->
editData
(
$data
,
$id
))
{
if
(
$table
->
editData
(
$data
,
$id
))
{
return
$this
->
response
(
200
,
'成功'
);
return
$this
->
response
(
200
,
'成功'
);
...
@@ -150,6 +168,7 @@ class Auth extends Basic
...
@@ -150,6 +168,7 @@ class Auth extends Basic
}
}
}
}
//权限表list
//权限表list
public
function
classList
(
$type
=
1
){
public
function
classList
(
$type
=
1
){
$table
=
new
authRule
;
$table
=
new
authRule
;
...
@@ -185,7 +204,15 @@ class Auth extends Basic
...
@@ -185,7 +204,15 @@ class Auth extends Basic
$data
[
'id'
]
=
$group_id
;
$data
[
'id'
]
=
$group_id
;
$menu_auth
=
input
(
'post.menu_auth/a'
,
''
);
//获取所有授权菜单id
$menu_auth
=
input
(
'post.menu_auth/a'
,
''
);
//获取所有授权菜单id
$data
[
'rules'
]
=
implode
(
','
,
$menu_auth
);
//拼接
$data
[
'rules'
]
=
implode
(
','
,
$menu_auth
);
//拼接
$id
=
isset
(
$data
[
'id'
])
&&
$data
[
'id'
]
>
0
?
$data
[
'id'
]
:
false
;
//新增或者编辑数据
if
(
empty
(
$data
[
'id'
])){
$data
[
'create_time'
]
=
date
(
'Y-m-d H:i:s'
,
time
());
$data
[
'update_time'
]
=
date
(
'Y-m-d H:i:s'
,
time
());
$id
=
''
;
}
else
{
$data
[
'update_time'
]
=
date
(
'Y-m-d H:i:s'
,
time
());
$id
=
$data
[
'id'
];
}
//提交数据
//提交数据
if
(
$table
->
editData
(
$data
,
$id
))
{
if
(
$table
->
editData
(
$data
,
$id
))
{
...
@@ -270,6 +297,11 @@ class Auth extends Basic
...
@@ -270,6 +297,11 @@ class Auth extends Basic
//条件
//条件
$field
=
"a.id,a.name,a.title,a.depend_flag,a.type,a.pid,a.icon,a.sort,if(a.is_menu,'是','否')is_menu,a.status,ifnull(b.title,'顶级') as title2"
;
$field
=
"a.id,a.name,a.title,a.depend_flag,a.type,a.pid,a.icon,a.sort,if(a.is_menu,'是','否')is_menu,a.status,ifnull(b.title,'顶级') as title2"
;
$where
=
'a.status=1'
;
$where
=
'a.status=1'
;
$search
=
$params
[
'search'
];
if
(
!
empty
(
$search
)){
$where
.=
" and a.id='
$search
' or a.name like '%
$search
%' "
;
$data
[
'search'
]
=
$search
;
}
$order
=
'a.pid asc,a.sort asc'
;
$order
=
'a.pid asc,a.sort asc'
;
$join
=
[[
'auth_rule b'
,
' a.pid=b.id'
,
'left'
]];
$join
=
[[
'auth_rule b'
,
' a.pid=b.id'
,
'left'
]];
$data
[
'list'
]
=
$table
->
authRuleList
(
$pageNo
,
$pageSize
,
$order
,
$field
,
$join
,
$where
);
$data
[
'list'
]
=
$table
->
authRuleList
(
$pageNo
,
$pageSize
,
$order
,
$field
,
$join
,
$where
);
...
...
application/model/AAgents.php
View file @
eca7a534
...
@@ -47,7 +47,7 @@ public function saveList(){
...
@@ -47,7 +47,7 @@ public function saveList(){
}
}
//更新数据
//更新数据
public
function
saveStatus
(
$name
,
$key
,
$ids
){
public
function
saveStatus
(
$name
,
$key
,
$ids
){
$r
=
$this
->
save
([
$name
,
$key
],[
"id"
,
'in'
,
$ids
]);
$r
=
$this
->
where
(
"id"
,
'in'
,
$ids
)
->
update
([
$name
=>
$key
]);
return
$r
;
return
$r
;
}
}
//删除数据
//删除数据
...
...
application/route.php
View file @
eca7a534
...
@@ -100,7 +100,7 @@ Route::group('index', [
...
@@ -100,7 +100,7 @@ Route::group('index', [
'AgentList'
=>
[
'index/agent/AgentList'
,
[
'method'
=>
'get'
]],
//列表
'AgentList'
=>
[
'index/agent/AgentList'
,
[
'method'
=>
'get'
]],
//列表
'saveAgent'
=>
[
'index/agent/saveAgent'
,
[
'method'
=>
'post'
]],
//列表
'saveAgent'
=>
[
'index/agent/saveAgent'
,
[
'method'
=>
'post'
]],
//列表
'updateStatus'
=>
[
'index/agent/updateStatus'
,
[
'method'
=>
'get'
]],
//列表
'updateStatus'
=>
[
'index/agent/updateStatus'
,
[
'method'
=>
'get'
]],
//列表
'updateRole'
=>
[
'index/agent/updateRole'
,
[
'method'
=>
'
get'
]],
//列表
'updateRole'
=>
[
'index/agent/updateRole'
,
[
'method'
=>
'
post'
]],
//经纪人角色修改接口
//商圈
//商圈
...
...
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