mirror of
https://gitee.com/XM-GO/PandaX.git
synced 2026-04-23 10:58:35 +08:00
【更新】更新
This commit is contained in:
@@ -4,7 +4,6 @@ import (
|
||||
entity "pandax/apps/system/entity"
|
||||
services "pandax/apps/system/services"
|
||||
"pandax/base/biz"
|
||||
"pandax/base/ctx"
|
||||
"pandax/base/ginx"
|
||||
)
|
||||
|
||||
@@ -23,7 +22,7 @@ type MenuApi struct {
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /system/menu/menuTreSelect [get]
|
||||
// @Security X-TOKEN
|
||||
func (m *MenuApi) GetMenuTreeSelect(rc *ctx.ReqCtx) {
|
||||
func (m *MenuApi) GetMenuTreeSelect(rc *ginx.ReqCtx) {
|
||||
lable := m.MenuApp.SelectMenuLable(entity.SysMenu{})
|
||||
rc.ResData = lable
|
||||
}
|
||||
@@ -35,7 +34,7 @@ func (m *MenuApi) GetMenuTreeSelect(rc *ctx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 400, "message": "抱歉未找到相关信息"}"
|
||||
// @Router /system/menu/menuRole [get]
|
||||
// @Security X-TOKEN
|
||||
func (m *MenuApi) GetMenuRole(rc *ctx.ReqCtx) {
|
||||
func (m *MenuApi) GetMenuRole(rc *ginx.ReqCtx) {
|
||||
roleKey := rc.GinCtx.Query("roleKey")
|
||||
biz.IsTrue(roleKey != "", "请传入角色Key")
|
||||
rc.ResData = Build(*m.MenuApp.SelectMenuRole(roleKey))
|
||||
@@ -49,7 +48,7 @@ func (m *MenuApi) GetMenuRole(rc *ctx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 400, "message": "抱歉未找到相关信息"}"
|
||||
// @Router /system/menu/menuTreRoleSelect/{roleId} [get]
|
||||
// @Security X-TOKEN
|
||||
func (m *MenuApi) GetMenuTreeRoleSelect(rc *ctx.ReqCtx) {
|
||||
func (m *MenuApi) GetMenuTreeRoleSelect(rc *ginx.ReqCtx) {
|
||||
roleId := ginx.PathParamInt(rc.GinCtx, "roleId")
|
||||
|
||||
result := m.MenuApp.SelectMenuLable(entity.SysMenu{})
|
||||
@@ -71,7 +70,7 @@ func (m *MenuApi) GetMenuTreeRoleSelect(rc *ctx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 400, "message": "抱歉未找到相关信息"}"
|
||||
// @Router /system/menu/menuPaths [get]
|
||||
// @Security X-TOKEN
|
||||
func (m *MenuApi) GetMenuPaths(rc *ctx.ReqCtx) {
|
||||
func (m *MenuApi) GetMenuPaths(rc *ginx.ReqCtx) {
|
||||
roleKey := rc.GinCtx.Query("roleKey")
|
||||
biz.IsTrue(roleKey != "", "请传入角色Key")
|
||||
rc.ResData = m.RoleMenuApp.GetMenuPaths(entity.SysRoleMenu{RoleName: roleKey})
|
||||
@@ -87,7 +86,7 @@ func (m *MenuApi) GetMenuPaths(rc *ctx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 400, "message": "抱歉未找到相关信息"}"
|
||||
// @Router /system/menu/menuList [get]
|
||||
// @Security Bearer
|
||||
func (m *MenuApi) GetMenuList(rc *ctx.ReqCtx) {
|
||||
func (m *MenuApi) GetMenuList(rc *ginx.ReqCtx) {
|
||||
menuName := rc.GinCtx.Query("menuName")
|
||||
status := rc.GinCtx.Query("status")
|
||||
|
||||
@@ -107,7 +106,7 @@ func (m *MenuApi) GetMenuList(rc *ctx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 400, "message": "抱歉未找到相关信息"}"
|
||||
// @Router /system/menu/{menuId} [get]
|
||||
// @Security Bearer
|
||||
func (m *MenuApi) GetMenu(rc *ctx.ReqCtx) {
|
||||
func (m *MenuApi) GetMenu(rc *ginx.ReqCtx) {
|
||||
menuId := ginx.PathParamInt(rc.GinCtx, "menuId")
|
||||
|
||||
rc.ResData = m.MenuApp.FindOne(int64(menuId))
|
||||
@@ -121,7 +120,7 @@ func (m *MenuApi) GetMenu(rc *ctx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
|
||||
// @Router /system/menu [post]
|
||||
// @Security X-TOKEN
|
||||
func (m *MenuApi) InsertMenu(rc *ctx.ReqCtx) {
|
||||
func (m *MenuApi) InsertMenu(rc *ginx.ReqCtx) {
|
||||
var menu entity.SysMenu
|
||||
ginx.BindJsonAndValid(rc.GinCtx, &menu)
|
||||
menu.CreateBy = rc.LoginAccount.UserName
|
||||
@@ -142,7 +141,7 @@ func (m *MenuApi) InsertMenu(rc *ctx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": -1, "message": "修改失败"}"
|
||||
// @Router /system/menu [put]
|
||||
// @Security X-TOKEN
|
||||
func (m *MenuApi) UpdateMenu(rc *ctx.ReqCtx) {
|
||||
func (m *MenuApi) UpdateMenu(rc *ginx.ReqCtx) {
|
||||
var menu entity.SysMenu
|
||||
ginx.BindJsonAndValid(rc.GinCtx, &menu)
|
||||
menu.UpdateBy = rc.LoginAccount.UserName
|
||||
@@ -162,7 +161,7 @@ func (m *MenuApi) UpdateMenu(rc *ctx.ReqCtx) {
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
|
||||
// @Router /system/menu/{menuId} [delete]
|
||||
func (m *MenuApi) DeleteMenu(rc *ctx.ReqCtx) {
|
||||
func (m *MenuApi) DeleteMenu(rc *ginx.ReqCtx) {
|
||||
menuId := ginx.PathParamInt(rc.GinCtx, "menuId")
|
||||
m.MenuApp.Delete([]int64{int64(menuId)})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user