-- ========================================
-- 最终修复：直播管理404问题
-- ========================================

-- 问题根源：
-- 礼物打赏菜单(id=823)的component是 /liveManage/gift/records/index
-- 这与前端独立的 giftManageRouter (/gift) 冲突

-- 解决方案：将礼物打赏从直播管理中移除

-- 步骤1：隐藏直播管理下的礼物打赏菜单
UPDATE eb_system_menu 
SET is_show = 0 
WHERE id = 823 
  AND pid = 675 
  AND name = '礼物打赏';

-- 步骤2：确保直播管理菜单本身是显示的
UPDATE eb_system_menu 
SET is_show = 1 
WHERE id = 675 
  AND name = '直播管理';

-- 步骤3：确保所有直播管理的子菜单都是显示的（除了礼物打赏）
UPDATE eb_system_menu 
SET is_show = 1 
WHERE pid = 675 
  AND id != 823;

-- 验证修复结果
SELECT 
    '=== 直播管理菜单 ===' as section,
    id,
    pid,
    name,
    component,
    is_show,
    sort,
    CASE WHEN is_show = 1 THEN '✓ 显示' ELSE '✗ 隐藏' END as status
FROM eb_system_menu 
WHERE id = 675 OR pid = 675
ORDER BY pid, sort;

-- 检查是否还有其他冲突
SELECT 
    '=== 可能的路径冲突 ===' as section,
    component,
    COUNT(*) as count,
    GROUP_CONCAT(name SEPARATOR ' | ') as menu_names
FROM eb_system_menu 
WHERE is_show = 1
  AND component LIKE '/liveManage%'
GROUP BY component
HAVING count > 1;
