|
@@ -420,76 +420,81 @@ func (m *WorkDesktopMenu) CheckCapitalResources(menu *JYMenu, b, p bool, pUrl st
|
|
return false
|
|
return false
|
|
}
|
|
}
|
|
}()
|
|
}()
|
|
- //P630人脉管理
|
|
|
|
- //用户 有权限 不再判断 弹窗提示信息
|
|
|
|
- if usable {
|
|
|
|
- //企业信息验证
|
|
|
|
- if menu.CheckEnt > 0 {
|
|
|
|
- usable = false
|
|
|
|
- var GetCheckEntInfo = func(menuId, entId, deptId, positionId int64) (menuEntInfo MenuEntInfo) {
|
|
|
|
- checkEntKey := fmt.Sprintf("check_ent_key_%d_%d_%d", menuId, entId, deptId)
|
|
|
|
- cb, ce := redis.GetBytes(RedisCode, checkEntKey)
|
|
|
|
- if ce == nil && len(*cb) > 0 {
|
|
|
|
- ce = json.Unmarshal(*cb, &menuEntInfo)
|
|
|
|
- }
|
|
|
|
- if ce != nil || len(*cb) == 0 {
|
|
|
|
- menuEnt := BaseMysql.FindOne("base_service.work_menu_ent", map[string]interface{}{
|
|
|
|
- "menu_id": menuId,
|
|
|
|
- "ent_id": entId,
|
|
|
|
- }, "", "create_date DESC ")
|
|
|
|
- if menuEnt != nil && (*menuEnt) != nil {
|
|
|
|
- mb, err := json.Marshal(*menuEnt)
|
|
|
|
- if err == nil && len(mb) > 0 {
|
|
|
|
- err = json.Unmarshal(mb, &menuEntInfo)
|
|
|
|
- if err == nil {
|
|
|
|
- err = redis.PutBytes(RedisCode, checkEntKey, &mb, 4*60*60)
|
|
|
|
- // 缓存key
|
|
|
|
- ceks := redis.GetStr(RedisCode, fmt.Sprintf(CheckEntKK, strconv.FormatInt(positionId, 10)))
|
|
|
|
- if !strings.Contains(ceks, checkEntKey) {
|
|
|
|
- ceks = fmt.Sprintf("%s,%s", ceks, checkEntKey)
|
|
|
|
- redis.Put(RedisCode, fmt.Sprintf(CheckEntKK, strconv.FormatInt(positionId, 10)), ceks, 5*60*60)
|
|
|
|
- }
|
|
|
|
|
|
+ //企业信息验证
|
|
|
|
+ if menu.CheckEnt > 0 {
|
|
|
|
+ checkEntBool := false
|
|
|
|
+ var GetCheckEntInfo = func(menuId, entId, deptId, positionId int64) (menuEntInfo MenuEntInfo) {
|
|
|
|
+ checkEntKey := fmt.Sprintf("check_ent_key_%d_%d_%d", menuId, entId, deptId)
|
|
|
|
+ cb, ce := redis.GetBytes(RedisCode, checkEntKey)
|
|
|
|
+ if ce == nil && len(*cb) > 0 {
|
|
|
|
+ ce = json.Unmarshal(*cb, &menuEntInfo)
|
|
|
|
+ }
|
|
|
|
+ if ce != nil || len(*cb) == 0 {
|
|
|
|
+ menuEnt := BaseMysql.FindOne("base_service.work_menu_ent", map[string]interface{}{
|
|
|
|
+ "menu_id": menuId,
|
|
|
|
+ "ent_id": entId,
|
|
|
|
+ }, "", "create_date DESC ")
|
|
|
|
+ if menuEnt != nil && (*menuEnt) != nil {
|
|
|
|
+ mb, err := json.Marshal(*menuEnt)
|
|
|
|
+ if err == nil && len(mb) > 0 {
|
|
|
|
+ err = json.Unmarshal(mb, &menuEntInfo)
|
|
|
|
+ if err == nil {
|
|
|
|
+ err = redis.PutBytes(RedisCode, checkEntKey, &mb, 4*60*60)
|
|
|
|
+ // 缓存key
|
|
|
|
+ ceks := redis.GetStr(RedisCode, fmt.Sprintf(CheckEntKK, strconv.FormatInt(positionId, 10)))
|
|
|
|
+ if !strings.Contains(ceks, checkEntKey) {
|
|
|
|
+ ceks = fmt.Sprintf("%s,%s", ceks, checkEntKey)
|
|
|
|
+ redis.Put(RedisCode, fmt.Sprintf(CheckEntKK, strconv.FormatInt(positionId, 10)), ceks, 5*60*60)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if err != nil {
|
|
|
|
- log.Println("获取 work_menu_ent 信息 异常:", entId, menuId, m.Phone)
|
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
+ if err != nil {
|
|
|
|
+ log.Println("获取 work_menu_ent 信息 异常:", entId, menuId, m.Phone)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- return
|
|
|
|
}
|
|
}
|
|
- mei := GetCheckEntInfo(int64(menu.Id), m.EntId, m.EntDeptId, m.PositionId)
|
|
|
|
- if mei.EntId > 0 {
|
|
|
|
- var moldFunc = func() {
|
|
|
|
- switch mei.Mold {
|
|
|
|
- case 0:
|
|
|
|
- usable = true
|
|
|
|
- default:
|
|
|
|
- log.Println("工作菜单企业关联信息表 是否显示菜单:", mei.Mold, mei.EntId)
|
|
|
|
- }
|
|
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ mei := GetCheckEntInfo(int64(menu.Id), m.EntId, m.EntDeptId, m.PositionId)
|
|
|
|
+ if mei.EntId > 0 {
|
|
|
|
+ var moldFunc = func() {
|
|
|
|
+ switch mei.Mold {
|
|
|
|
+ case 0:
|
|
|
|
+ checkEntBool = true
|
|
|
|
+ default:
|
|
|
|
+ log.Println("工作菜单企业关联信息表 是否显示菜单:", mei.Mold, mei.EntId)
|
|
}
|
|
}
|
|
- switch mei.Target {
|
|
|
|
- case 1:
|
|
|
|
- if deptIds := strings.Split(mei.DeptId, ","); len(deptIds) > 0 {
|
|
|
|
- for _, deptId := range deptIds {
|
|
|
|
- vi, _ := strconv.ParseInt(deptId, 10, 64)
|
|
|
|
- if vi == m.EntDeptId {
|
|
|
|
- moldFunc()
|
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
+ switch mei.Target {
|
|
|
|
+ case 1:
|
|
|
|
+ if deptIds := strings.Split(mei.DeptId, ","); len(deptIds) > 0 {
|
|
|
|
+ for _, deptId := range deptIds {
|
|
|
|
+ vi, _ := strconv.ParseInt(deptId, 10, 64)
|
|
|
|
+ if vi == m.EntDeptId {
|
|
|
|
+ moldFunc()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- default:
|
|
|
|
- moldFunc()
|
|
|
|
}
|
|
}
|
|
|
|
+ default:
|
|
|
|
+ moldFunc()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- //菜单在当前平台没有权限
|
|
|
|
- if menu.Url == "" && pUrl == "" {
|
|
|
|
- usable = false
|
|
|
|
- defaultPopupFunc()
|
|
|
|
|
|
+ switch menu.CheckEnt {
|
|
|
|
+ default:
|
|
|
|
+ usable = usable && checkEntBool
|
|
|
|
+ case 2:
|
|
|
|
+ usable = usable || checkEntBool
|
|
}
|
|
}
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+ //P630人脉管理
|
|
|
|
+ //用户 有权限 不再判断 弹窗提示信息
|
|
|
|
+ //菜单在当前平台没有权限
|
|
|
|
+ if usable && menu.Url == "" && pUrl == "" {
|
|
|
|
+ usable = false
|
|
|
|
+ defaultPopupFunc()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
// 需要特殊处理的菜单 弹窗提示信息
|
|
// 需要特殊处理的菜单 弹窗提示信息
|
|
/*
|
|
/*
|
|
菜单弹窗逻辑
|
|
菜单弹窗逻辑
|