/*
 Navicat Premium Data Transfer

 Source Server         : 118.89.113.119-db
 Source Server Type    : MySQL
 Source Server Version : 50744 (5.7.44-log)
 Source Host           : 118.89.113.119:3306
 Source Schema         : shop_msh

 Target Server Type    : MySQL
 Target Server Version : 50744 (5.7.44-log)
 File Encoding         : 65001

 Date: 16/01/2026 11:03:26
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for v2_community_posts
-- ----------------------------
DROP TABLE IF EXISTS `v2_community_posts`;
CREATE TABLE `v2_community_posts` (
  `post_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '内容ID',
  `user_id` bigint(20) NOT NULL COMMENT '用户ID',
  `check_in_record_id` int(11) DEFAULT NULL COMMENT '关联的打卡记录ID（eb_user_sign.id，当type=3时）',
  `title` varchar(100) NOT NULL COMMENT '标题',
  `content` text COMMENT '内容',
  `cover_image` varchar(255) DEFAULT NULL COMMENT '封面图URL',
  `images_json` text COMMENT '图片数组，JSON格式',
  `nutrition_data_json` text COMMENT '营养数据快照，JSON格式',
  `tags_json` text COMMENT '标签数组，JSON格式',
  `like_count` int(11) DEFAULT '0' COMMENT '点赞数',
  `comment_count` int(11) DEFAULT '0' COMMENT '评论数',
  `collect_count` int(11) DEFAULT '0' COMMENT '收藏数',
  `share_count` int(11) DEFAULT '0' COMMENT '分享数',
  `view_count` int(11) DEFAULT '0' COMMENT '查看数',
  `quick_checkin_count` int(11) DEFAULT '0' COMMENT '被一键打卡次数',
  `ai_video_count` int(11) DEFAULT '0' COMMENT '生成AI视频次数（关联eb_article表，type=2时）',
  `recommend_score` decimal(10,2) DEFAULT '0.00' COMMENT '推荐分数',
  `hot_score` decimal(10,2) DEFAULT '0.00' COMMENT '热门分数',
  `status` varchar(20) DEFAULT 'published' COMMENT '状态：draft(草稿)/published(已发布)/deleted(已删除)/banned(已封禁)',
  `privacy` varchar(20) DEFAULT 'public' COMMENT '隐私设置：public(公开)/followers_only(仅关注者)/private(私密)',
  `audit_status` varchar(20) DEFAULT 'pending' COMMENT '审核状态：pending(待审核)/approved(已通过)/rejected(已拒绝)',
  `audit_time` timestamp NULL DEFAULT NULL COMMENT '审核时间',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `video_url` varchar(255) DEFAULT NULL COMMENT '视频地址',
  `meal_plan_json` text COMMENT '配餐方案JSON，包含早中晚三餐详情',
  `ai_analysis_json` text COMMENT 'AI分析结果，JSON格式',
  `prompt` varchar(255) DEFAULT NULL COMMENT '提示词',
  `aspect_ratio` varchar(255) DEFAULT NULL COMMENT '横竖屏',
  `remark` varchar(255) DEFAULT NULL COMMENT '备注',
  `type` tinyint(4) DEFAULT NULL COMMENT '类型：1=图片，2=视频',
  PRIMARY KEY (`post_id`),
  KEY `idx_user_id` (`user_id`),
  KEY `idx_status` (`status`),
  KEY `idx_created_at` (`created_at`),
  KEY `idx_recommend_score` (`recommend_score`),
  KEY `idx_hot_score` (`hot_score`)
) ENGINE=InnoDB AUTO_INCREMENT=301 DEFAULT CHARSET=utf8mb4 COMMENT='社区内容表';

SET FOREIGN_KEY_CHECKS = 1;
