This commit is contained in:
苏尹岚
2021-01-25 15:19:45 +08:00
parent e169216f08
commit 7788b79993

View File

@@ -18,8 +18,15 @@ func GetMenu(ctx *jxcontext.Context, userID string) (menus []*model.Menu, err er
if userID == "" {
return dao.GetMenu(dao.GetDB(), "", 0, userID)
} else {
return dao.GetMenuWithUser(dao.GetDB(), "", 0, userID)
if user, err := dao.GetUserByID(dao.GetDB(), "user_id", userID); err == nil {
if user.Type&model.UserTypeRole != 0 {
return dao.GetMenuWithUser(dao.GetDB(), "", 0, userID)
} else {
return dao.GetMenu(dao.GetDB(), "", 0, "")
}
}
}
return dao.GetMenu(dao.GetDB(), "", 0, userID)
}
func AddMenu(ctx *jxcontext.Context, menu *model.Menu) (err error) {