diff --git a/app/Console/Commands/GenerateManticoreVectors.php b/app/Console/Commands/GenerateManticoreVectors.php index 58151b339..936b48958 100644 --- a/app/Console/Commands/GenerateManticoreVectors.php +++ b/app/Console/Commands/GenerateManticoreVectors.php @@ -38,7 +38,7 @@ class GenerateManticoreVectors extends Command {--sleep=3 : 每批处理后休眠秒数} {--reset : 重置向量进度指针}'; - protected $description = '批量生成 Manticore 已索引数据的向量(异步处理)'; + protected $description = '批量生成 Manticore 已索引数据的向量'; /** * 类型配置 diff --git a/app/Console/Commands/SyncFileToManticore.php b/app/Console/Commands/SyncFileToManticore.php index 2019ba3da..e2d95ebc8 100644 --- a/app/Console/Commands/SyncFileToManticore.php +++ b/app/Console/Commands/SyncFileToManticore.php @@ -14,19 +14,19 @@ class SyncFileToManticore extends Command use ManticoreSyncLock; /** - * 更新数据(MVA 方案:allowed_users 在同步时自动写入) + * 更新数据 * --f: 全量更新 (默认) - * --i: 增量更新(从上次更新的最后一个ID接上,持续处理直到完成) + * --i: 增量更新 * * 清理数据 * --c: 清除索引 * * 其他选项 - * --sleep: 每批处理完成后休眠秒数(增量模式) + * --sleep: 每批处理完成后休眠秒数 */ protected $signature = 'manticore:sync-files {--f} {--i} {--c} {--batch=100} {--sleep=3}'; - protected $description = '同步文件内容到 Manticore Search(MVA 权限方案)'; + protected $description = '同步文件数据到 Manticore Search'; public function handle(): int { @@ -51,7 +51,7 @@ class SyncFileToManticore extends Command return 0; } - $this->info('开始同步文件数据(MVA 方案:allowed_users 自动内联)...'); + $this->info('开始同步文件数据...'); $this->syncFiles(); $this->info("\n同步完成"); diff --git a/app/Console/Commands/SyncMsgToManticore.php b/app/Console/Commands/SyncMsgToManticore.php index f4000ab6f..5e404af13 100644 --- a/app/Console/Commands/SyncMsgToManticore.php +++ b/app/Console/Commands/SyncMsgToManticore.php @@ -14,20 +14,20 @@ class SyncMsgToManticore extends Command use ManticoreSyncLock; /** - * 更新数据(MVA 方案:allowed_users 在同步时自动写入) + * 更新数据 * --f: 全量更新 (默认) - * --i: 增量更新(从上次更新的最后一个ID接上,持续处理直到完成) + * --i: 增量更新 * * 清理数据 * --c: 清除索引 * * 其他选项 - * --dialog: 指定对话ID(仅同步该对话的消息) - * --sleep: 每批处理完成后休眠秒数(增量模式) + * --dialog: 指定对话ID + * --sleep: 每批处理完成后休眠秒数 */ protected $signature = 'manticore:sync-msgs {--f} {--i} {--c} {--batch=100} {--dialog=} {--sleep=3}'; - protected $description = '同步消息数据到 Manticore Search(MVA 权限方案)'; + protected $description = '同步消息数据到 Manticore Search'; public function handle(): int { @@ -54,10 +54,10 @@ class SyncMsgToManticore extends Command $dialogId = $this->option('dialog') ? intval($this->option('dialog')) : 0; if ($dialogId > 0) { - $this->info("开始同步对话 {$dialogId} 的消息数据(MVA 方案:allowed_users 自动内联)..."); + $this->info("开始同步对话 {$dialogId} 的消息数据..."); $this->syncDialogMsgs($dialogId); } else { - $this->info('开始同步消息数据(MVA 方案:allowed_users 自动内联)...'); + $this->info('开始同步消息数据...'); $this->syncMsgs(); } diff --git a/app/Console/Commands/SyncProjectToManticore.php b/app/Console/Commands/SyncProjectToManticore.php index 31c91abc7..f9843a1c7 100644 --- a/app/Console/Commands/SyncProjectToManticore.php +++ b/app/Console/Commands/SyncProjectToManticore.php @@ -14,19 +14,19 @@ class SyncProjectToManticore extends Command use ManticoreSyncLock; /** - * 更新数据(MVA 方案:allowed_users 在同步时自动写入) + * 更新数据 * --f: 全量更新 (默认) - * --i: 增量更新(从上次更新的最后一个ID接上,持续处理直到完成) + * --i: 增量更新 * * 清理数据 * --c: 清除索引 * * 其他选项 - * --sleep: 每批处理完成后休眠秒数(增量模式) + * --sleep: 每批处理完成后休眠秒数 */ protected $signature = 'manticore:sync-projects {--f} {--i} {--c} {--batch=100} {--sleep=3}'; - protected $description = '同步项目数据到 Manticore Search(MVA 权限方案)'; + protected $description = '同步项目数据到 Manticore Search'; public function handle(): int { @@ -49,7 +49,7 @@ class SyncProjectToManticore extends Command return 0; } - $this->info('开始同步项目数据(MVA 方案:allowed_users 自动内联)...'); + $this->info('开始同步项目数据...'); $this->syncProjects(); $this->info("\n同步完成"); diff --git a/app/Console/Commands/SyncTaskToManticore.php b/app/Console/Commands/SyncTaskToManticore.php index f0b0bc666..9b2179729 100644 --- a/app/Console/Commands/SyncTaskToManticore.php +++ b/app/Console/Commands/SyncTaskToManticore.php @@ -14,19 +14,19 @@ class SyncTaskToManticore extends Command use ManticoreSyncLock; /** - * 更新数据(MVA 方案:allowed_users 在同步时自动写入) + * 更新数据 * --f: 全量更新 (默认) - * --i: 增量更新(从上次更新的最后一个ID接上,持续处理直到完成) + * --i: 增量更新 * * 清理数据 * --c: 清除索引 * * 其他选项 - * --sleep: 每批处理完成后休眠秒数(增量模式) + * --sleep: 每批处理完成后休眠秒数 */ protected $signature = 'manticore:sync-tasks {--f} {--i} {--c} {--batch=100} {--sleep=3}'; - protected $description = '同步任务数据到 Manticore Search(MVA 权限方案)'; + protected $description = '同步任务数据到 Manticore Search'; public function handle(): int { @@ -49,7 +49,7 @@ class SyncTaskToManticore extends Command return 0; } - $this->info('开始同步任务数据(MVA 方案:allowed_users 自动内联)...'); + $this->info('开始同步任务数据...'); $this->syncTasks(); $this->info("\n同步完成"); diff --git a/app/Console/Commands/SyncUserToManticore.php b/app/Console/Commands/SyncUserToManticore.php index aced9443e..497514a9c 100644 --- a/app/Console/Commands/SyncUserToManticore.php +++ b/app/Console/Commands/SyncUserToManticore.php @@ -16,13 +16,13 @@ class SyncUserToManticore extends Command /** * 更新数据 * --f: 全量更新 (默认) - * --i: 增量更新(从上次更新的最后一个ID接上,持续处理直到完成) + * --i: 增量更新 * * 清理数据 * --c: 清除索引 * * 其他选项 - * --sleep: 每批处理完成后休眠秒数(增量模式) + * --sleep: 每批处理完成后休眠秒数 */ protected $signature = 'manticore:sync-users {--f} {--i} {--c} {--batch=100} {--sleep=3}'; diff --git a/app/Module/Manticore/ManticoreBase.php b/app/Module/Manticore/ManticoreBase.php index c607fd89f..a641d785d 100644 --- a/app/Module/Manticore/ManticoreBase.php +++ b/app/Module/Manticore/ManticoreBase.php @@ -69,13 +69,11 @@ class ManticoreBase /** * 初始化表结构 - * - * MVA 方案:使用 allowed_users MULTI 字段内联权限,无需单独的关系表 */ private function initializeTables(PDO $pdo): void { try { - // 创建文件向量表(含 allowed_users MVA 权限字段) + // 创建文件向量表 $pdo->exec(" CREATE TABLE IF NOT EXISTS file_vectors ( id BIGINT, @@ -100,7 +98,7 @@ class ManticoreBase ) "); - // 创建用户向量表(联系人搜索,无需权限过滤) + // 创建用户向量表 $pdo->exec(" CREATE TABLE IF NOT EXISTS user_vectors ( id BIGINT, @@ -114,7 +112,7 @@ class ManticoreBase ) charset_table='chinese' morphology='icu_chinese' "); - // 创建项目向量表(含 allowed_users MVA 权限字段) + // 创建项目向量表 $pdo->exec(" CREATE TABLE IF NOT EXISTS project_vectors ( id BIGINT, @@ -128,7 +126,7 @@ class ManticoreBase ) charset_table='chinese' morphology='icu_chinese' "); - // 创建任务向量表(含 allowed_users MVA 权限字段) + // 创建任务向量表 $pdo->exec(" CREATE TABLE IF NOT EXISTS task_vectors ( id BIGINT, @@ -144,7 +142,7 @@ class ManticoreBase ) charset_table='chinese' morphology='icu_chinese' "); - // 创建消息向量表(含 allowed_users MVA 权限字段) + // 创建消息向量表 $pdo->exec(" CREATE TABLE IF NOT EXISTS msg_vectors ( id BIGINT, @@ -379,7 +377,7 @@ class ManticoreBase // ============================== /** - * 全文搜索文件(使用 MVA allowed_users 权限过滤) + * 全文搜索文件 * * @param string $keyword 关键词 * @param int $userid 用户ID(0表示不限制权限) @@ -437,7 +435,7 @@ class ManticoreBase } /** - * 向量相似度搜索(使用 MVA allowed_users 权限过滤) + * 向量相似度搜索 * * @param array $queryVector 查询向量 * @param int $userid 用户ID(0表示不限制权限) @@ -564,7 +562,7 @@ class ManticoreBase } /** - * 插入或更新文件向量(含 allowed_users MVA 权限字段) + * 插入或更新文件向量 * * @param array $data 文件数据,包含: * - file_id: 文件ID @@ -594,7 +592,7 @@ class ManticoreBase $allowedUsers = $data['allowed_users'] ?? []; $allowedUsersStr = !empty($allowedUsers) ? '(' . implode(',', array_map('intval', $allowedUsers)) . ')' : '()'; - // 插入新记录(向量值和 MVA 必须内联到 SQL) + // 插入新记录 $vectorValue = $data['content_vector'] ?? null; if ($vectorValue) { $vectorValue = str_replace(['[', ']'], ['(', ')'], $vectorValue); @@ -743,7 +741,7 @@ class ManticoreBase } // ============================== - // 用户向量方法(联系人搜索) + // 用户向量方法 // ============================== /** @@ -887,7 +885,7 @@ class ManticoreBase // 先删除已存在的记录 $instance->execute("DELETE FROM user_vectors WHERE userid = ?", [$userid]); - // 插入新记录(向量值必须内联到 SQL,Manticore 的 float_vector 不支持参数绑定) + // 插入新记录 $vectorValue = $data['content_vector'] ?? null; if ($vectorValue) { $vectorValue = str_replace(['[', ']'], ['(', ')'], $vectorValue); @@ -967,7 +965,7 @@ class ManticoreBase // ============================== /** - * 项目全文搜索(使用 MVA allowed_users 权限过滤) + * 项目全文搜索 * * @param string $keyword 关键词 * @param int $userid 用户ID(权限过滤) @@ -1020,7 +1018,7 @@ class ManticoreBase } /** - * 项目向量搜索(使用 MVA allowed_users 权限过滤) + * 项目向量搜索 * * @param array $queryVector 查询向量 * @param int $userid 用户ID(权限过滤) @@ -1124,7 +1122,7 @@ class ManticoreBase } /** - * 插入或更新项目向量(含 allowed_users MVA 权限字段) + * 插入或更新项目向量 * * @param array $data 项目数据,包含: * - project_id: 项目ID @@ -1243,7 +1241,7 @@ class ManticoreBase // ============================== /** - * 任务全文搜索(使用 MVA allowed_users 权限过滤) + * 任务全文搜索 * * @param string $keyword 关键词 * @param int $userid 用户ID(权限过滤) @@ -1300,7 +1298,7 @@ class ManticoreBase } /** - * 任务向量搜索(使用 MVA allowed_users 权限过滤) + * 任务向量搜索 * * @param array $queryVector 查询向量 * @param int $userid 用户ID(权限过滤) @@ -1406,7 +1404,7 @@ class ManticoreBase } /** - * 插入或更新任务向量(含 allowed_users MVA 权限字段) + * 插入或更新任务向量 * * @param array $data 任务数据,包含: * - task_id: 任务ID @@ -1549,7 +1547,7 @@ class ManticoreBase // ============================== /** - * 消息全文搜索(使用 MVA allowed_users 权限过滤) + * 消息全文搜索 * * @param string $keyword 关键词 * @param int $userid 用户ID(权限过滤) @@ -1596,7 +1594,7 @@ class ManticoreBase } /** - * 消息向量搜索(使用 MVA allowed_users 权限过滤) + * 消息向量搜索 * * @param array $queryVector 查询向量 * @param int $userid 用户ID(权限过滤) @@ -1712,7 +1710,7 @@ class ManticoreBase } /** - * 插入或更新消息向量(含 allowed_users MVA 权限字段) + * 插入或更新消息向量 * * @param array $data 消息数据,包含: * - msg_id: 消息ID @@ -1881,11 +1879,11 @@ class ManticoreBase } // ============================== - // 向量更新方法(用于异步向量生成) + // 向量更新方法 // ============================== /** - * 更新消息的向量(仅更新向量字段) + * 更新消息的向量 * * @param int $msgId 消息ID * @param string $vectorStr 向量字符串,格式如 '[0.1,0.2,...]' @@ -1920,7 +1918,7 @@ class ManticoreBase ? '(' . $existing['allowed_users'] . ')' : '()'; - // 重新插入(包含向量) + // 重新插入 $sql = "INSERT INTO msg_vectors (id, msg_id, dialog_id, userid, msg_type, content, allowed_users, created_at, content_vector) VALUES (?, ?, ?, ?, ?, ?, {$allowedUsersStr}, ?, {$vectorStr})"; @@ -1937,7 +1935,7 @@ class ManticoreBase } /** - * 更新文件的向量(仅更新向量字段) + * 更新文件的向量 * * @param int $fileId 文件ID * @param string $vectorStr 向量字符串,格式如 '[0.1,0.2,...]' @@ -1972,7 +1970,7 @@ class ManticoreBase ? '(' . $existing['allowed_users'] . ')' : '()'; - // 重新插入(包含向量) + // 重新插入 $sql = "INSERT INTO file_vectors (id, file_id, userid, pshare, file_name, file_type, file_ext, content, allowed_users, content_vector) VALUES (?, ?, ?, ?, ?, ?, ?, ?, {$allowedUsersStr}, {$vectorStr})"; @@ -1990,7 +1988,7 @@ class ManticoreBase } /** - * 更新任务的向量(仅更新向量字段) + * 更新任务的向量 * * @param int $taskId 任务ID * @param string $vectorStr 向量字符串,格式如 '[0.1,0.2,...]' @@ -2025,7 +2023,7 @@ class ManticoreBase ? '(' . $existing['allowed_users'] . ')' : '()'; - // 重新插入(包含向量) + // 重新插入 $sql = "INSERT INTO task_vectors (id, task_id, project_id, userid, visibility, task_name, task_desc, task_content, allowed_users, content_vector) VALUES (?, ?, ?, ?, ?, ?, ?, ?, {$allowedUsersStr}, {$vectorStr})"; @@ -2043,7 +2041,7 @@ class ManticoreBase } /** - * 更新项目的向量(仅更新向量字段) + * 更新项目的向量 * * @param int $projectId 项目ID * @param string $vectorStr 向量字符串,格式如 '[0.1,0.2,...]' @@ -2078,7 +2076,7 @@ class ManticoreBase ? '(' . $existing['allowed_users'] . ')' : '()'; - // 重新插入(包含向量) + // 重新插入 $sql = "INSERT INTO project_vectors (id, project_id, userid, personal, project_name, project_desc, allowed_users, content_vector) VALUES (?, ?, ?, ?, ?, ?, {$allowedUsersStr}, {$vectorStr})"; @@ -2094,7 +2092,7 @@ class ManticoreBase } /** - * 更新用户的向量(仅更新向量字段) + * 更新用户的向量 * * @param int $userid 用户ID * @param string $vectorStr 向量字符串,格式如 '[0.1,0.2,...]' @@ -2124,7 +2122,7 @@ class ManticoreBase // Manticore 的向量需要使用 () 格式 $vectorStr = str_replace(['[', ']'], ['(', ')'], $vectorStr); - // 重新插入(包含向量) + // 重新插入 $sql = "INSERT INTO user_vectors (id, userid, nickname, email, profession, tags, introduction, content_vector) VALUES (?, ?, ?, ?, ?, ?, ?, {$vectorStr})"; diff --git a/app/Module/Manticore/ManticoreFile.php b/app/Module/Manticore/ManticoreFile.php index 52c8cec63..9863a71f5 100644 --- a/app/Module/Manticore/ManticoreFile.php +++ b/app/Module/Manticore/ManticoreFile.php @@ -13,7 +13,7 @@ use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\DB; /** - * Manticore Search 文件搜索类(MVA 权限方案) + * Manticore Search 文件搜索类 * * 使用方法: * @@ -184,7 +184,7 @@ class ManticoreFile } // ============================== - // 权限计算方法(MVA 方案核心) + // 权限计算方法 // ============================== /** @@ -454,7 +454,7 @@ class ManticoreFile } // ============================== - // 权限更新方法(MVA 方案) + // 权限更新方法 // ============================== /** diff --git a/app/Module/Manticore/ManticoreMsg.php b/app/Module/Manticore/ManticoreMsg.php index f313ca245..6f7702ee5 100644 --- a/app/Module/Manticore/ManticoreMsg.php +++ b/app/Module/Manticore/ManticoreMsg.php @@ -12,7 +12,7 @@ use DB; use Illuminate\Support\Facades\Log; /** - * Manticore Search 消息搜索类(MVA 权限方案) + * Manticore Search 消息搜索类 * * 使用方法: * @@ -290,7 +290,7 @@ class ManticoreMsg } // ============================== - // 权限计算方法(MVA 方案核心) + // 权限计算方法 // ============================== /** @@ -542,7 +542,7 @@ class ManticoreMsg } // ============================== - // 权限更新方法(MVA 方案) + // 权限更新方法 // ============================== /** diff --git a/app/Module/Manticore/ManticoreProject.php b/app/Module/Manticore/ManticoreProject.php index 819a46429..6bde8f758 100644 --- a/app/Module/Manticore/ManticoreProject.php +++ b/app/Module/Manticore/ManticoreProject.php @@ -10,7 +10,7 @@ use App\Module\AI; use Illuminate\Support\Facades\Log; /** - * Manticore Search 项目搜索类(MVA 权限方案) + * Manticore Search 项目搜索类 * * 使用方法: * @@ -262,7 +262,7 @@ class ManticoreProject } // ============================== - // 权限更新方法(MVA 方案) + // 权限更新方法 // ============================== /** diff --git a/app/Module/Manticore/ManticoreTask.php b/app/Module/Manticore/ManticoreTask.php index 6bdf1e129..265dbcf6d 100644 --- a/app/Module/Manticore/ManticoreTask.php +++ b/app/Module/Manticore/ManticoreTask.php @@ -13,7 +13,7 @@ use App\Module\AI; use Illuminate\Support\Facades\Log; /** - * Manticore Search 任务搜索类(MVA 权限方案) + * Manticore Search 任务搜索类 * * 权限逻辑说明: * - visibility = 1: 项目人员可见,通过项目成员计算 allowed_users @@ -123,7 +123,7 @@ class ManticoreTask } // ============================== - // 权限计算方法(MVA 方案核心) + // 权限计算方法 // ============================== /** @@ -405,7 +405,7 @@ class ManticoreTask } // ============================== - // 权限更新方法(MVA 方案) + // 权限更新方法 // ============================== /** @@ -437,7 +437,7 @@ class ManticoreTask /** * 级联更新项目下所有 visibility=1 任务的 allowed_users - * 当项目成员变更时调用(异步执行) + * 当项目成员变更时调用 * * @param int $projectId 项目ID * @return int 更新的任务数量 diff --git a/app/Observers/AbstractObserver.php b/app/Observers/AbstractObserver.php index 151488a81..8eb27d0ab 100644 --- a/app/Observers/AbstractObserver.php +++ b/app/Observers/AbstractObserver.php @@ -38,7 +38,7 @@ class AbstractObserver return; } - // 标记任务已投递,? 秒后过期 + // 标记任务已投递 Cache::put($cacheKey, true, self::DEDUP_WINDOW); } } diff --git a/app/Observers/FileObserver.php b/app/Observers/FileObserver.php index eb717306b..d7863c544 100644 --- a/app/Observers/FileObserver.php +++ b/app/Observers/FileObserver.php @@ -33,8 +33,7 @@ class FileObserver extends AbstractObserver // 检查共享设置是否变化(影响子文件的 pshare) if ($file->type === 'folder' && $file->isDirty('share')) { // 共享文件夹的 share 字段变化,需要批量更新子文件的 pshare - // 注意:updataShare 方法会批量更新子文件,但不会触发 Observer - // 这里通过任务异步处理 + // 注意:updateShare 方法会批量更新,但不会触发 Observer $newPshare = $file->share ? $file->id : 0; $childFileIds = File::where('pids', 'like', "%,{$file->id},%") ->where('type', '!=', 'folder') diff --git a/app/Observers/FileUserObserver.php b/app/Observers/FileUserObserver.php index 236366201..c2e22f105 100644 --- a/app/Observers/FileUserObserver.php +++ b/app/Observers/FileUserObserver.php @@ -6,7 +6,7 @@ use App\Models\FileUser; use App\Tasks\ManticoreSyncTask; /** - * FileUser 观察者(MVA 权限方案) + * FileUser 观察者 */ class FileUserObserver extends AbstractObserver { @@ -18,7 +18,7 @@ class FileUserObserver extends AbstractObserver */ public function created(FileUser $fileUser) { - // MVA 方案:更新文件的 allowed_users + // 更新文件权限 self::taskDeliver(new ManticoreSyncTask('update_file_allowed_users', [ 'file_id' => $fileUser->file_id, ])); @@ -32,7 +32,7 @@ class FileUserObserver extends AbstractObserver */ public function updated(FileUser $fileUser) { - // MVA 方案:更新文件的 allowed_users + // 更新文件权限 self::taskDeliver(new ManticoreSyncTask('update_file_allowed_users', [ 'file_id' => $fileUser->file_id, ])); @@ -46,7 +46,7 @@ class FileUserObserver extends AbstractObserver */ public function deleted(FileUser $fileUser) { - // MVA 方案:更新文件的 allowed_users + // 更新文件权限 self::taskDeliver(new ManticoreSyncTask('update_file_allowed_users', [ 'file_id' => $fileUser->file_id, ])); diff --git a/app/Observers/ProjectTaskObserver.php b/app/Observers/ProjectTaskObserver.php index 46a0f0108..e5655d2aa 100644 --- a/app/Observers/ProjectTaskObserver.php +++ b/app/Observers/ProjectTaskObserver.php @@ -41,7 +41,7 @@ class ProjectTaskObserver extends AbstractObserver } } - // MVA 方案:检查是否有搜索相关字段变化或权限相关字段变化 + // 检查是否有搜索相关字段变化或权限相关字段变化 // visibility 变化会影响 allowed_users 来源 // parent_id 变化会影响子任务继承 // project_id 变化会影响 visibility=1 的任务权限 diff --git a/app/Observers/ProjectTaskUserObserver.php b/app/Observers/ProjectTaskUserObserver.php index cff4aecbf..efc7c2ae1 100644 --- a/app/Observers/ProjectTaskUserObserver.php +++ b/app/Observers/ProjectTaskUserObserver.php @@ -22,7 +22,7 @@ class ProjectTaskUserObserver extends AbstractObserver Deleted::forget('projectTask', $projectTaskUser->task_pid, $projectTaskUser->userid); } - // MVA 方案:更新任务的 allowed_users(会自动 cascadeToChildren) + // 更新任务权限 self::taskDeliver(new ManticoreSyncTask('update_task_allowed_users', [ 'task_id' => $projectTaskUser->task_id, ])); @@ -57,7 +57,7 @@ class ProjectTaskUserObserver extends AbstractObserver Deleted::record('projectTask', $projectTaskUser->task_id, $projectTaskUser->userid); } - // MVA 方案:更新任务的 allowed_users(会自动 cascadeToChildren) + // 更新任务权限 self::taskDeliver(new ManticoreSyncTask('update_task_allowed_users', [ 'task_id' => $projectTaskUser->task_id, ])); diff --git a/app/Observers/ProjectTaskVisibilityUserObserver.php b/app/Observers/ProjectTaskVisibilityUserObserver.php index c421e800f..34567d9f7 100644 --- a/app/Observers/ProjectTaskVisibilityUserObserver.php +++ b/app/Observers/ProjectTaskVisibilityUserObserver.php @@ -6,7 +6,7 @@ use App\Models\ProjectTaskVisibilityUser; use App\Tasks\ManticoreSyncTask; /** - * ProjectTaskVisibilityUser 观察者(MVA 权限方案) + * ProjectTaskVisibilityUser 观察者 * * 用于处理任务 visibility=3(指定成员可见)时的成员变更同步 */ @@ -20,7 +20,7 @@ class ProjectTaskVisibilityUserObserver extends AbstractObserver */ public function created(ProjectTaskVisibilityUser $visibilityUser) { - // MVA 方案:更新任务的 allowed_users(会自动 cascadeToChildren) + // 更新任务权限 self::taskDeliver(new ManticoreSyncTask('update_task_allowed_users', [ 'task_id' => $visibilityUser->task_id, ])); @@ -34,7 +34,7 @@ class ProjectTaskVisibilityUserObserver extends AbstractObserver */ public function updated(ProjectTaskVisibilityUser $visibilityUser) { - // MVA 方案:更新任务的 allowed_users(会自动 cascadeToChildren) + // 更新任务权限 self::taskDeliver(new ManticoreSyncTask('update_task_allowed_users', [ 'task_id' => $visibilityUser->task_id, ])); @@ -48,7 +48,7 @@ class ProjectTaskVisibilityUserObserver extends AbstractObserver */ public function deleted(ProjectTaskVisibilityUser $visibilityUser) { - // MVA 方案:更新任务的 allowed_users(会自动 cascadeToChildren) + // 更新任务权限 self::taskDeliver(new ManticoreSyncTask('update_task_allowed_users', [ 'task_id' => $visibilityUser->task_id, ])); diff --git a/app/Observers/ProjectUserObserver.php b/app/Observers/ProjectUserObserver.php index bd6066a3e..ac27a14b7 100644 --- a/app/Observers/ProjectUserObserver.php +++ b/app/Observers/ProjectUserObserver.php @@ -18,7 +18,7 @@ class ProjectUserObserver extends AbstractObserver { Deleted::forget('project', $projectUser->project_id, $projectUser->userid); - // MVA 方案:更新项目的 allowed_users + // 更新项目权限 self::taskDeliver(new ManticoreSyncTask('update_project_allowed_users', [ 'project_id' => $projectUser->project_id, ])); @@ -49,7 +49,7 @@ class ProjectUserObserver extends AbstractObserver { Deleted::record('project', $projectUser->project_id, $projectUser->userid); - // MVA 方案:更新项目的 allowed_users + // 更新项目权限 self::taskDeliver(new ManticoreSyncTask('update_project_allowed_users', [ 'project_id' => $projectUser->project_id, ])); diff --git a/app/Observers/UserObserver.php b/app/Observers/UserObserver.php index cdfd7689d..8176db3e9 100644 --- a/app/Observers/UserObserver.php +++ b/app/Observers/UserObserver.php @@ -35,7 +35,7 @@ class UserObserver extends AbstractObserver return; } - // 检查是否有搜索相关字段变化(不含 tel,因为 Manticore 不索引电话) + // 检查是否有搜索相关字段变化 $searchableFields = ['nickname', 'email', 'profession', 'introduction', 'disable_at']; $isDirty = false; foreach ($searchableFields as $field) { diff --git a/app/Tasks/ManticoreSyncTask.php b/app/Tasks/ManticoreSyncTask.php index 9e6a25cc9..f81a7656f 100644 --- a/app/Tasks/ManticoreSyncTask.php +++ b/app/Tasks/ManticoreSyncTask.php @@ -101,7 +101,7 @@ class ManticoreSyncTask extends AbstractTask break; case 'update_file_allowed_users': - // 更新文件的 allowed_users(共享变更时调用) + // 更新文件权限 $fileId = $this->data['file_id'] ?? 0; if ($fileId > 0) { ManticoreFile::updateAllowedUsers($fileId); @@ -143,7 +143,7 @@ class ManticoreSyncTask extends AbstractTask break; case 'update_project_allowed_users': - // 更新项目的 allowed_users(成员变更时调用) + // 更新项目权限 $projectId = $this->data['project_id'] ?? 0; if ($projectId > 0) { ManticoreProject::updateAllowedUsers($projectId); @@ -177,7 +177,7 @@ class ManticoreSyncTask extends AbstractTask break; case 'update_task_allowed_users': - // 更新任务的 allowed_users(成员变更时调用) + // 更新任务权限 $taskId = $this->data['task_id'] ?? 0; if ($taskId > 0) { ManticoreTask::updateAllowedUsers($taskId); @@ -204,7 +204,7 @@ class ManticoreSyncTask extends AbstractTask break; case 'update_dialog_allowed_users': - // 更新对话下所有消息的 allowed_users(成员变更时调用) + // 更新对话消息权限 $dialogId = $this->data['dialog_id'] ?? 0; if ($dialogId > 0) { ManticoreMsg::updateDialogAllowedUsers($dialogId); @@ -212,7 +212,7 @@ class ManticoreSyncTask extends AbstractTask break; default: - // 增量更新(定时任务调用) + // 增量更新 $this->incrementalUpdate(); break; } @@ -235,10 +235,10 @@ class ManticoreSyncTask extends AbstractTask } Cache::put("ManticoreSyncTask:CheckTime", time(), Carbon::now()->addMinutes(5)); - // 执行增量全文索引同步(命令会持续处理直到完成) + // 执行增量全文索引同步 $this->runIncrementalSync(); - // 执行向量生成(命令会持续处理直到完成) + // 执行向量生成 $this->runVectorGeneration(); } @@ -250,7 +250,7 @@ class ManticoreSyncTask extends AbstractTask */ private function runIncrementalSync(): void { - // 启动各类型的增量同步命令(命令内部有锁,重复启动会自动跳过) + // 启动各类型的增量同步命令 @shell_exec("php /var/www/artisan manticore:sync-files --i 2>&1 &"); @shell_exec("php /var/www/artisan manticore:sync-users --i 2>&1 &"); @shell_exec("php /var/www/artisan manticore:sync-projects --i 2>&1 &"); @@ -270,7 +270,7 @@ class ManticoreSyncTask extends AbstractTask return; } - // 启动向量生成命令(命令内部有锁,重复启动会自动跳过) + // 启动向量生成命令 @shell_exec("php /var/www/artisan manticore:generate-vectors --type=all --batch=50 2>&1 &"); }