修改角色菜单

This commit is contained in:
苏尹岚
2020-09-28 16:51:08 +08:00
parent bc6ab1dd04
commit b9c4a71fde
4 changed files with 148 additions and 1 deletions

View File

@@ -108,7 +108,7 @@ func (c *PowerController) UpdateRole() {
// @Title 查询用户角色
// @Description查询用户角色
// @Param token header string true "认证token"
// @Param userID formData string false "用户ID"
// @Param userID query string false "用户ID"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /GetUserRole [get]
@@ -139,3 +139,37 @@ func (c *PowerController) UpdateUserRole() {
return retVal, "", err
})
}
// @Title 查询角色菜单
// @Description 查询角色菜单
// @Param token header string true "认证token"
// @Param roleID query int false "用户ID"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /GetRoleMenu [get]
func (c *PowerController) GetRoleMenu() {
c.callGetRoleMenu(func(params *tPowerGetRoleMenuParams) (retVal interface{}, errCode string, err error) {
retVal, err = cms.GetRoleMenu(params.Ctx, params.RoleID)
return retVal, "", err
})
}
// @Title 修改角色菜单
// @Description 修改角色菜单
// @Param token header string true "认证token"
// @Param roleIDs formData string true "角色IDs"
// @Param menuIDs formData string true "菜单IDs"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /UpdateRoleMenu [put]
func (c *PowerController) UpdateRoleMenu() {
c.callUpdateRoleMenu(func(params *tPowerUpdateRoleMenuParams) (retVal interface{}, errCode string, err error) {
var (
roleIDs, menuIDs []int
)
if err = jxutils.Strings2Objs(params.RoleIDs, &roleIDs, params.MenuIDs, &menuIDs); err == nil {
err = cms.UpdateRoleMenu(params.Ctx, roleIDs, menuIDs)
}
return retVal, "", err
})
}