-- 验证礼物管理菜单是否正确添加

-- 1. 查看礼物管理菜单
SELECT 
    id,
    pid,
    name,
    icon,
    component,
    menu_type,
    sort,
    is_show
FROM eb_system_menu 
WHERE (name LIKE '%礼物%' OR pid IN (SELECT id FROM eb_system_menu WHERE name = '礼物管理'))
AND is_delte = 0
ORDER BY pid, sort;

-- 2. 查看菜单层级结构
SELECT 
    CONCAT(REPEAT('  ', CASE WHEN m.pid = 0 THEN 0 ELSE 1 END), m.name) as menu_tree,
    m.id,
    m.component,
    m.menu_type,
    m.is_show
FROM eb_system_menu m
WHERE (m.name = '礼物管理' OR m.pid = (SELECT id FROM eb_system_menu WHERE name = '礼物管理' LIMIT 1))
AND m.is_delte = 0
ORDER BY m.pid, m.sort;

-- 3. 查看管理员角色的礼物管理权限
SELECT 
    r.id as role_id,
    r.role_name,
    m.id as menu_id,
    m.name as menu_name,
    m.component
FROM eb_system_role r
JOIN eb_system_role_menu rm ON r.id = rm.rid
JOIN eb_system_menu m ON rm.menu_id = m.id
WHERE m.name LIKE '%礼物%'
AND r.id = 1;

-- 4. 查看礼物配置数据
SELECT id, name, price, sort_order, is_enabled 
FROM eb_gift_config 
ORDER BY sort_order 
LIMIT 10;

-- 5. 查看充值套餐数据
SELECT id, amount, virtual_amount, bonus_amount, title, is_enabled 
FROM eb_recharge_package 
ORDER BY sort_order 
LIMIT 10;
