Procházet zdrojové kódy

feat:内外网表调整

wangshan před 2 roky
rodič
revize
1897e6edb4

+ 2 - 0
entity/entity.go

@@ -29,6 +29,8 @@ type RpcConfig struct {
 	UserRolePower        []string              //用户角色权限集合
 	MedicalFieldTimespan int64                 //医疗领域化 超级订阅 大会员到期时间> 90天
 	DefaultPopup         map[string]Additional //菜单默认弹窗
+	WorkTableOut         string                //外网菜单表名
+	WorkTableInside      string                //内网菜单表名
 }
 
 //

+ 5 - 9
entity/workDesktop.go

@@ -8,7 +8,6 @@ import (
 	"encoding/json"
 	"errors"
 	"github.com/zeromicro/go-zero/core/logx"
-	"log"
 	"sort"
 	"strconv"
 	"strings"
@@ -62,10 +61,10 @@ type Additional struct {
 // 获取有效菜单数据
 func (m *WorkDesktopMenu) GetMenuTreeData() error {
 	//tidb数据
-	query := `SELECT * FROM ` + WorkMenu + ` WHERE  appid=? AND status=0 ORDER BY id ASC`
+	query := `SELECT * FROM ` + ConfigJson.WorkTableOut + ` WHERE  appid=? AND status=0 ORDER BY id ASC`
 	//是否开启内网访问数据权限---对应 api 配置文件
 	if m.IntranetBool {
-		query = `SELECT * FROM ` + WorkMenu + ` WHERE  appid=? AND status>=0 ORDER BY id ASC`
+		query = `SELECT * FROM ` + ConfigJson.WorkTableInside + ` WHERE  appid=? AND status>=0 ORDER BY id ASC`
 	}
 	menuData := BaseMysql.SelectBySql(query, m.AppId)
 	if menuData == nil || len(*menuData) == 0 {
@@ -88,9 +87,6 @@ func (m *WorkDesktopMenu) GetMenuTreeData() error {
 			CapitalCode:    MC.ObjToString(v["capitalcode"]),
 			Authority:      MC.IntAll(v["authority"]),
 		}
-		if menu.Name == "企业情报监控" {
-			log.Println("+++++++")
-		}
 		var OpenType = map[string]string{}
 		if err := json.Unmarshal([]byte(MC.ObjToString(v["opentype"])), &OpenType); err == nil {
 			menu.OpenType = OpenType[m.Platform]
@@ -347,10 +343,10 @@ func (m *WorkDesktopMenu) VerifyPermissions(powerIds string) (b bool) {
 	return
 }
 
-//常用功能
-const (
+// WorkCommonly 常用功能
+var (
 	WorkCommonly = "work_commonly"
-	WorkMenu     = "work_menu"
+	//WorkMenu     = "work_menu"
 )
 
 // CommonlyUpdate 更新常用功能

+ 2 - 0
rpc/etc/usercenter.yaml

@@ -77,3 +77,5 @@ DefaultPopup:
     title: 提示信息
     content: 请前往电脑端使用
     confirmText: 知道了
+WorkTableOut: work_menu
+WorkTableInside: work_menu_bak

+ 8 - 0
rpc/internal/config/config.go

@@ -18,4 +18,12 @@ func init() {
 		},
 	})
 	entity.ResourceLib = resource.NewResource(resourceClient)
+	//菜单表 外网
+	if entity.ConfigJson.WorkTableOut == "" {
+		entity.ConfigJson.WorkTableOut = "work_menu"
+	}
+	//菜单表 内网
+	if entity.ConfigJson.WorkTableInside == "" {
+		entity.ConfigJson.WorkTableInside = "work_menu"
+	}
 }

+ 1 - 1
service/workDesktop.go

@@ -65,7 +65,7 @@ func RenewWorkDesktopMenuModeOrCommonly(in *WorkDesktopComprehensiveReq) (r *Wor
 		if len(pIds) > 0 {
 			//常用功能存储是三级菜单id,需要四级菜单信息也查出来
 			//会出现 用户设置常用功能,此功能下线,用户设置依然保存的有此功能  查询不能加 AND status = 0
-			menuData := entity.BaseMysql.SelectBySql(fmt.Sprintf(`SELECT * from %s WHERE id IN (%s)  OR (parentid IN (%s)  AND status = 0)  ORDER BY FIELD(id , %s);`, entity.WorkMenu, strings.Join(pIds, ","), strings.Join(pIds, ","), strings.Join(pIds, ",")))
+			menuData := entity.BaseMysql.SelectBySql(fmt.Sprintf(`SELECT * from %s WHERE id IN (%s)  OR (parentid IN (%s)  AND status = 0)  ORDER BY FIELD(id , %s);`, entity.ConfigJson.WorkTableOut, strings.Join(pIds, ","), strings.Join(pIds, ","), strings.Join(pIds, ",")))
 			if menuData != nil && len(*menuData) > 0 {
 				var (
 					m = &entity.WorkDesktopMenu{