-- 检查并创建测试主播数据

-- 1. 先检查是否有主播
SELECT '当前主播数量' as info, COUNT(*) as count FROM eb_user WHERE is_streamer = 1;

-- 2. 如果没有主播，将现有用户设置为主播（以uid=43为例）
-- 请根据实际情况修改uid
UPDATE eb_user 
SET is_streamer = 1,
    streamer_level = 1,
    streamer_certified_time = NOW()
WHERE uid = 43 AND is_streamer = 0;

-- 3. 再次检查主播数量
SELECT '更新后主播数量' as info, COUNT(*) as count FROM eb_user WHERE is_streamer = 1;

-- 4. 查看主播详细信息
SELECT 
    uid,
    nickname,
    phone,
    is_streamer,
    streamer_level,
    streamer_certified_time,
    (SELECT COUNT(*) FROM eb_follow_record f WHERE f.followed_id = uid AND f.follow_status IN ('1', '关注') AND f.is_deleted = 0) as fansCount,
    (SELECT COUNT(*) FROM eb_live_room r WHERE r.uid = uid) as roomCount,
    (SELECT COALESCE(SUM(r.like_count), 0) FROM eb_live_room r WHERE r.uid = uid) as totalLikeCount
FROM eb_user 
WHERE is_streamer = 1;
