From 323a5091365c20988cd29b85c3558b24a42a3b30 Mon Sep 17 00:00:00 2001 From: mzl92 Date: Fri, 25 Jul 2025 18:14:39 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8F=9C=E5=8D=95=E7=BC=93=E5=AD=98=E5=8C=BA?= =?UTF-8?q?=E5=88=86=E7=B3=BB=E7=BB=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/service/PermService.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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