ソースを参照

feat:内外网

wangshan 2 年 前
コミット
cddd2afef2
1 ファイル変更7 行追加2 行削除
  1. 7 2
      service/workDesktop.go

+ 7 - 2
service/workDesktop.go

@@ -65,7 +65,12 @@ 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.ConfigJson.WorkTableOut, strings.Join(pIds, ","), strings.Join(pIds, ","), strings.Join(pIds, ",")))
+			var menuSql = fmt.Sprintf(`SELECT * from %s WHERE id IN (%s)  OR (parentid IN (%s)  AND status = 0)  ORDER BY FIELD(id , %s);`, entity.ConfigJson.WorkTableInside, strings.Join(pIds, ","), strings.Join(pIds, ","), strings.Join(pIds, ","))
+			//外网访问
+			if entity.ConfigJson.WorkTableInside != entity.ConfigJson.WorkTableOut {
+				menuSql = fmt.Sprintf(`SELECT * from %s WHERE id IN (%s)  OR (parentid IN (%s)  AND status = 0)`, entity.ConfigJson.WorkTableOut, strings.Join(pIds, ","), strings.Join(pIds, ","))
+			}
+			menuData := entity.BaseMysql.SelectBySql(menuSql)
 			if menuData != nil && len(*menuData) > 0 {
 				var (
 					m = &entity.WorkDesktopMenu{
@@ -126,7 +131,7 @@ func RenewWorkDesktopMenuModeOrCommonly(in *WorkDesktopComprehensiveReq) (r *Wor
 						}
 					}
 					//外网不一致,
-					if "work_menu" == entity.ConfigJson.WorkTableOut {
+					if entity.ConfigJson.WorkTableInside != entity.ConfigJson.WorkTableOut {
 						if parentIsExists[parentId] {
 							childMenus[parentId] = append(childMenus[parentId], menu)
 						} else {