diff --git a/app/common/service/PermService.php b/app/common/service/PermService.php index 06c7535..16030b1 100644 --- a/app/common/service/PermService.php +++ b/app/common/service/PermService.php @@ -15,9 +15,9 @@ class PermService } // 用户资源缓存key - protected static function cacheKey(int $userId): string + protected static function cacheKey(int $userId, string $systemCode): string { - return "user_resources_{$userId}"; + return "user_resources_{$userId}_{$systemCode}"; } /** @@ -25,7 +25,7 @@ class PermService */ public function getUserResources(int $userId, string $systemCode) { - $cacheKey = self::cacheKey($userId); + $cacheKey = self::cacheKey($userId, $systemCode); $cached = Cache::get($cacheKey); if ($cached !== null) { return $cached; @@ -58,8 +58,8 @@ class PermService /** * 清除资源相关缓存 */ - public function clearCache(int $userId): void + public function clearCache(int $userId, string $systemCode): void { - Cache::delete(self::cacheKey($userId)); + Cache::delete(self::cacheKey($userId, $systemCode)); } } \ No newline at end of file