forked from lxh/go-wxhelper
24 lines
506 B
Go
24 lines
506 B
Go
package menu
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"wechat-robot/pkg/response"
|
|
"wechat-robot/service/menu"
|
|
)
|
|
|
|
// GetUserMenuTree
|
|
// @description: 获取用户权限内的菜单树
|
|
// @param ctx
|
|
func GetUserMenuTree(ctx *gin.Context) {
|
|
// 获取用户Id
|
|
userId := ctx.GetString("userId")
|
|
// 获取菜单树
|
|
tree, err := menu.GetUserMenus(userId)
|
|
if err != nil {
|
|
response.New(ctx).SetMsg("系统错误").SetError(err).Fail()
|
|
return
|
|
}
|
|
// 返回数据
|
|
response.New(ctx).SetData(tree).Success()
|
|
}
|