zhibo/create_test_streamer_if_needed.sql
2026-01-03 17:01:58 +08:00

30 lines
1.0 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- 检查并创建测试主播数据
-- 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;