-- 调试用户Token和数据问题
-- =====================================================

-- 1. 确认用户"道玄"的真实uid
SELECT uid, nickname, phone, avatar, status 
FROM eb_user 
WHERE nickname LIKE '%道玄%';

-- 2. 检查该用户的观看历史数据
SELECT vh.*, lr.title as room_title
FROM eb_view_history vh
LEFT JOIN eb_live_room lr ON vh.target_id = lr.id AND vh.target_type = 'room'
WHERE vh.user_id = 121
ORDER BY vh.update_time DESC
LIMIT 10;

-- 3. 检查该用户的点赞数据
SELECT lrl.*, lr.title as room_title
FROM eb_live_room_like lrl
LEFT JOIN eb_live_room lr ON lrl.room_id = lr.id
WHERE lrl.user_id = 121
ORDER BY lrl.create_time DESC
LIMIT 10;

-- 4. 检查该用户的关注数据
SELECT fr.*, u.nickname as followed_nickname
FROM eb_follow_record fr
LEFT JOIN eb_user u ON fr.followed_id = u.uid
WHERE fr.follower_id = 121
ORDER BY fr.create_time DESC
LIMIT 10;

-- 5. 汇总
SELECT 
    '道玄(uid=121)' as 用户,
    (SELECT COUNT(*) FROM eb_view_history WHERE user_id = 121) as 观看历史数,
    (SELECT COUNT(*) FROM eb_live_room_like WHERE user_id = 121) as 点赞数,
    (SELECT COUNT(*) FROM eb_follow_record WHERE follower_id = 121) as 关注数;
