| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654 |
- <?php
- namespace App\Module\UrsPromotion\Logics;
- use App\Module\UrsPromotion\Enums\UrsPromotionRelationLevel;
- use App\Module\UrsPromotion\Models\UrsUserReferral;
- use App\Module\UrsPromotion\Models\UrsUserRelationCache;
- use App\Module\UrsPromotion\Services\UrsUserMappingService;
- use Illuminate\Support\Facades\DB;
- use Illuminate\Support\Facades\Log;
- use Illuminate\Support\Facades\Redis;
- /**
- * URS关系缓存逻辑类
- *
- * 处理URS用户关系缓存的核心业务逻辑,包括生成关系缓存、清理关系缓存、
- * 重建关系缓存等功能。该类仅供内部使用,不对外提供服务。
- */
- class UrsRelationCacheLogic
- {
- /**
- * 生成用户的关系缓存
- *
- * @param int $ursUserId URS用户ID
- * @return bool
- */
- public function generateUserRelationCache(int $ursUserId): bool
- {
- try {
- // 清除用户的现有关系缓存
- $this->clearUserRelationCache($ursUserId);
- // 获取用户的直接推荐人
- $referral = UrsUserReferral::where('urs_user_id', $ursUserId)
- ->where('status', UrsUserReferral::STATUS_VALID)
- ->first();
- if (!$referral) {
- Log::info("URS用户 {$ursUserId} 没有推荐人,无需生成关系缓存");
- return true;
- }
- $ursReferrerId = $referral->urs_referrer_id;
- // 获取农场用户ID
- $farmUserId = UrsUserMappingService::getFarmUserId($ursUserId);
- $farmReferrerId = UrsUserMappingService::getFarmUserId($ursReferrerId);
- // 如果当前用户未进入农场,无法生成缓存
- if ($farmUserId <= 0) {
- Log::info("URS用户 {$ursUserId} 未进入农场,跳过缓存生成");
- return true;
- }
- // 如果推荐人未进入农场,创建占位缓存记录,避免断代问题
- if ($farmReferrerId <= 0) {
- Log::info("URS用户 {$ursUserId} 的推荐人 {$ursReferrerId} 未进入农场,创建占位缓存记录");
- // 检查是否已存在该深度的缓存记录,避免重复插入
- $existingCache = UrsUserRelationCache::where('urs_user_id', $ursUserId)
- ->where('urs_related_user_id', $ursReferrerId)
- ->where('depth', 1)
- ->first();
- if (!$existingCache) {
- // 创建占位的直接关系缓存(农场用户ID为0)
- $directRelation = new UrsUserRelationCache();
- $directRelation->user_id = $farmUserId;
- $directRelation->related_user_id = 0; // 推荐人未进入农场,设为0
- $directRelation->urs_user_id = $ursUserId;
- $directRelation->urs_related_user_id = $ursReferrerId;
- $directRelation->level = UrsPromotionRelationLevel::DIRECT;
- $directRelation->path = '0'; // 占位路径
- $directRelation->urs_path = (string)$ursReferrerId;
- $directRelation->depth = 1;
- $directRelation->save();
- } else {
- Log::debug("URS用户 {$ursUserId} 的占位缓存记录已存在,跳过创建");
- }
- // 尝试获取推荐人的上级关系(基于URS关系)
- $this->generateIndirectRelationsFromUrsChain($ursUserId, $farmUserId, $ursReferrerId, 1);
- Log::info("URS用户 {$ursUserId} 占位缓存记录创建完成");
- return true;
- }
- // 创建直接关系缓存
- $directRelation = new UrsUserRelationCache();
- $directRelation->user_id = $farmUserId;
- $directRelation->related_user_id = $farmReferrerId;
- $directRelation->urs_user_id = $ursUserId;
- $directRelation->urs_related_user_id = $ursReferrerId;
- $directRelation->level = UrsPromotionRelationLevel::DIRECT;
- $directRelation->path = (string)$farmReferrerId;
- $directRelation->urs_path = (string)$ursReferrerId;
- $directRelation->depth = 1;
- $directRelation->save();
- // 获取推荐人的所有上级(限制在20代以内)
- $upperRelations = UrsUserRelationCache::where('urs_user_id', $ursReferrerId)
- ->where('depth', '<', UrsPromotionRelationLevel::getMaxLevel())
- ->get();
- // 创建间接关系缓存(最多20代)
- foreach ($upperRelations as $upperRelation) {
- $newDepth = $upperRelation->depth + 1;
- // 限制最大深度为20代
- if ($newDepth > UrsPromotionRelationLevel::getMaxLevel()) {
- continue;
- }
- $indirectRelation = new UrsUserRelationCache();
- $indirectRelation->user_id = $farmUserId;
- $indirectRelation->related_user_id = $upperRelation->related_user_id;
- $indirectRelation->urs_user_id = $ursUserId;
- $indirectRelation->urs_related_user_id = $upperRelation->urs_related_user_id;
- $indirectRelation->level = UrsPromotionRelationLevel::getLevelByDepth($newDepth);
- $indirectRelation->path = $farmReferrerId . ',' . $upperRelation->path;
- $indirectRelation->urs_path = $ursReferrerId . ',' . $upperRelation->urs_path;
- $indirectRelation->depth = $newDepth;
- $indirectRelation->save();
- }
- // 清除Redis缓存
- Redis::del("urs_promotion:user:{$ursUserId}:all_referrers");
- Redis::del("urs_promotion:farm_user:{$farmUserId}:all_referrers");
- Log::info("URS用户 {$ursUserId} 关系缓存生成成功");
- return true;
- } catch (\Exception $e) {
- Log::error("生成URS用户关系缓存失败", [
- 'urs_user_id' => $ursUserId,
- 'error' => $e->getMessage()
- ]);
- return false;
- }
- }
- /**
- * 基于URS关系链生成间接关系缓存
- *
- * 当推荐人未进入农场时,通过URS推荐关系链向上查找已进入农场的上级
- *
- * @param int $ursUserId 当前用户的URS用户ID
- * @param int $farmUserId 当前用户的农场用户ID
- * @param int $currentUrsReferrerId 当前层级的URS推荐人ID
- * @param int $currentDepth 当前深度
- * @return void
- */
- private function generateIndirectRelationsFromUrsChain(int $ursUserId, int $farmUserId, int $currentUrsReferrerId, int $currentDepth): void
- {
- // 限制最大深度为20代
- if ($currentDepth >= UrsPromotionRelationLevel::getMaxLevel()) {
- return;
- }
- // 获取当前推荐人的推荐人
- $upperReferral = UrsUserReferral::where('urs_user_id', $currentUrsReferrerId)
- ->where('status', UrsUserReferral::STATUS_VALID)
- ->first();
- if (!$upperReferral) {
- // 没有更上级的推荐人,结束递归
- return;
- }
- $upperUrsReferrerId = $upperReferral->urs_referrer_id;
- $upperFarmReferrerId = UrsUserMappingService::getFarmUserId($upperUrsReferrerId);
- $newDepth = $currentDepth + 1;
- if ($upperFarmReferrerId > 0) {
- // 检查是否已存在该深度的关系缓存
- $existingCache = UrsUserRelationCache::where('urs_user_id', $ursUserId)
- ->where('urs_related_user_id', $upperUrsReferrerId)
- ->where('depth', $newDepth)
- ->first();
- if (!$existingCache) {
- // 上级推荐人已进入农场,创建有效的关系缓存
- $indirectRelation = new UrsUserRelationCache();
- $indirectRelation->user_id = $farmUserId;
- $indirectRelation->related_user_id = $upperFarmReferrerId;
- $indirectRelation->urs_user_id = $ursUserId;
- $indirectRelation->urs_related_user_id = $upperUrsReferrerId;
- $indirectRelation->level = UrsPromotionRelationLevel::getLevelByDepth($newDepth);
- $indirectRelation->path = $this->buildFarmUserPath($currentUrsReferrerId, $upperFarmReferrerId);
- $indirectRelation->urs_path = $this->buildUrsPath($currentUrsReferrerId, $upperUrsReferrerId);
- $indirectRelation->depth = $newDepth;
- $indirectRelation->save();
- }
- Log::debug("为URS用户 {$ursUserId} 创建间接关系缓存", [
- 'upper_urs_referrer_id' => $upperUrsReferrerId,
- 'upper_farm_referrer_id' => $upperFarmReferrerId,
- 'depth' => $newDepth
- ]);
- // 继续向上查找,基于已有的关系缓存
- $this->generateIndirectRelationsFromExistingCache($ursUserId, $farmUserId, $upperUrsReferrerId, $newDepth);
- } else {
- // 检查是否已存在该深度的占位缓存
- $existingCache = UrsUserRelationCache::where('urs_user_id', $ursUserId)
- ->where('urs_related_user_id', $upperUrsReferrerId)
- ->where('depth', $newDepth)
- ->first();
- if (!$existingCache) {
- // 上级推荐人也未进入农场,创建占位缓存并继续向上查找
- $indirectRelation = new UrsUserRelationCache();
- $indirectRelation->user_id = $farmUserId;
- $indirectRelation->related_user_id = 0; // 占位
- $indirectRelation->urs_user_id = $ursUserId;
- $indirectRelation->urs_related_user_id = $upperUrsReferrerId;
- $indirectRelation->level = UrsPromotionRelationLevel::getLevelByDepth($newDepth);
- $indirectRelation->path = $this->buildFarmUserPath($currentUrsReferrerId, 0);
- $indirectRelation->urs_path = $this->buildUrsPath($currentUrsReferrerId, $upperUrsReferrerId);
- $indirectRelation->depth = $newDepth;
- $indirectRelation->save();
- }
- // 继续向上递归查找
- $this->generateIndirectRelationsFromUrsChain($ursUserId, $farmUserId, $upperUrsReferrerId, $newDepth);
- }
- }
- /**
- * 基于已有关系缓存生成间接关系
- *
- * @param int $ursUserId 当前用户的URS用户ID
- * @param int $farmUserId 当前用户的农场用户ID
- * @param int $baseUrsReferrerId 基准URS推荐人ID
- * @param int $baseDepth 基准深度
- * @return void
- */
- private function generateIndirectRelationsFromExistingCache(int $ursUserId, int $farmUserId, int $baseUrsReferrerId, int $baseDepth): void
- {
- // 获取基准推荐人的所有上级关系缓存
- $upperRelations = UrsUserRelationCache::where('urs_user_id', $baseUrsReferrerId)
- ->where('depth', '<', UrsPromotionRelationLevel::getMaxLevel() - $baseDepth)
- ->get();
- foreach ($upperRelations as $upperRelation) {
- $newDepth = $baseDepth + $upperRelation->depth;
- // 限制最大深度为20代
- if ($newDepth > UrsPromotionRelationLevel::getMaxLevel()) {
- continue;
- }
- // 检查是否已存在该深度的关系缓存
- $existingCache = UrsUserRelationCache::where('urs_user_id', $ursUserId)
- ->where('urs_related_user_id', $upperRelation->urs_related_user_id)
- ->where('depth', $newDepth)
- ->first();
- if (!$existingCache) {
- $indirectRelation = new UrsUserRelationCache();
- $indirectRelation->user_id = $farmUserId;
- $indirectRelation->related_user_id = $upperRelation->related_user_id;
- $indirectRelation->urs_user_id = $ursUserId;
- $indirectRelation->urs_related_user_id = $upperRelation->urs_related_user_id;
- $indirectRelation->level = UrsPromotionRelationLevel::getLevelByDepth($newDepth);
- $indirectRelation->path = $this->buildCombinedFarmPath($baseUrsReferrerId, $upperRelation->path);
- $indirectRelation->urs_path = $this->buildCombinedUrsPath($baseUrsReferrerId, $upperRelation->urs_path);
- $indirectRelation->depth = $newDepth;
- $indirectRelation->save();
- }
- }
- }
- /**
- * 构建农场用户路径
- */
- private function buildFarmUserPath(int $currentUrsReferrerId, int $upperFarmReferrerId): string
- {
- $currentFarmReferrerId = UrsUserMappingService::getFarmUserId($currentUrsReferrerId);
- $currentPart = $currentFarmReferrerId > 0 ? (string)$currentFarmReferrerId : '0';
- if ($upperFarmReferrerId > 0) {
- return $currentPart . ',' . $upperFarmReferrerId;
- }
- return $currentPart;
- }
- /**
- * 构建URS用户路径
- */
- private function buildUrsPath(int $currentUrsReferrerId, int $upperUrsReferrerId): string
- {
- return $currentUrsReferrerId . ',' . $upperUrsReferrerId;
- }
- /**
- * 构建组合农场用户路径
- */
- private function buildCombinedFarmPath(int $baseUrsReferrerId, string $upperPath): string
- {
- $baseFarmReferrerId = UrsUserMappingService::getFarmUserId($baseUrsReferrerId);
- $basePart = $baseFarmReferrerId > 0 ? (string)$baseFarmReferrerId : '0';
- return $basePart . ',' . $upperPath;
- }
- /**
- * 构建组合URS用户路径
- */
- private function buildCombinedUrsPath(int $baseUrsReferrerId, string $upperUrsPath): string
- {
- return $baseUrsReferrerId . ',' . $upperUrsPath;
- }
- /**
- * 清除用户的关系缓存
- *
- * @param int $ursUserId URS用户ID
- * @return bool
- */
- public function clearUserRelationCache(int $ursUserId): bool
- {
- try {
- // 获取农场用户ID
- $farmUserId = UrsUserMappingService::getFarmUserId($ursUserId);
- // 删除数据库中的关系缓存
- UrsUserRelationCache::where('urs_user_id', $ursUserId)->delete();
- // 清除Redis缓存
- Redis::del("urs_promotion:user:{$ursUserId}:all_referrers");
- if ($farmUserId > 0) {
- Redis::del("urs_promotion:farm_user:{$farmUserId}:all_referrers");
- }
- return true;
- } catch (\Exception $e) {
- Log::error("清除URS用户关系缓存失败", [
- 'urs_user_id' => $ursUserId,
- 'error' => $e->getMessage()
- ]);
- return false;
- }
- }
- /**
- * 重建所有用户的关系缓存
- *
- * @param int $batchSize 批处理大小
- * @return array 包含成功和失败的数量
- */
- public function rebuildAllRelationCache(int $batchSize = 100): array
- {
- try {
- // 清空关系缓存表
- UrsUserRelationCache::truncate();
- // 清除所有Redis缓存
- $keys = Redis::keys("urs_promotion:user:*:all_referrers");
- if (!empty($keys)) {
- Redis::del($keys);
- }
- $keys = Redis::keys("urs_promotion:farm_user:*:all_referrers");
- if (!empty($keys)) {
- Redis::del($keys);
- }
- // 获取所有URS用户ID
- $ursUserIds = UrsUserReferral::where('status', UrsUserReferral::STATUS_VALID)
- ->pluck('urs_user_id')
- ->toArray();
- $successCount = 0;
- $failCount = 0;
- // 分批处理
- $chunks = array_chunk($ursUserIds, $batchSize);
- foreach ($chunks as $chunk) {
- foreach ($chunk as $ursUserId) {
- if ($this->generateUserRelationCache($ursUserId)) {
- $successCount++;
- } else {
- $failCount++;
- }
- }
- }
- Log::info("URS关系缓存重建完成", [
- 'success' => $successCount,
- 'fail' => $failCount,
- 'total' => count($ursUserIds)
- ]);
- return [
- 'success' => $successCount,
- 'fail' => $failCount,
- 'total' => count($ursUserIds)
- ];
- } catch (\Exception $e) {
- Log::error("重建所有URS关系缓存失败: " . $e->getMessage());
- return [
- 'success' => 0,
- 'fail' => 0,
- 'total' => 0,
- 'error' => $e->getMessage()
- ];
- }
- }
- /**
- * 检查关系缓存的完整性
- *
- * @return array 包含检查结果
- */
- public function checkRelationCacheIntegrity(): array
- {
- try {
- $totalUsers = UrsUserReferral::where('status', UrsUserReferral::STATUS_VALID)->count();
- $usersWithCache = UrsUserRelationCache::distinct('urs_user_id')->count('urs_user_id');
- $missingUsers = $totalUsers - $usersWithCache;
- // 检查循环推荐关系
- $circularRelations = DB::select("
- SELECT r1.urs_user_id, r1.urs_referrer_id
- FROM kku_urs_promotion_user_referrals r1
- JOIN kku_urs_promotion_user_referrals r2 ON r1.urs_referrer_id = r2.urs_user_id
- WHERE r2.urs_referrer_id = r1.urs_user_id
- AND r1.status = 1 AND r2.status = 1
- ");
- // 检查孤立的缓存
- $orphanedCaches = DB::select("
- SELECT c.urs_user_id
- FROM kku_urs_promotion_user_relation_cache c
- LEFT JOIN kku_urs_promotion_user_referrals r ON c.urs_user_id = r.urs_user_id AND r.status = 1
- WHERE r.urs_user_id IS NULL
- ");
- return [
- 'total_users' => $totalUsers,
- 'users_with_cache' => $usersWithCache,
- 'missing_users' => $missingUsers,
- 'circular_relations' => count($circularRelations),
- 'orphaned_caches' => count($orphanedCaches)
- ];
- } catch (\Exception $e) {
- Log::error("检查URS关系缓存完整性失败: " . $e->getMessage());
- return [
- 'error' => $e->getMessage()
- ];
- }
- }
- /**
- * 修复关系缓存问题
- *
- * @return array 包含修复结果
- */
- public function fixRelationCacheIssues(): array
- {
- try {
- // 检查完整性
- $integrity = $this->checkRelationCacheIntegrity();
- $fixed = [
- 'missing_users' => 0,
- 'orphaned_caches' => 0
- ];
- // 修复缺失的用户缓存
- if ($integrity['missing_users'] > 0) {
- $usersWithCache = UrsUserRelationCache::distinct('urs_user_id')->pluck('urs_user_id')->toArray();
- $allUsers = UrsUserReferral::where('status', UrsUserReferral::STATUS_VALID)
- ->pluck('urs_user_id')
- ->toArray();
- $missingUsers = array_diff($allUsers, $usersWithCache);
- foreach ($missingUsers as $ursUserId) {
- if ($this->generateUserRelationCache($ursUserId)) {
- $fixed['missing_users']++;
- }
- }
- }
- // 清理孤立的缓存
- if ($integrity['orphaned_caches'] > 0) {
- $orphanedCaches = DB::select("
- SELECT c.urs_user_id
- FROM kku_urs_promotion_user_relation_cache c
- LEFT JOIN kku_urs_promotion_user_referrals r ON c.urs_user_id = r.urs_user_id AND r.status = 1
- WHERE r.urs_user_id IS NULL
- ");
- foreach ($orphanedCaches as $cache) {
- if ($this->clearUserRelationCache($cache->urs_user_id)) {
- $fixed['orphaned_caches']++;
- }
- }
- }
- return [
- 'integrity' => $integrity,
- 'fixed' => $fixed
- ];
- } catch (\Exception $e) {
- Log::error("修复URS关系缓存问题失败: " . $e->getMessage());
- return [
- 'error' => $e->getMessage()
- ];
- }
- }
- /**
- * 为特定用户更新农场用户ID相关的缓存
- *
- * @param int $ursUserId URS用户ID
- * @param int $farmUserId 农场用户ID
- * @return bool
- */
- public function updateFarmUserIdInCache(int $ursUserId, int $farmUserId): bool
- {
- try {
- // 更新该用户作为被推荐人的缓存记录
- UrsUserRelationCache::where('urs_user_id', $ursUserId)
- ->update(['user_id' => $farmUserId]);
- // 更新该用户作为推荐人的缓存记录(将占位的0更新为实际农场用户ID)
- $updatedCount = UrsUserRelationCache::where('urs_related_user_id', $ursUserId)
- ->where('related_user_id', 0) // 只更新占位记录
- ->update(['related_user_id' => $farmUserId]);
- if ($updatedCount > 0) {
- Log::info("更新了 {$updatedCount} 条占位缓存记录", [
- 'urs_user_id' => $ursUserId,
- 'farm_user_id' => $farmUserId
- ]);
- // 更新路径中的占位符
- $this->updatePlaceholderPaths($ursUserId, $farmUserId);
- }
- // 重新生成该用户的关系缓存(确保路径正确)
- $this->generateUserRelationCache($ursUserId);
- // 为该用户的所有下级重新生成缓存(修复断代问题)
- $this->regenerateDownstreamCaches($ursUserId);
- Log::info("URS用户关系缓存中的农场用户ID更新成功", [
- 'urs_user_id' => $ursUserId,
- 'farm_user_id' => $farmUserId,
- 'updated_placeholder_count' => $updatedCount
- ]);
- return true;
- } catch (\Exception $e) {
- Log::error("更新URS用户关系缓存中的农场用户ID失败", [
- 'urs_user_id' => $ursUserId,
- 'farm_user_id' => $farmUserId,
- 'error' => $e->getMessage()
- ]);
- return false;
- }
- }
- /**
- * 更新路径中的占位符
- *
- * @param int $ursUserId URS用户ID
- * @param int $farmUserId 农场用户ID
- * @return void
- */
- private function updatePlaceholderPaths(int $ursUserId, int $farmUserId): void
- {
- try {
- // 获取所有包含该用户的路径记录
- $records = UrsUserRelationCache::where('urs_path', 'LIKE', "%{$ursUserId}%")->get();
- foreach ($records as $record) {
- $pathParts = explode(',', $record->path);
- $ursPathParts = explode(',', $record->urs_path);
- // 找到URS路径中对应的位置,更新农场用户路径
- $ursIndex = array_search((string)$ursUserId, $ursPathParts);
- if ($ursIndex !== false && isset($pathParts[$ursIndex]) && $pathParts[$ursIndex] === '0') {
- $pathParts[$ursIndex] = (string)$farmUserId;
- $record->path = implode(',', $pathParts);
- $record->save();
- }
- }
- Log::debug("更新路径占位符完成", [
- 'urs_user_id' => $ursUserId,
- 'farm_user_id' => $farmUserId,
- 'updated_records' => $records->count()
- ]);
- } catch (\Exception $e) {
- Log::warning("更新路径占位符失败", [
- 'urs_user_id' => $ursUserId,
- 'farm_user_id' => $farmUserId,
- 'error' => $e->getMessage()
- ]);
- }
- }
- /**
- * 为用户的所有下级重新生成缓存
- *
- * 当用户进入农场后,需要为其所有下级重新生成缓存以修复断代问题
- *
- * @param int $ursUserId URS用户ID
- * @return void
- */
- private function regenerateDownstreamCaches(int $ursUserId): void
- {
- try {
- // 获取该用户的所有直接下级
- $directSubordinates = UrsUserReferral::where('urs_referrer_id', $ursUserId)
- ->where('status', UrsUserReferral::STATUS_VALID)
- ->pluck('urs_user_id')
- ->toArray();
- if (empty($directSubordinates)) {
- return;
- }
- Log::info("开始为用户的下级重新生成缓存", [
- 'urs_user_id' => $ursUserId,
- 'subordinate_count' => count($directSubordinates)
- ]);
- foreach ($directSubordinates as $subordinateUrsUserId) {
- // 检查下级是否已进入农场
- $subordinateFarmUserId = UrsUserMappingService::getFarmUserId($subordinateUrsUserId);
- if ($subordinateFarmUserId > 0) {
- // 重新生成下级的关系缓存
- $this->generateUserRelationCache($subordinateUrsUserId);
- // 递归处理下级的下级
- $this->regenerateDownstreamCaches($subordinateUrsUserId);
- }
- }
- Log::info("用户下级缓存重新生成完成", [
- 'urs_user_id' => $ursUserId
- ]);
- } catch (\Exception $e) {
- Log::error("重新生成下级缓存失败", [
- 'urs_user_id' => $ursUserId,
- 'error' => $e->getMessage()
- ]);
- }
- }
- }
|