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
4cfff754
Commit
4cfff754
authored
Apr 16, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
角色权限编辑
parent
8397e40c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
19 deletions
+67
-19
TransferHouseInfo.php
application/api/controller/TransferHouseInfo.php
+6
-2
Auth.php
application/index/controller/Auth.php
+15
-10
AuthGroup.php
application/model/AuthGroup.php
+46
-7
No files found.
application/api/controller/TransferHouseInfo.php
View file @
4cfff754
...
...
@@ -49,8 +49,7 @@ class TransferHouseInfo extends Controller
}
$g_house_data
[
'market_area'
]
=
$house_info_data
[
'business_area'
];
$g_house_data
[
'shop_area_start'
]
=
$house_info_data
[
'room_area'
];
$g_house_data
[
'shop_area_end'
]
=
$house_info_data
[
'room_area2'
];
$g_house_data
[
'rent_type'
]
=
$house_info_data
[
'rent_type'
];
$g_house_data
[
'rent_price'
]
=
$house_info_data
[
'price'
];
$g_house_data
[
'industry_type'
]
=
$house_info_data
[
'yetai'
];
...
...
@@ -59,10 +58,15 @@ class TransferHouseInfo extends Controller
//状态 0待审批 1上架 2下架 3回收
if
(
$g_house_data
[
'room_num_left'
]
==
0
)
{
$g_house_data
[
'status'
]
=
2
;
$g_house_data
[
'shop_area_start'
]
=
$house_info_data
[
'room_area'
];
$g_house_data
[
'shop_area_end'
]
=
$house_info_data
[
'room_area2'
];
}
else
{
$g_house_data
[
'status'
]
=
1
;
$g_house_data
[
'shop_area_start'
]
=
$house_info_data
[
'room_area'
];
$g_house_data
[
'shop_area_end'
]
=
$house_info_data
[
'room_area'
];
}
$g_house_data
[
'home_page_sort'
]
=
empty
(
$house_info_data
[
'home_page_sort'
])
?
0
:
$house_info_data
[
'home_page_sort'
];
$g_house_data
[
'shop_type'
]
=
$house_info_data
[
'shangpu_type'
];
$g_house_data
[
'shop_sign'
]
=
$house_info_data
[
'shangpu_tags'
];
...
...
application/index/controller/Auth.php
View file @
4cfff754
...
...
@@ -253,22 +253,27 @@ class Auth extends Basic
}
return
$this
->
response
(
200
,
'可以查看'
,
$data
);
}
//编辑角色权限
/**
* 编辑角色权限
*
* @return \think\Response
*/
public
function
updateAccess
(){
$table
=
New
AuthGroup
;
$auth
=
new
AuthGroup
();
$this
->
params
[
'rules'
]
=
trim
(
$this
->
params
[
'rules'
],
','
);
$rules
=
$auth
->
getValue
(
'rules'
,[
'id'
=>
$this
->
params
[
'id'
]]);
$data
=
input
(
'post.'
);
// prt($data
);
$data
[
'rules'
]
=
trim
(
$data
[
'rules'
],
','
);
//提交数据
if
(
$table
->
editData
(
$data
,
$data
[
'id'
]))
{
if
(
$rules
==
$this
->
params
[
'rules'
])
{
return
$this
->
response
(
100
,
'无更新内容'
);
}
if
(
$auth
->
saveStatus
(
'rules'
,
$this
->
params
[
'rules'
],
$this
->
params
[
'id'
]))
{
return
$this
->
response
(
200
,
'成功'
);
}
else
{
return
$this
->
response
(
100
,
'失败'
);
}
}
/**
...
...
application/model/AuthGroup.php
View file @
4cfff754
...
...
@@ -120,7 +120,8 @@ class AuthGroup extends BaseModel
/**
* 获取某个用户组的用户列表
*
* @param int $group_id 用户组id
* @param $group_id 用户组id
* @return mixed
*/
static
public
function
userInGroup
(
$group_id
){
$prefix
=
config
(
'database.prefix'
);
...
...
@@ -136,7 +137,11 @@ class AuthGroup extends BaseModel
/**
* 检查id是否全部存在
* @param array|string $gid 用户组id列表
*
* @param $modelname
* @param $mid
* @param string $msg
* @return bool
*/
public
function
checkId
(
$modelname
,
$mid
,
$msg
=
'以下id不存在:'
){
if
(
is_array
(
$mid
)){
...
...
@@ -160,21 +165,39 @@ class AuthGroup extends BaseModel
/**
* 检查用户组是否全部存在
* @param array|string $gid 用户组id列表
*
* @param $gid
* @return bool
*/
public
function
checkGroupId
(
$gid
){
return
$this
->
checkId
(
'AuthGroup'
,
$gid
,
'以下用户组id不存在:'
);
}
/**
* @param string $order_
* @param string $field
* @param string $params
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getList2
(
$order_
=
'id desc'
,
$field
=
''
,
$params
=
''
)
{
return
$this
->
field
(
$field
)
->
where
(
$params
)
->
order
(
$order_
)
->
select
();
}
/**
*检查重复
*
检查重复
*
* @param $key
* @param $name
* @return bool
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
repetition
(
$key
,
$name
){
$r
=
$this
->
field
(
$name
)
...
...
@@ -185,12 +208,28 @@ class AuthGroup extends BaseModel
}
else
{
return
false
;
}
}
}
//更新数据
/**
* 更新数据
*
* @param $name
* @param $key
* @param $ids
* @return $this
*/
public
function
saveStatus
(
$name
,
$key
,
$ids
){
$r
=
$this
->
where
(
"id"
,
'in'
,
$ids
)
->
update
([
$name
=>
$key
]);
return
$r
;
}
/**
* @param $key
* @param $where
* @return mixed
*/
public
function
getValue
(
$key
,
$where
)
{
return
$this
->
where
(
$where
)
->
value
(
$key
);
}
}
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