Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
newShopBack
Project
Project
Details
Activity
Releases
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
newshop
newShopBack
Commits
8688737a
Commit
8688737a
authored
Dec 10, 2019
by
侯贺政
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
权限节点详情,更新权限节点
Signed-off-by:
houhezheng
<
houhezheng@romens.cn
>
parent
19bdda2e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
112 additions
and
11 deletions
+112
-11
urlmanager.php
backend/config/urlmanager.php
+1
-1
AuthorityNodeController.php
backend/controllers/v1/authority/AuthorityNodeController.php
+111
-10
No files found.
backend/config/urlmanager.php
View file @
8688737a
...
...
@@ -301,7 +301,7 @@ return [
'extraPatterns'
=>
[
'GET,OPTIONS node-list'
=>
'node-list'
,
'GET,OPTIONS node-details'
=>
'node-details'
,
'
put
,OPTIONS node-update'
=>
'node-update'
,
'
PUT
,OPTIONS node-update'
=>
'node-update'
,
'POST,OPTIONS node-add'
=>
'node-add'
,
'DELETE,OPTIONS node-del'
=>
'node-del'
,
]
...
...
backend/controllers/v1/authority/AuthorityNodeController.php
View file @
8688737a
...
...
@@ -142,14 +142,14 @@ class AuthorityNodeController extends BaseController
* @OA\Property(property="NAME" ,type="string", description="菜单地址"),
* @OA\Property(property="TITLE" ,type="string", description="菜单名称"),
* @OA\Property(property="LOGO" ,type="string",description="菜单前面的图标url"),
* @OA\Property(property="STATUS", type="int",description="菜单状态(默认1启用,0禁用)"),
* @OA\Property(property="IS_MENU", type="int",description="是否菜单(默认0否,1是)"),
* @OA\Property(property="IS_TOP_MENU", type="int",description="是否顶部菜单(默认0否,1是)"),
* @OA\Property(property="IS_DEFAULT_SHOW", type="int",description="是否进入默认显示页面(默认0否,1是)"),
* @OA\Property(property="STATUS", type="int",description="菜单状态(默认1启用,0禁用)"
,example="1"
),
* @OA\Property(property="IS_MENU", type="int",description="是否菜单(默认0否,1是)"
,example="0"
),
* @OA\Property(property="IS_TOP_MENU", type="int",description="是否顶部菜单(默认0否,1是)"
,example="0"
),
* @OA\Property(property="IS_DEFAULT_SHOW", type="int",description="是否进入默认显示页面(默认0否,1是)"
,example="0"
),
* @OA\Property(property="REMARK", type="string",description="描述"),
* @OA\Property(property="SORT", type="int",description="菜单排序序号"),
* @OA\Property(property="PID", type="string",description="父级菜单ID(默认无:0)"),
* @OA\Property(property="LEVEL",type="int",description="菜单层级等级(类型-0:项目,1:模块,2:操作)")
* @OA\Property(property="PID", type="string",description="父级菜单ID(默认无:0)"
,example="0"
),
* @OA\Property(property="LEVEL",type="int",description="菜单层级等级(类型-0:项目,1:模块,2:操作)"
,example="0"
)
* )
* )
* ),
...
...
@@ -192,9 +192,9 @@ class AuthorityNodeController extends BaseController
* summary="删除权限节点(侯贺政)",
* description="删除权限节点",
* @OA\Parameter(
* description="要删除的节点
GU
ID",
* description="要删除的节点ID",
* in="query",
* name="
GU
ID",
* name="ID",
* required=true,
* @OA\Schema(
* type="string",
...
...
@@ -209,9 +209,9 @@ class AuthorityNodeController extends BaseController
*/
public
function
actionNodeDel
()
{
$
guid
=
Yii
::
$app
->
request
->
get
(
'GU
ID'
);
$
id
=
Yii
::
$app
->
request
->
get
(
'
ID'
);
$model
=
new
$this
->
modelClass
();
$_model
=
$model
::
findOne
(
$
gu
id
);
$_model
=
$model
::
findOne
(
$id
);
if
(
!
$_model
)
{
throw
new
BadRequestHttpException
(
'Requested resource does not exist !'
);
}
...
...
@@ -221,4 +221,105 @@ class AuthorityNodeController extends BaseController
throw
new
HttpException
(
200
,
"删除成功!"
);
}
/**
* @OA\GET(
* path="/backend/web/v1/authority/authority-nodes/node-details",
* tags={"权限管理"},
* summary="权限节点详情(侯贺政)",
* description="权限节点详情",
* @OA\Parameter(
* description="节点ID",
* name="ID",
* in="query",
* @OA\Schema(
* type="string"
* )
* ),
* @OA\Response(
* response=200,
* description="
* ID:节点id,
* NAME:菜单地址,
* TITLE:菜单名称,
* LOGO:logo地址,
* STATUS:菜单状态 0禁用 1启用,
* IS_MENU:是否为菜单(1:是,0:不是),
* IS_TOP_MENU:是否顶部菜单 1是 0否,
* IS_DEFAULT_SHOW:是否进入默认显示页面 1是0否,
* REMARK:描述,
* SORT:菜单排序序号,
* PID:父级菜单ID,
* LEVEL:菜单层级等级(类型-0:项目,1:模块,2:操作)")
* ),
* security={{"Authorization":{}}}
* )
*/
public
function
actionNodeDetails
()
{
$id
=
Yii
::
$app
->
request
->
get
(
'ID'
);
$model
=
new
$this
->
modelClass
();
$info
=
$model
->
findOne
(
$id
);
if
(
!
$info
)
{
throw
new
BadRequestHttpException
(
'Requested resource does not exist !'
);
}
return
$info
;
}
/**
* @OA\PUT(
* path="/backend/web/v1/authority/authority-nodes/node-update",
* tags={"权限管理"},
* summary="更新权限节点(侯贺政)",
* description="更新权限节点",
* @OA\RequestBody(
* required=true,
* description="权限节点更新",
* @OA\MediaType(
* mediaType="application/x-www-form-urlencoded",
* @OA\Schema(
* type="object",
* required={"ID"},
* @OA\Property(property="ID",type="int",description="节点ID"),
* @OA\Property(property="NAME" ,type="string", description="菜单地址"),
* @OA\Property(property="TITLE" ,type="string", description="菜单名称"),
* @OA\Property(property="LOGO" ,type="string",description="菜单前面的图标url"),
* @OA\Property(property="STATUS", type="int",description="菜单状态(1启用,0禁用)"),
* @OA\Property(property="IS_MENU", type="int",description="是否菜单(0否,1是)"),
* @OA\Property(property="IS_TOP_MENU", type="int",description="是否顶部菜单(0否,1是)"),
* @OA\Property(property="IS_DEFAULT_SHOW", type="int",description="是否进入默认显示页面(0否,1是)"),
* @OA\Property(property="REMARK", type="string",description="描述"),
* @OA\Property(property="SORT", type="int",description="菜单排序序号"),
* @OA\Property(property="PID", type="string",description="父级菜单ID(无:0)"),
* @OA\Property(property="LEVEL",type="int",description="菜单层级等级(类型-0:项目,1:模块,2:操作)")
* )
* )
* ),
* @OA\Response(response=200,description="更新成功!"),
* security={{"Authorization":{}}}
* )
*/
public
function
actionNodeUpdate
()
{
$params
=
Yii
::
$app
->
request
->
bodyParams
;
$model
=
new
$this
->
modelClass
();
$_model
=
$model
::
findOne
(
$params
[
'ID'
]);
if
(
!
$_model
)
{
throw
new
BadRequestHttpException
(
"不存在此节点!"
);
}
//过滤掉部分为空的参数
foreach
(
$params
as
$key
=>
$value
)
{
if
(
in_array
(
$key
,
[
'TITLE'
,
'STATUS'
,
'IS_MENU'
,
'IS_TOP_MENU'
,
'IS_DEFAULT_SHOW'
,
'SORT'
,
'PID'
,
'LEVEL'
])
&&
empty
(
trim
(
$value
)))
{
unset
(
$params
[
$key
]);
}
}
$_model
->
attributes
=
$params
;
if
(
!
$_model
->
save
())
{
Yii
::
$app
->
response
->
statusCode
=
422
;
return
$_model
->
errors
;
}
throw
new
HttpException
(
200
,
'更新成功!'
);
}
}
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