'mp_episode_segments', 'key' => 'segment_id', 'type' => 'string', 'via' => ['local' => 'anime_id', 'table' => 'mp_animes', 'key' => 'id'], ]; // 片段归属:片段同样存放在 mp_episode_segments,但以自增主键 id 定位 $actDefine = [ 'table' => 'mp_episode_segments', 'key' => 'id', 'via' => ['local' => 'anime_id', 'table' => 'mp_animes', 'key' => 'id'], ]; return [ // 总开关(对应 .env 中的 CHECK_COMPANY) 'enabled' => (bool)env('CHECK_COMPANY', false), // 跳过校验的角色:平台运营角色本身需要跨公司操作 'skip_roles' => ['superadmin'], /* | 跳过校验的公司ID(内部公司白名单) | 用于灰度上线或线上异常时先放过内部公司,避免误拦影响自己人。 | 多个用逗号分隔,例如 .env 中 CHECK_COMPANY_SKIP_CPIDS=1,2; | 留空表示不跳过任何公司(全部校验)。 */ 'skip_cpids' => array_values(array_filter(array_map('intval', explode(',', (string)env('CHECK_COMPANY_SKIP_CPIDS', '1'))))), // 资源归属列(公司维度) 'owner_column' => 'cpid', /* |-------------------------------------------------------------------------- | 全局参数映射 |-------------------------------------------------------------------------- | 格式:参数名 => ['table' => 表名, 'key' => 主键列(可选,默认 id)] | 仅当该参数名在全项目范围内语义唯一时才放在这里; | 参数名有歧义(例如 id、task_id)时请放到下方 routes 中按路由指定。 */ 'params' => [ // 原有校验项,保持行为不变 'script_id' => ['table' => 'mp_scripts'], 'anime_id' => ['table' => 'mp_animes'], 'episode_id' => ['table' => 'mp_anime_episodes'], // 画布 'canvas_id' => ['table' => 'mp_canvases'], // 资产库(个人库 user_id=自身,公共库 user_id=0,归属列均为 cpid) 'product_id' => ['table' => 'mp_products'], 'parent_id' => ['table' => 'mp_products'], 'target_parent_id' => ['table' => 'mp_products'], 'source_product_id' => ['table' => 'mp_products'], 'source_anime_id' => ['table' => 'mp_animes'], 'source_episode_id' => ['table' => 'mp_anime_episodes'], // 提示词模板 'template_id' => ['table' => 'mp_prompt_templates'], ], /* |-------------------------------------------------------------------------- | 批量参数 |-------------------------------------------------------------------------- | 值可能是数组、逗号分隔字符串或 JSON 数组,会逐项校验。 */ 'array_params' => [ 'script_ids' => ['table' => 'mp_scripts'], ], /* |-------------------------------------------------------------------------- | 链式校验参数(目标表没有 cpid 列,需要沿父级推导归属) |-------------------------------------------------------------------------- | 格式:参数名 => [ | 'table' => 目标表, | 'key' => 目标表主键列(默认 id), | 'type' => 主键类型 int|string(默认 int), | 'via' => ['local' => 目标表中的外键列, 'table' => 父表, 'key' => 父表主键列], | ] | | 校验方式:按主键取出记录 → 用记录中的外键查父表 → 校验父表记录的 cpid。 | 记录不存在时按无权限处理(fail-closed)。 */ 'linked_params' => [ // 剧本分集组:mp_script_episode_group.script_id -> mp_scripts 'group_id' => [ 'table' => 'mp_script_episode_group', 'via' => ['local' => 'script_id', 'table' => 'mp_scripts', 'key' => 'id'], ], // 剧本对话记录:mp_script_records.script_id -> mp_scripts 'rid' => [ 'table' => 'mp_script_records', 'via' => ['local' => 'script_id', 'table' => 'mp_scripts', 'key' => 'id'], ], // 分镜 / 相邻分镜:mp_episode_segments.anime_id -> mp_animes 'segment_id' => $segmentDefine, 'prev_segment_id' => $segmentDefine, 'target_segment_id' => $segmentDefine, // 片段 / 相邻片段:mp_episode_segments.anime_id -> mp_animes 'act_id' => $actDefine, 'prev_act_id' => $actDefine, 'target_act_id' => $actDefine, // 画布节点:mp_canvas_nodes.canvas_id -> mp_canvases 'node_id' => [ 'table' => 'mp_canvas_nodes', 'via' => ['local' => 'canvas_id', 'table' => 'mp_canvases', 'key' => 'id'], ], ], // 链式校验的批量参数(值可能是数组 / 逗号分隔 / JSON 数组) 'linked_array_params' => [ // 节点关联:mp_canvas_nodes.canvas_id -> mp_canvases 'related_ids' => [ 'table' => 'mp_canvas_nodes', 'via' => ['local' => 'canvas_id', 'table' => 'mp_canvases', 'key' => 'id'], ], ], /* |-------------------------------------------------------------------------- | 按路由覆盖(参数名有歧义时使用) |-------------------------------------------------------------------------- | 键为 $request->path() 的返回值(不含前导斜杠),例如 api/anime/deleteProduct */ 'routes' => [ 'api/anime/deleteProduct' => ['id' => ['table' => 'mp_products']], 'api/anime/editProduct' => ['id' => ['table' => 'mp_products']], 'api/anime/getFolderPath' => ['id' => ['table' => 'mp_products']], 'api/anime/renameFolder' => ['id' => ['table' => 'mp_products']], 'api/anime/moveRoleOrFolder' => ['id' => ['table' => 'mp_products']], 'api/anime/generateThreeView' => ['id' => ['table' => 'mp_products']], 'api/anime/globalProducts' => ['id' => ['table' => 'mp_products']], 'api/anime/taskCenter/detail' => ['task_id' => ['table' => 'mp_task_center']], 'api/anime/taskCenter/list' => ['task_id' => ['table' => 'mp_task_center']], ], ];