-- 朋友圈功能数据库表结构 -- 朋友圈动态表 CREATE TABLE IF NOT EXISTS `friend_circle` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键ID', `user_id` int(11) NOT NULL COMMENT '用户ID', `body` text COMMENT '内容', `files` text COMMENT '图片列表(JSON)', `like_count` int(11) NOT NULL DEFAULT '0' COMMENT '点赞数', `comment_count` int(11) NOT NULL DEFAULT '0' COMMENT '评论数', `created_at` int(11) NOT NULL COMMENT '创建时间', `updated_at` int(11) NOT NULL COMMENT '更新时间', `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态(0:隐藏 1:正常)', PRIMARY KEY (`id`), KEY `user_id` (`user_id`), KEY `status` (`status`), KEY `created_at` (`created_at`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='朋友圈动态表'; -- 朋友圈点赞表 CREATE TABLE IF NOT EXISTS `friend_circle_like` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键ID', `circle_id` int(11) NOT NULL COMMENT '朋友圈动态ID', `user_id` int(11) NOT NULL COMMENT '用户ID', `created_at` int(11) NOT NULL COMMENT '创建时间', PRIMARY KEY (`id`), UNIQUE KEY `circle_user` (`circle_id`,`user_id`), KEY `circle_id` (`circle_id`), KEY `user_id` (`user_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='朋友圈点赞表'; -- 朋友圈评论表 CREATE TABLE IF NOT EXISTS `friend_circle_comment` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键ID', `circle_id` int(11) NOT NULL COMMENT '朋友圈动态ID', `user_id` int(11) NOT NULL COMMENT '用户ID', `reply_user_id` int(11) NOT NULL DEFAULT '0' COMMENT '回复的用户ID(0表示直接评论)', `body` text NOT NULL COMMENT '评论内容', `created_at` int(11) NOT NULL COMMENT '创建时间', `updated_at` int(11) NOT NULL COMMENT '更新时间', `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态(0:隐藏 1:正常)', PRIMARY KEY (`id`), KEY `circle_id` (`circle_id`), KEY `user_id` (`user_id`), KEY `reply_user_id` (`reply_user_id`), KEY `status` (`status`), KEY `created_at` (`created_at`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='朋友圈评论表';