-- =====================================================
-- 检查并修复"我的记录"数据问题
-- =====================================================

-- 1. 首先找到当前登录用户的真实ID
-- 从截图看用户ID是 24187196，但这可能是显示ID，需要找到数据库中的真实uid
SELECT uid, id, nickname, phone, avatar 
FROM eb_user 
WHERE nickname LIKE '%道玄%' 
   OR uid = 24187196 
   OR id = 121
   OR id = 43
ORDER BY id DESC
LIMIT 10;

-- 2. 检查观看历史表
SELECT '=== eb_view_history 表数据 ===' as info;
SELECT * FROM eb_view_history ORDER BY update_time DESC LIMIT 20;

-- 3. 检查点赞记录表
SELECT '=== eb_live_room_like 表数据 ===' as info;
SELECT * FROM eb_live_room_like ORDER BY create_time DESC LIMIT 20;

-- 4. 检查关注记录表
SELECT '=== eb_follow_record 表数据 ===' as info;
SELECT * FROM eb_follow_record ORDER BY create_time DESC LIMIT 20;

-- 5. 检查收藏表（如果存在）
SELECT '=== 检查收藏相关表 ===' as info;
SHOW TABLES LIKE '%collect%';
SHOW TABLES LIKE '%favorite%';

-- 6. 查看所有用户的活动数据统计
SELECT '=== 各用户活动数据统计 ===' as info;
SELECT 
    u.uid,
    u.nickname,
    (SELECT COUNT(*) FROM eb_view_history vh WHERE vh.user_id = u.uid) as 观看历史,
    (SELECT COUNT(*) FROM eb_live_room_like lrl WHERE lrl.user_id = u.uid) as 点赞数,
    (SELECT COUNT(*) FROM eb_follow_record fr WHERE fr.follower_id = u.uid) as 关注数
FROM eb_user u
WHERE u.uid IN (121, 43, 24187196)
   OR u.nickname LIKE '%道玄%';
