-- 手动测试关注功能
-- 请根据实际情况修改用户ID

-- 假设：
-- 用户A (uid=1) 关注 用户B (uid=2)

-- 1. 查看用户信息
SELECT uid, nickname, phone, is_streamer FROM eb_user WHERE uid IN (1, 2);

-- 2. 手动插入一条关注记录到 eb_follow_record
INSERT INTO eb_follow_record (
    follower_id, 
    follower_nickname, 
    follower_phone,
    followed_id, 
    followed_nickname, 
    followed_phone,
    follow_status, 
    is_deleted
)
SELECT 
    1 as follower_id,
    u1.nickname as follower_nickname,
    u1.phone as follower_phone,
    2 as followed_id,
    u2.nickname as followed_nickname,
    u2.phone as followed_phone,
    1 as follow_status,
    0 as is_deleted
FROM eb_user u1, eb_user u2
WHERE u1.uid = 1 AND u2.uid = 2;

-- 3. 验证插入结果
SELECT * FROM eb_follow_record WHERE follower_id = 1 AND followed_id = 2;

-- 4. 测试查询关注状态
SELECT COUNT(*) as is_following 
FROM eb_follow_record 
WHERE follower_id = 1 
  AND followed_id = 2 
  AND follow_status = 1 
  AND is_deleted = 0;

-- 5. 测试统计粉丝数
SELECT COUNT(*) as fans_count
FROM eb_follow_record
WHERE followed_id = 2
  AND follow_status = 1
  AND is_deleted = 0;

-- 6. 测试统计关注数
SELECT COUNT(*) as following_count
FROM eb_follow_record
WHERE follower_id = 1
  AND follow_status = 1
  AND is_deleted = 0;
