瀏覽代碼

wip:缓存key

wangshan 3 月之前
父節點
當前提交
be665fd516
共有 1 個文件被更改,包括 15 次插入3 次删除
  1. 15 3
      entity/user.go

+ 15 - 3
entity/user.go

@@ -291,8 +291,13 @@ func ClearUserPowerFunc(positionId, appId string) bool {
 		redis.Del(RedisCode, fmt.Sprintf(UserPowerRedisKey, appId, time.Now().Day(), v))
 		redis.Del(RedisCode, fmt.Sprintf(UserPowerRedisKey, appId, time.Now().Day(), v))
 		//企业关联缓存
 		//企业关联缓存
 		entCacheKey := redis.GetStr(RedisCode, fmt.Sprintf(CheckEntKK, positionId))
 		entCacheKey := redis.GetStr(RedisCode, fmt.Sprintf(CheckEntKK, positionId))
-		if entCacheKey != "" {
-			redis.Del(RedisCode, entCacheKey)
+		if ecks := strings.Split(entCacheKey, ","); len(ecks) > 0 {
+			for _, ev := range ecks {
+				if ev != "" {
+					redis.Del(RedisCode, ev)
+				}
+
+			}
 		}
 		}
 	}
 	}
 	return true
 	return true
@@ -415,6 +420,9 @@ func (m *WorkDesktopMenu) CheckCapitalResources(menu *JYMenu, b, p bool, pUrl st
 			return false
 			return false
 		}
 		}
 	}()
 	}()
+	if menu.Id == 780547 {
+		log.Println("---------------")
+	}
 	//P630人脉管理
 	//P630人脉管理
 	//用户 有权限 不再判断 弹窗提示信息
 	//用户 有权限 不再判断 弹窗提示信息
 	if usable {
 	if usable {
@@ -439,7 +447,11 @@ func (m *WorkDesktopMenu) CheckCapitalResources(menu *JYMenu, b, p bool, pUrl st
 							if err == nil {
 							if err == nil {
 								err = redis.PutBytes(RedisCode, checkEntKey, &mb, 4*60*60)
 								err = redis.PutBytes(RedisCode, checkEntKey, &mb, 4*60*60)
 								// 缓存key
 								// 缓存key
-								redis.Put(RedisCode, fmt.Sprintf(CheckEntKK, strconv.FormatInt(positionId, 10)), checkEntKey, 5*60*60)
+								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 {
 						if err != nil {