-- 检查礼物打赏记录数据 -- 1. 检查礼物记录表是否存在 SHOW TABLES LIKE '%gift%'; -- 2. 查看礼物记录表结构 DESC eb_gift_record; -- 3. 查看礼物记录数量 SELECT COUNT(*) as total_records FROM eb_gift_record; -- 4. 查看最近的礼物记录 SELECT * FROM eb_gift_record ORDER BY create_time DESC LIMIT 10; -- 5. 如果没有数据,插入一些测试数据 -- 用户43送给主播41一个玫瑰 INSERT INTO eb_gift_record (sender_id, receiver_id, room_id, gift_id, gift_name, gift_icon, gift_price, quantity, total_price, is_anonymous, create_time) VALUES (43, 41, 8, 1, '玫瑰', 'https://example.com/gifts/rose.png', 1.00, 5, 5.00, 0, NOW()), (43, 41, 8, 2, '巧克力', 'https://example.com/gifts/chocolate.png', 5.00, 2, 10.00, 0, NOW()), (42, 41, 8, 3, '棒棒糖', 'https://example.com/gifts/lollipop.png', 10.00, 1, 10.00, 0, NOW()), (44, 41, 8, 5, '蛋糕', 'https://example.com/gifts/cake.png', 50.00, 1, 50.00, 0, NOW()); -- 6. 再次查看礼物记录 SELECT g.id, g.gift_name, g.quantity, g.total_price, sender.nickname as sender_name, receiver.nickname as receiver_name, r.title as room_title, g.create_time FROM eb_gift_record g LEFT JOIN eb_user sender ON g.sender_id = sender.uid LEFT JOIN eb_user receiver ON g.receiver_id = receiver.uid LEFT JOIN eb_live_room r ON g.room_id = r.id ORDER BY g.create_time DESC LIMIT 10; -- 7. 查看统计数据 SELECT COUNT(*) as total_count, SUM(total_price) as total_value, SUM(CASE WHEN DATE(create_time) = CURDATE() THEN 1 ELSE 0 END) as today_count, SUM(CASE WHEN DATE(create_time) = CURDATE() THEN total_price ELSE 0 END) as today_value FROM eb_gift_record;