|
|
@@ -28,26 +28,26 @@ type ClientMenu struct {
|
|
|
|
|
|
// PCWebMenuAuth PC客户端页面(按钮)权限
|
|
|
type PCWebMenuAuth struct {
|
|
|
- Label string `json:"label"` // 标题
|
|
|
- Code string `json:"code"` // ID,新版本中权限KEY也是这个字段
|
|
|
- RequireAuth bool `json:"requireauth"` // 是否需要权限判断
|
|
|
- IsShow bool `json:"isshow"` // 是否显示
|
|
|
- Remark string `json:"remark"` // 备注
|
|
|
+ Label string `json:"label"` // 标题
|
|
|
+ Code string `json:"code"` // ID,新版本中权限KEY也是这个字段
|
|
|
+ Rulekey string `json:"rulekey"` // 权限主键,非空表示需要判断控制,非空值不可重复
|
|
|
+ IsShow bool `json:"isshow"` // 是否显示
|
|
|
+ Remark string `json:"remark"` // 备注
|
|
|
}
|
|
|
|
|
|
// PCWebMenu PC客户端菜单权限
|
|
|
type PCWebMenu struct {
|
|
|
- Title string `json:"title"` // 标题
|
|
|
- Code string `json:"code"` // ID,新版本中权限KEY也是这个字段
|
|
|
- Path string `json:"path"` // 路由路径
|
|
|
- Component string `json:"component"` // 路由组件
|
|
|
- Sort int `json:"sort"` // 排序
|
|
|
- RequireAuth bool `json:"requireauth"` // 是否需要权限判断
|
|
|
- IsShow bool `json:"isshow"` // 是否显示
|
|
|
- URL string `json:"url"` // URL
|
|
|
- Remark string `json:"remark"` // 备注
|
|
|
- Children []PCWebMenu `json:"children"` // 子菜单列表
|
|
|
- Auth []PCWebMenuAuth `json:"auth"` // 页面权限列表
|
|
|
+ Title string `json:"title"` // 标题
|
|
|
+ Code string `json:"code"` // ID,新版本中权限KEY也是这个字段
|
|
|
+ Path string `json:"path"` // 路由路径
|
|
|
+ Component string `json:"component"` // 路由组件
|
|
|
+ Sort int `json:"sort"` // 排序
|
|
|
+ Rulekey string `json:"rulekey"` // 权限主键,非空表示需要判断控制,非空值不可重复
|
|
|
+ IsShow bool `json:"isshow"` // 是否显示
|
|
|
+ URL string `json:"url"` // URL
|
|
|
+ Remark string `json:"remark"` // 备注
|
|
|
+ Children []PCWebMenu `json:"children"` // 子菜单列表
|
|
|
+ Auth []PCWebMenuAuth `json:"auth"` // 页面权限列表
|
|
|
}
|
|
|
|
|
|
// GetClientMenusReq 获取交易端菜单请求参数
|
|
|
@@ -286,13 +286,14 @@ func createPCWebMenu(datas []interface{}, loginID int) []PCWebMenu {
|
|
|
data := v.(map[string]interface{})
|
|
|
if data["isshow"].(bool) {
|
|
|
// 判断权限
|
|
|
- requireAuth := data["requireauth"].(bool)
|
|
|
+ rulekey := data["rulekey"].(string)
|
|
|
+ // FIXME: - 暂时代码
|
|
|
+ requireAuth := false // rulekey != ""
|
|
|
// FIXME: - 暂时代码
|
|
|
requireAuth = false
|
|
|
if requireAuth {
|
|
|
- code := data["code"].(string) // PC WEB V6版本直接使用CODE来做权限KEY
|
|
|
// 判断是否有权限
|
|
|
- funcMenuList, err := models.GetErmcpRoleFuncMenuLists(loginID, code)
|
|
|
+ funcMenuList, err := models.GetErmcpRoleFuncMenuLists(loginID, rulekey)
|
|
|
if err != nil {
|
|
|
continue
|
|
|
}
|
|
|
@@ -309,13 +310,12 @@ func createPCWebMenu(datas []interface{}, loginID int) []PCWebMenu {
|
|
|
am := a.(map[string]interface{})
|
|
|
if am["isshow"].(bool) {
|
|
|
// 判断权限
|
|
|
- requireAuth := data["requireauth"].(bool)
|
|
|
+ rulekey := am["rulekey"].(string)
|
|
|
// FIXME: - 暂时代码
|
|
|
- requireAuth = false
|
|
|
+ requireAuth := false // rulekey != ""
|
|
|
if requireAuth {
|
|
|
- code := data["code"].(string) // PC WEB V6版本直接使用CODE来做权限KEY
|
|
|
// 判断是否有权限
|
|
|
- funcMenuList, err := models.GetErmcpRoleFuncMenuLists(loginID, code)
|
|
|
+ funcMenuList, err := models.GetErmcpRoleFuncMenuLists(loginID, rulekey)
|
|
|
if err != nil {
|
|
|
continue
|
|
|
}
|
|
|
@@ -325,10 +325,10 @@ func createPCWebMenu(datas []interface{}, loginID int) []PCWebMenu {
|
|
|
}
|
|
|
|
|
|
auth := PCWebMenuAuth{
|
|
|
- Label: am["label"].(string),
|
|
|
- Code: am["code"].(string),
|
|
|
- RequireAuth: am["requireauth"].(bool),
|
|
|
- IsShow: am["isshow"].(bool),
|
|
|
+ Label: am["label"].(string),
|
|
|
+ Code: am["code"].(string),
|
|
|
+ Rulekey: am["rulekey"].(string),
|
|
|
+ IsShow: am["isshow"].(bool),
|
|
|
}
|
|
|
if am["remark"] != nil {
|
|
|
auth.Remark = am["remark"].(string)
|
|
|
@@ -339,13 +339,13 @@ func createPCWebMenu(datas []interface{}, loginID int) []PCWebMenu {
|
|
|
}
|
|
|
|
|
|
item := PCWebMenu{
|
|
|
- Title: data["title"].(string),
|
|
|
- Code: data["code"].(string),
|
|
|
- Path: data["path"].(string),
|
|
|
- Component: data["component"].(string),
|
|
|
- Sort: int(data["sort"].(float64)),
|
|
|
- RequireAuth: data["requireauth"].(bool),
|
|
|
- IsShow: data["isshow"].(bool),
|
|
|
+ Title: data["title"].(string),
|
|
|
+ Code: data["code"].(string),
|
|
|
+ Path: data["path"].(string),
|
|
|
+ Component: data["component"].(string),
|
|
|
+ Sort: int(data["sort"].(float64)),
|
|
|
+ Rulekey: data["rulekey"].(string),
|
|
|
+ IsShow: data["isshow"].(bool),
|
|
|
}
|
|
|
if data["url"] != nil {
|
|
|
item.URL = data["url"].(string)
|