Files
msh-system/models-integration/sql/eb_user_sign.sql

75 lines
4.2 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*
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:04:57
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for eb_user_sign
-- ----------------------------
DROP TABLE IF EXISTS `eb_user_sign`;
CREATE TABLE `eb_user_sign` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL DEFAULT '0' COMMENT '用户uid',
`title` varchar(255) NOT NULL DEFAULT '' COMMENT '签到说明',
`number` int(11) NOT NULL DEFAULT '0' COMMENT '获得',
`balance` int(11) NOT NULL DEFAULT '0' COMMENT '剩余',
`type` tinyint(1) NOT NULL DEFAULT '1' COMMENT '类型1积分2经验',
`plan_id` bigint(20) DEFAULT NULL COMMENT '关联的营养计划ID',
`meal_type` varchar(20) DEFAULT NULL COMMENT '餐次breakfast(早餐)/lunch(午餐)/dinner(晚餐)/snack(加餐),打卡时必填',
`photos_json` text COMMENT '饮食照片URL数组1-3张JSON格式',
`notes` text COMMENT '备注说明(支持语音转文字)',
`voice_url` varchar(500) DEFAULT NULL COMMENT '语音备注原始文件URL',
`ai_recognized_foods_json` text COMMENT 'AI识别的食物列表JSON格式[{name, weight, unit, confidence}]',
`ai_recognition_status` varchar(20) DEFAULT 'pending' COMMENT 'AI识别状态pending(待识别)/success(成功)/failed(失败)',
`ai_recognition_time` timestamp NULL DEFAULT NULL COMMENT 'AI识别完成时间',
`is_manually_corrected` tinyint(1) DEFAULT '0' COMMENT '用户是否手动修正了AI识别结果0=否1=是',
`recommended_dishes_json` text COMMENT '推荐菜品来自营养计划JSON格式',
`actual_dishes_json` text COMMENT '实际食用由AI识别结果生成JSON格式',
`actual_protein` decimal(5,1) DEFAULT NULL COMMENT '实际蛋白质摄入(g)',
`actual_energy` int(11) DEFAULT NULL COMMENT '实际能量摄入(kcal)',
`actual_potassium` int(11) DEFAULT NULL COMMENT '实际钾摄入(mg)',
`actual_phosphorus` int(11) DEFAULT NULL COMMENT '实际磷摄入(mg)',
`actual_sodium` int(11) DEFAULT NULL COMMENT '实际钠摄入(mg)',
`target_protein` decimal(5,1) DEFAULT NULL COMMENT '目标蛋白质摄入(g)',
`target_energy` int(11) DEFAULT NULL COMMENT '目标能量摄入(kcal)',
`compliance_rate` int(11) DEFAULT NULL COMMENT '整体达标率(%)',
`report_id` varchar(50) DEFAULT NULL COMMENT '报告编号R20251120081501',
`report_pdf_url` varchar(500) DEFAULT NULL COMMENT 'PDF报告下载链接',
`report_generated_at` timestamp NULL DEFAULT NULL COMMENT '报告生成时间',
`report_download_count` int(11) DEFAULT '0' COMMENT '报告下载次数',
`report_share_count` int(11) DEFAULT '0' COMMENT '报告分享次数',
`ai_comments_json` text COMMENT 'AI生成的点评JSON格式{strengths:[], suggestions:[], next_meal_advice:""}',
`nutrition_score` int(11) DEFAULT NULL COMMENT '营养评分0-100',
`copied_from_sign_id` int(11) DEFAULT NULL COMMENT '复制自哪条签到记录ID关联eb_user_sign.id',
`is_copied` tinyint(1) DEFAULT '0' COMMENT '是否为复制的打卡0=否1=是',
`create_day` date NOT NULL COMMENT '签到日期',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间',
`task_id` varchar(255) DEFAULT NULL COMMENT '任务id',
`enableAIVideo` tinyint(4) DEFAULT NULL COMMENT 'AI生成视频开关标记0=否1=是',
`enableAIAnalysis` tinyint(4) DEFAULT NULL COMMENT 'AI分析开关标记0=否1=是',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE KEY `uk_uid_date_meal` (`uid`,`create_day`,`meal_type`,`type`),
KEY `uid` (`uid`,`type`) USING BTREE,
KEY `idx_plan_id` (`plan_id`),
KEY `idx_meal_type` (`meal_type`),
KEY `idx_report_id` (`report_id`),
KEY `idx_nutrition_score` (`nutrition_score`),
KEY `idx_copied_from` (`copied_from_sign_id`)
) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='签到记录表';
SET FOREIGN_KEY_CHECKS = 1;