-- 检查粉丝团表是否存在
SHOW TABLES LIKE 'eb_fan_group%';

-- 检查粉丝团表结构
DESC eb_fan_group;

-- 检查粉丝团数据
SELECT * FROM eb_fan_group LIMIT 10;

-- 检查粉丝团成员表
DESC eb_fan_group_member;

-- 检查粉丝团成员数据
SELECT * FROM eb_fan_group_member LIMIT 10;

-- 如果没有数据，插入测试数据
INSERT INTO eb_fan_group (id, name, anchor_id, anchor_name, avatar, member_count, level, description, create_time, update_time)
SELECT 1, '测试粉丝团1', 121, '主播小明', 'https://example.com/avatar1.jpg', 100, 3, '这是一个测试粉丝团', NOW(), NOW()
WHERE NOT EXISTS (SELECT 1 FROM eb_fan_group WHERE id = 1);

INSERT INTO eb_fan_group (id, name, anchor_id, anchor_name, avatar, member_count, level, description, create_time, update_time)
SELECT 2, '星光粉丝团', 122, '主播小红', 'https://example.com/avatar2.jpg', 250, 5, '星光闪耀的粉丝团', NOW(), NOW()
WHERE NOT EXISTS (SELECT 1 FROM eb_fan_group WHERE id = 2);

INSERT INTO eb_fan_group (id, name, anchor_id, anchor_name, avatar, member_count, level, description, create_time, update_time)
SELECT 3, '梦想家族', 123, '主播小华', 'https://example.com/avatar3.jpg', 500, 8, '追逐梦想的大家庭', NOW(), NOW()
WHERE NOT EXISTS (SELECT 1 FROM eb_fan_group WHERE id = 3);

-- 插入粉丝团成员测试数据
INSERT INTO eb_fan_group_member (id, group_id, user_id, nickname, avatar, level, intimacy, join_time, create_time)
SELECT 1, 1, 101, '粉丝A', 'https://example.com/fan1.jpg', 2, 1000, NOW(), NOW()
WHERE NOT EXISTS (SELECT 1 FROM eb_fan_group_member WHERE id = 1);

INSERT INTO eb_fan_group_member (id, group_id, user_id, nickname, avatar, level, intimacy, join_time, create_time)
SELECT 2, 1, 102, '粉丝B', 'https://example.com/fan2.jpg', 3, 2500, NOW(), NOW()
WHERE NOT EXISTS (SELECT 1 FROM eb_fan_group_member WHERE id = 2);

INSERT INTO eb_fan_group_member (id, group_id, user_id, nickname, avatar, level, intimacy, join_time, create_time)
SELECT 3, 2, 103, '粉丝C', 'https://example.com/fan3.jpg', 1, 500, NOW(), NOW()
WHERE NOT EXISTS (SELECT 1 FROM eb_fan_group_member WHERE id = 3);

-- 验证插入结果
SELECT * FROM eb_fan_group;
SELECT * FROM eb_fan_group_member;
