mirror of
https://github.com/tiger1103/gfast.git
synced 2026-09-21 10:12:59 +00:00
分离权限标识与组件路径
This commit is contained in:
@@ -13,7 +13,7 @@ import (
|
||||
type MenuReq struct {
|
||||
MenuType uint `p:"menuType" v:"min:0|max:2#菜单类型最小值为:min|菜单类型最大值为:max"`
|
||||
Pid uint `p:"parentId" v:"min:0"`
|
||||
Name string `p:"component" v:"required#请填写规则名称"`
|
||||
Name string `p:"name" v:"required#请填写规则名称"`
|
||||
Title string `p:"menuName" v:"required|length:1,100#请填写标题|标题长度在:min到:max位"`
|
||||
Icon string `p:"icon"`
|
||||
Weigh int `p:"orderNum" `
|
||||
@@ -22,6 +22,7 @@ type MenuReq struct {
|
||||
Status uint `p:"status" `
|
||||
AlwaysShow uint `p:"visible"`
|
||||
Path string `p:"path"`
|
||||
Component string `p:"component" v:"required-if:menuType,1#组件路径不能为空"`
|
||||
IsFrame uint `p:"is_frame"`
|
||||
}
|
||||
|
||||
@@ -84,6 +85,7 @@ func Add(req *MenuReq) (err error, insertId int64) {
|
||||
entity.Status = req.Status
|
||||
entity.MenuType = req.MenuType
|
||||
entity.Path = req.Path
|
||||
entity.Component = req.Component
|
||||
entity.AlwaysShow = req.AlwaysShow
|
||||
entity.Icon = req.Icon
|
||||
entity.Name = req.Name
|
||||
@@ -115,6 +117,7 @@ func Edit(req *MenuReq, id int) (err error, rows int64) {
|
||||
entity.Status = req.Status
|
||||
entity.MenuType = req.MenuType
|
||||
entity.Path = req.Path
|
||||
entity.Component = req.Component
|
||||
entity.AlwaysShow = req.AlwaysShow
|
||||
entity.Icon = req.Icon
|
||||
entity.Name = req.Name
|
||||
|
||||
@@ -25,6 +25,7 @@ type Entity struct {
|
||||
Status uint `orm:"status" json:"status"` // 状态
|
||||
AlwaysShow uint `orm:"always_show" json:"alwaysShow"` //显示状态 0隐藏 1显示
|
||||
Path string `orm:"path" json:"path"` //路由地址
|
||||
Component string `orm:"component" json:"component"` //组件路径
|
||||
IsFrame uint `orm:"is_frame" json:"isFrame"` //是否外链 1是 0否
|
||||
}
|
||||
|
||||
|
||||
@@ -252,7 +252,7 @@ func setMenuMap(menu g.Map, entity *auth_rule.Entity) g.Map {
|
||||
menu["name"] = gstr.UcFirst(entity.Path)
|
||||
menu["menuName"] = entity.Title
|
||||
if entity.MenuType != 0 {
|
||||
menu["component"] = entity.Name
|
||||
menu["component"] = entity.Component
|
||||
menu["path"] = entity.Path
|
||||
} else {
|
||||
menu["path"] = "/" + entity.Path
|
||||
|
||||
Reference in New Issue
Block a user