/*
 Navicat Premium Data Transfer

 Source Server         : 26-131.69-docker-mysql
 Source Server Type    : MySQL
 Source Server Version : 80022 (8.0.22)
 Source Host           : 49.235.131.69:3306
 Source Schema         : shop-msh

 Target Server Type    : MySQL
 Target Server Version : 80022 (8.0.22)
 File Encoding         : 65001

 Date: 01/02/2026 22:29:26
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for eb_activity_style
-- ----------------------------
DROP TABLE IF EXISTS `eb_activity_style`;
CREATE TABLE `eb_activity_style` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
  `name` varchar(255) NOT NULL COMMENT '活动名称',
  `type` bit(1) NOT NULL COMMENT '活动类型0=活动边框，1=活动背景',
  `starttime` datetime NOT NULL COMMENT '开始时间',
  `endtime` datetime NOT NULL COMMENT '结束时间',
  `style` varchar(255) NOT NULL COMMENT '活动边框素材地址',
  `status` bit(1) NOT NULL COMMENT '状态 0=关闭1=开启',
  `method` int DEFAULT NULL COMMENT '商品参与类型 0=全部商品参与，1=指定商品参与，2=指定品牌参与，3=指定商品分类参与,4=指定商户产品',
  `products` varchar(500) DEFAULT NULL COMMENT '参与活动商品',
  `createtime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `updatetime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

-- ----------------------------
-- Table structure for eb_ali_pay_callback
-- ----------------------------
DROP TABLE IF EXISTS `eb_ali_pay_callback`;
CREATE TABLE `eb_ali_pay_callback` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `notify_type` varchar(64) DEFAULT NULL COMMENT '通知的类型',
  `notify_id` varchar(128) DEFAULT NULL COMMENT '通知校验 ID',
  `app_id` varchar(32) DEFAULT NULL COMMENT '支付宝分配给开发者的应用 ID',
  `charset` varchar(10) DEFAULT NULL COMMENT '编码格式，如 utf-8、gbk、gb2312 等',
  `version` varchar(3) DEFAULT NULL COMMENT '调用的接口版本，固定为：1.0',
  `sign_type` varchar(10) DEFAULT NULL COMMENT '商户生成签名字符串所使用的签名算法类型，目前支持 RSA2 和 RSA，推荐使用 RSA2',
  `sign` varchar(256) DEFAULT NULL COMMENT '签名',
  `trade_no` varchar(64) DEFAULT NULL COMMENT '支付宝交易凭证号',
  `out_trade_no` varchar(64) DEFAULT NULL COMMENT '原支付请求的商户订单号',
  `trade_status` varchar(32) DEFAULT NULL COMMENT '交易目前所处的状态:WAIT_BUYER_PAY-交易创建，等待买家付款,TRADE_CLOSED-未付款交易超时关闭，或支付完成后全额退款,3-交易支付成功,4-交易结束，不可退款',
  `total_amount` decimal(9,2) DEFAULT NULL COMMENT '本次交易支付的订单金额，单位为人民币（元）',
  `receipt_amount` decimal(9,2) DEFAULT NULL COMMENT '商家在交易中实际收到的款项，单位为人民币（元）',
  `refund_fee` decimal(9,2) DEFAULT NULL COMMENT '退款通知中，返回总退款金额，单位为人民币（元），支持两位小数',
  `subject` varchar(256) DEFAULT NULL COMMENT '商品的标题/交易标题/订单标题/订单关键字等，是请求时对应的参数，原样通知回来',
  `body` varchar(400) DEFAULT NULL COMMENT '该订单的备注、描述、明细等。对应请求时的 body 参数，原样通知回来',
  `passback_params` varchar(512) DEFAULT NULL COMMENT '公共回传参数，如果请求时传递了该参数，则返回给商户时会在异步通知时将该参数原样返回。本参数必须进行UrlEncode之后才可以发送给支付宝。',
  `notify_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '通知的发送时间。格式为 yyyy-MM-dd HH:mm:ss',
  `add_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `out_trade_no` (`out_trade_no`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='支付宝回调表';

-- ----------------------------
-- Table structure for eb_ali_pay_info
-- ----------------------------
DROP TABLE IF EXISTS `eb_ali_pay_info`;
CREATE TABLE `eb_ali_pay_info` (
  `id` int NOT NULL AUTO_INCREMENT,
  `app_id` varchar(50) DEFAULT NULL COMMENT '支付宝分配给开发者的应用ID',
  `timestamp` varchar(20) DEFAULT NULL COMMENT '发送请求的时间，格式"yyyy-MM-dd HH:mm:ss"',
  `body` varchar(128) DEFAULT NULL COMMENT '订单描述',
  `subject` varchar(256) DEFAULT NULL COMMENT '订单标题',
  `out_trade_no` varchar(64) DEFAULT NULL COMMENT '商户订单号',
  `timeout_express` varchar(6) DEFAULT NULL COMMENT '订单相对超时时间',
  `time_expire` varchar(32) DEFAULT NULL COMMENT '订单绝对超时时间',
  `total_amount` varchar(9) DEFAULT NULL COMMENT '订单总金额。单位为元，精确到小数点后两位',
  `passback_params` varchar(512) DEFAULT NULL COMMENT '公用回传参数,本参数必须进行UrlEncode之后才可以发送给支付宝',
  `code` varchar(32) DEFAULT NULL COMMENT '网关返回码',
  `msg` varchar(256) DEFAULT NULL COMMENT '网关返回码描述',
  `sub_code` varchar(50) DEFAULT NULL COMMENT '业务返回码',
  `sub_msg` varchar(100) DEFAULT NULL COMMENT '业务返回码描述',
  `sign` varchar(500) DEFAULT NULL COMMENT '签名',
  `trade_no` varchar(64) DEFAULT NULL COMMENT '该交易在支付宝系统中的交易流水号',
  `seller_id` varchar(20) DEFAULT NULL COMMENT '收款支付宝账号对应的支付宝唯一用户号',
  `notify_url` varchar(256) DEFAULT NULL COMMENT '支付宝服务器主动通知商户服务器里指定的页面http/https路径',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `out_trade_no` (`out_trade_no`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='微信订单表';

-- ----------------------------
-- Table structure for eb_article
-- ----------------------------
DROP TABLE IF EXISTS `eb_article`;
CREATE TABLE `eb_article` (
  `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT '文章管理ID',
  `cid` varchar(255) NOT NULL DEFAULT '' COMMENT '分类id',
  `title` varchar(255) NOT NULL COMMENT '文章标题',
  `author` varchar(255) DEFAULT '' COMMENT '文章作者',
  `image_input` varchar(255) NOT NULL COMMENT '文章图片',
  `synopsis` varchar(255) DEFAULT '' COMMENT '文章简介',
  `share_title` varchar(255) DEFAULT '' COMMENT '文章分享标题',
  `share_synopsis` varchar(255) DEFAULT '' COMMENT '文章分享简介',
  `visit` varchar(255) DEFAULT '' COMMENT '浏览次数',
  `sort` int unsigned NOT NULL DEFAULT '0' COMMENT '排序',
  `url` varchar(255) DEFAULT '' COMMENT '原文链接',
  `media_id` varchar(100) DEFAULT NULL COMMENT '微信素材id',
  `status` tinyint unsigned NOT NULL DEFAULT '0' COMMENT '状态',
  `hide` tinyint unsigned NOT NULL DEFAULT '0' COMMENT '是否隐藏',
  `admin_id` int unsigned NOT NULL DEFAULT '0' COMMENT '管理员id',
  `mer_id` int unsigned DEFAULT '0' COMMENT '商户id',
  `product_id` int NOT NULL DEFAULT '0' COMMENT '商品关联id',
  `is_hot` tinyint unsigned NOT NULL DEFAULT '0' COMMENT '是否热门(小程序)',
  `is_banner` tinyint unsigned NOT NULL DEFAULT '0' COMMENT '是否轮播图(小程序)',
  `content` text NOT NULL COMMENT '文章内容',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `uid` varchar(255) DEFAULT '49' COMMENT '用户Id',
  `post_id` bigint DEFAULT NULL COMMENT '关联的社区内容ID（v2_community_posts.post_id，如果是从社区内容生成）',
  `check_in_record_id` int DEFAULT NULL COMMENT '关联的打卡记录ID（eb_user_sign.id，当type=2时）',
  `image2` varchar(255) DEFAULT NULL COMMENT '图片2',
  `image3` varchar(255) DEFAULT NULL COMMENT '图片3',
  `status_task` int DEFAULT NULL COMMENT '状态任务, 0: 已创建 1:任务完成 2:任务失败',
  `tags` varchar(255) DEFAULT NULL COMMENT '标签',
  `original_title` varchar(255) DEFAULT NULL COMMENT '原标题',
  `original_url` varchar(255) DEFAULT NULL COMMENT '原文地址',
  `browser_id` varchar(255) DEFAULT NULL COMMENT 'bit浏览器窗口id',
  `video_url` text COMMENT '视频地址',
  `thumbnail_url` varchar(500) DEFAULT NULL COMMENT '视频缩略图URL（当type=2时，可用image_input代替）',
  `duration` int DEFAULT NULL COMMENT '视频时长（秒）',
  `file_size` bigint DEFAULT NULL COMMENT '视频文件大小（字节）',
  `image_urls` text COMMENT '逗号分隔的图片组',
  `task_id` varchar(255) DEFAULT NULL COMMENT '任务id',
  `prompt` text COMMENT '提示词',
  `script_json` text COMMENT '视频脚本JSON（场景、文字、时长），当type=2时使用',
  `dishes_json` text COMMENT '菜品清单JSON，当type=2时使用',
  `nutrition_json` text COMMENT '营养数据JSON，当type=2时使用',
  `generation_method` varchar(20) DEFAULT 'ai' COMMENT '生成方式：ai(AI生成)/template(模板)，当type=2时使用',
  `ai_provider` varchar(50) DEFAULT NULL COMMENT 'AI提供商：runway/heygen/d-id/jianyng等，当type=2时使用',
  `generation_cost` decimal(10,4) DEFAULT NULL COMMENT '生成成本（美元），当type=2时使用',
  `generation_time` int DEFAULT NULL COMMENT '生成耗时（秒），当type=2时使用',
  `download_count` int DEFAULT '0' COMMENT '下载次数（当type=2时使用，view_count用visit字段代替）',
  `share_count` int DEFAULT '0' COMMENT '分享次数（当type=2时使用）',
  `aspect_ratio` varchar(255) DEFAULT NULL COMMENT '横竖屏',
  `remark` varchar(255) DEFAULT NULL COMMENT '备注',
  `type` tinyint DEFAULT '1' COMMENT '类型 1:图片，2:视频',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE KEY `original_title_unique` (`original_title`) USING BTREE,
  KEY `idx_eb_article_create_time` (`create_time`),
  KEY `idx_eb_article_update_time` (`update_time`),
  KEY `idx_eb_article_status` (`status`),
  KEY `idx_eb_article_task_id` (`task_id`),
  KEY `idx_eb_article_status_create_time` (`status`,`create_time`),
  KEY `idx_eb_article_id` (`id`),
  KEY `idx_post_id` (`post_id`),
  KEY `idx_check_in_record_id` (`check_in_record_id`),
  KEY `idx_type_status_task` (`type`,`status_task`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='文章管理表';

-- ----------------------------
-- Table structure for eb_category
-- ----------------------------
DROP TABLE IF EXISTS `eb_category`;
CREATE TABLE `eb_category` (
  `id` int unsigned NOT NULL AUTO_INCREMENT,
  `pid` int unsigned NOT NULL DEFAULT '0' COMMENT '父级ID',
  `path` varchar(255) NOT NULL DEFAULT '/0/' COMMENT '路径',
  `name` varchar(50) NOT NULL COMMENT '分类名称',
  `type` smallint DEFAULT '1' COMMENT '类型，1 产品分类，2 附件分类，3 文章分类， 4 设置分类， 5 菜单分类，6 配置分类， 7 秒杀配置',
  `url` varchar(255) DEFAULT '' COMMENT '地址',
  `extra` text COMMENT '扩展字段 Jsos格式',
  `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态, 1正常，0失效',
  `sort` int NOT NULL DEFAULT '99999' COMMENT '排序',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `status+pid` (`pid`,`status`) USING BTREE,
  KEY `id+status+url` (`path`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=754 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='分类表';

-- ----------------------------
-- Table structure for eb_exception_log
-- ----------------------------
DROP TABLE IF EXISTS `eb_exception_log`;
CREATE TABLE `eb_exception_log` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '异常日志ID',
  `exp_url` varchar(255) DEFAULT NULL COMMENT '异常的url',
  `exp_params` mediumtext COMMENT '异常的参数',
  `exp_type` varchar(255) DEFAULT NULL COMMENT '异常的类型',
  `exp_controller` varchar(255) DEFAULT NULL COMMENT '异常的类名',
  `exp_method` varchar(255) DEFAULT NULL COMMENT '异常的方法名',
  `exp_detail` longtext COMMENT '异常详细信息',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=109 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='异常信息表';

-- ----------------------------
-- Table structure for eb_express
-- ----------------------------
DROP TABLE IF EXISTS `eb_express`;
CREATE TABLE `eb_express` (
  `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT '快递公司id',
  `code` varchar(50) NOT NULL DEFAULT '' COMMENT '快递公司简称',
  `name` varchar(50) NOT NULL DEFAULT '' COMMENT '快递公司全称',
  `partner_id` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否需要月结账号',
  `partner_key` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否需要月结密码',
  `net` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否需要取件网店',
  `account` varchar(100) NOT NULL DEFAULT '' COMMENT '账号',
  `password` varchar(100) NOT NULL DEFAULT '' COMMENT '密码',
  `net_name` varchar(100) NOT NULL DEFAULT '' COMMENT '网点名称',
  `sort` int NOT NULL DEFAULT '0' COMMENT '排序',
  `is_show` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否显示',
  `status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否可用',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE KEY `code` (`code`) USING BTREE,
  KEY `is_show` (`is_show`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1639 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='快递公司表';

-- ----------------------------
-- Table structure for eb_page_category
-- ----------------------------
DROP TABLE IF EXISTS `eb_page_category`;
CREATE TABLE `eb_page_category` (
  `id` int NOT NULL AUTO_INCREMENT,
  `pid` int NOT NULL DEFAULT '0' COMMENT '父类id',
  `type` varchar(50) NOT NULL DEFAULT 'link' COMMENT '类型:link、special、product、product_category、custom',
  `name` varchar(50) NOT NULL DEFAULT '' COMMENT '分类名称',
  `sort` smallint NOT NULL DEFAULT '0' COMMENT '排序',
  `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态',
  `add_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间',
  `level` tinyint(1) NOT NULL DEFAULT '0' COMMENT '层级',
  `is_mer` int NOT NULL DEFAULT '0' COMMENT '是否商户  0平台，商户id',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='页面链接分类';

-- ----------------------------
-- Table structure for eb_page_diy
-- ----------------------------
DROP TABLE IF EXISTS `eb_page_diy`;
CREATE TABLE `eb_page_diy` (
  `id` int NOT NULL AUTO_INCREMENT,
  `version` varchar(255) NOT NULL DEFAULT '' COMMENT '版本号',
  `name` varchar(255) NOT NULL DEFAULT '' COMMENT '页面名称',
  `title` varchar(100) NOT NULL DEFAULT '' COMMENT '网站标题',
  `cover_image` varchar(255) NOT NULL DEFAULT '' COMMENT '封面图',
  `template_name` varchar(255) NOT NULL DEFAULT '' COMMENT '模板名称',
  `value` longtext COMMENT '页面数据',
  `add_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `status` int NOT NULL DEFAULT '0' COMMENT '是否使用',
  `type` int NOT NULL DEFAULT '0' COMMENT '页面类型',
  `is_show` int NOT NULL DEFAULT '0' COMMENT '显示首页',
  `is_bg_color` int NOT NULL DEFAULT '0' COMMENT '颜色是否选中',
  `is_bg_pic` int NOT NULL DEFAULT '0' COMMENT '背景图是否选中',
  `is_diy` int NOT NULL DEFAULT '0' COMMENT '是否是diy数据',
  `color_picker` varchar(50) NOT NULL DEFAULT '' COMMENT '背景颜色',
  `bg_pic` varchar(256) NOT NULL DEFAULT '' COMMENT '背景图',
  `bg_tab_val` int NOT NULL DEFAULT '0' COMMENT '背景图图片样式',
  `is_del` int NOT NULL DEFAULT '0' COMMENT '是否删除',
  `return_address` varchar(255) NOT NULL DEFAULT '0' COMMENT '返回地址',
  `title_bg_color` varchar(255) NOT NULL DEFAULT '1' COMMENT '标题背景色',
  `title_color` varchar(255) NOT NULL DEFAULT '1' COMMENT '标题颜色',
  `service_status` int NOT NULL DEFAULT '1' COMMENT '商家样式',
  `mer_id` int NOT NULL DEFAULT '0' COMMENT '商户ID',
  `is_default` int NOT NULL DEFAULT '0' COMMENT '默认模板(1.平台默认 2.商户默认）',
  `text_position` int NOT NULL DEFAULT '0' COMMENT '标题文本位置',
  PRIMARY KEY (`id`),
  KEY `template_name` (`template_name`,`type`) USING BTREE,
  KEY `status_type` (`status`,`type`) USING BTREE,
  KEY `mer_id` (`mer_id`)
) ENGINE=InnoDB AUTO_INCREMENT=221 DEFAULT CHARSET=utf8 COMMENT='DIY数据表';

-- ----------------------------
-- Table structure for eb_page_link
-- ----------------------------
DROP TABLE IF EXISTS `eb_page_link`;
CREATE TABLE `eb_page_link` (
  `id` int NOT NULL AUTO_INCREMENT,
  `cate_id` int NOT NULL DEFAULT '0' COMMENT '分类id',
  `type` tinyint(1) NOT NULL DEFAULT '1' COMMENT '分组1:基础2:分销3:个人中心',
  `name` varchar(50) NOT NULL DEFAULT '' COMMENT '页面名称',
  `url` varchar(255) NOT NULL DEFAULT '' COMMENT '页面链接',
  `param` varchar(255) NOT NULL DEFAULT '' COMMENT '参数',
  `example` varchar(255) NOT NULL DEFAULT '' COMMENT '事例',
  `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态',
  `sort` smallint NOT NULL DEFAULT '0' COMMENT '排序',
  `add_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间',
  `is_mer` tinyint(1) NOT NULL DEFAULT '0' COMMENT '1是商户的链接',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='页面链接';

-- ----------------------------
-- Table structure for eb_pay_component_brand
-- ----------------------------
DROP TABLE IF EXISTS `eb_pay_component_brand`;
CREATE TABLE `eb_pay_component_brand` (
  `brand_id` int unsigned NOT NULL COMMENT '品牌ID',
  `brand_wording` varchar(255) NOT NULL DEFAULT '' COMMENT '品牌名称',
  KEY `brand_id` (`brand_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='组件品牌表(视频号)';

-- ----------------------------
-- Table structure for eb_pay_component_cat
-- ----------------------------
DROP TABLE IF EXISTS `eb_pay_component_cat`;
CREATE TABLE `eb_pay_component_cat` (
  `third_cat_id` int unsigned NOT NULL COMMENT '类目ID',
  `third_cat_name` varchar(255) NOT NULL DEFAULT '' COMMENT '类目名称',
  `qualification` varchar(500) NOT NULL DEFAULT '' COMMENT '类目资质',
  `qualification_type` int unsigned NOT NULL DEFAULT '0' COMMENT '类目资质类型,0:不需要,1:必填,2:选填',
  `product_qualification` varchar(500) NOT NULL DEFAULT '' COMMENT '商品资质',
  `product_qualification_type` int unsigned NOT NULL DEFAULT '0' COMMENT '商品资质类型,0:不需要,1:必填,2:选填',
  `second_cat_id` int unsigned NOT NULL COMMENT '二级类目ID',
  `second_cat_name` varchar(255) DEFAULT '' COMMENT '二级类目名称',
  `first_cat_id` int unsigned NOT NULL COMMENT '一级类目ID',
  `first_cat_name` varchar(255) DEFAULT '' COMMENT '一级类目名称',
  KEY `third_cat_id` (`third_cat_id`) USING BTREE,
  KEY `second_cat_id` (`second_cat_id`) USING BTREE,
  KEY `first_cat_id` (`first_cat_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='组件类目表(视频号)';

-- ----------------------------
-- Table structure for eb_pay_component_delivery_company
-- ----------------------------
DROP TABLE IF EXISTS `eb_pay_component_delivery_company`;
CREATE TABLE `eb_pay_component_delivery_company` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `delivery_id` varchar(20) NOT NULL COMMENT '快递公司id',
  `delivery_name` varchar(50) NOT NULL COMMENT '快递公司名称',
  `is_del` tinyint unsigned NOT NULL DEFAULT '0' COMMENT '是否删除 0未删除 1删除',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=600 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='组件快递公司表(视频号)';

-- ----------------------------
-- Table structure for eb_pay_component_draft_product
-- ----------------------------
DROP TABLE IF EXISTS `eb_pay_component_draft_product`;
CREATE TABLE `eb_pay_component_draft_product` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `product_id` int unsigned NOT NULL COMMENT '商品ID，商家自定义商品ID',
  `primary_product_id` int unsigned NOT NULL COMMENT '主商品ID',
  `component_product_id` int unsigned DEFAULT NULL COMMENT '交易组件平台内部商品ID',
  `title` varchar(255) NOT NULL COMMENT '标题',
  `path` varchar(255) NOT NULL COMMENT '绑定的小程序商品路径',
  `head_img` text NOT NULL COMMENT '轮播图,多张',
  `qualification_pics` text COMMENT '商品资质图片,多张',
  `third_cat_id` int unsigned NOT NULL COMMENT '第三级类目ID',
  `brand_id` int unsigned NOT NULL COMMENT '品牌id',
  `info_version` varchar(255) NOT NULL DEFAULT '' COMMENT '预留字段，用于版本控制',
  `status` int unsigned NOT NULL COMMENT '线上状态：0-初始值，5-上架，11-自主下架，13-违规下架/风控系统下架',
  `edit_status` int unsigned NOT NULL COMMENT '商品草稿状态:1-未审核，2-审核中，3-审核失败，4-审核成功',
  `create_time` varchar(30) DEFAULT NULL COMMENT '创建时间',
  `update_time` varchar(30) DEFAULT NULL COMMENT '更新时间',
  `temp_id` int NOT NULL COMMENT '运费模板ID',
  `stock` int unsigned NOT NULL COMMENT '库存',
  `sales` int unsigned NOT NULL COMMENT '销量',
  `unit_name` varchar(16) NOT NULL COMMENT '单位名称',
  `give_integral` int unsigned NOT NULL DEFAULT '0' COMMENT '反多少积分',
  `spec_type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '规格 0单 1多',
  `ficti` int unsigned NOT NULL DEFAULT '0' COMMENT '虚拟销量',
  `desc_info` text COMMENT 'desc详情',
  `sku` text COMMENT 'sku',
  `attr` text COMMENT 'attr(前端用)',
  `attr_value` text COMMENT 'attrValue(前端用)',
  `is_del` tinyint unsigned NOT NULL DEFAULT '0' COMMENT '是否删除 0未删除 1删除',
  `add_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='组件商品草稿表(视频号)';

-- ----------------------------
-- Table structure for eb_pay_component_order
-- ----------------------------
DROP TABLE IF EXISTS `eb_pay_component_order`;
CREATE TABLE `eb_pay_component_order` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `order_no` varchar(32) NOT NULL COMMENT '订单号,商家自定义订单ID',
  `component_order_id` bigint unsigned DEFAULT NULL COMMENT '微信侧订单id ',
  `openid` varchar(255) NOT NULL COMMENT '用户的openid',
  `path` varchar(255) NOT NULL DEFAULT '' COMMENT '商家小程序该订单的页面path，用于微信侧订单中心跳转',
  `scene` int unsigned NOT NULL COMMENT '下单时小程序的场景值',
  `out_user_id` int unsigned NOT NULL COMMENT '用户id',
  `pay_method` varchar(255) NOT NULL COMMENT '支付方式，包括：微信支付,货到付款,其他',
  `pay_method_type` int unsigned NOT NULL COMMENT '支付方式，0，微信支付，1: 货到付款，99: 其他（默认0）',
  `prepay_id` varchar(255) NOT NULL COMMENT '预支付ID',
  `prepay_time` varchar(255) NOT NULL COMMENT '预付款时间（拿到prepay_id的时间）',
  `order_price` bigint unsigned NOT NULL DEFAULT '0' COMMENT '该订单最终的金额（单位：分）',
  `freight` bigint unsigned NOT NULL DEFAULT '0' COMMENT '运费（单位：分）',
  `discounted_price` bigint unsigned NOT NULL DEFAULT '0' COMMENT '优惠金额（单位：分）',
  `additional_price` bigint unsigned NOT NULL DEFAULT '0' COMMENT '附加金额（单位：分）',
  `additional_remarks` varchar(255) DEFAULT NULL COMMENT '附加金额备注',
  `delivery_type` int unsigned NOT NULL COMMENT '发货类型:1: 正常快递, 2: 无需快递, 3: 线下配送, 4: 用户自提 （默认1）',
  `receiver_name` varchar(50) NOT NULL COMMENT '收件人姓名',
  `detailed_address` varchar(255) NOT NULL COMMENT '详细收货地址信息',
  `tel_number` varchar(20) NOT NULL COMMENT '收件人手机号码',
  `country` varchar(20) DEFAULT NULL COMMENT '国家',
  `province` varchar(20) DEFAULT NULL COMMENT '省份',
  `city` varchar(20) DEFAULT NULL COMMENT '城市',
  `town` varchar(20) DEFAULT NULL COMMENT '乡镇',
  `ticket` varchar(100) NOT NULL COMMENT '拉起收银台的ticket',
  `ticket_expire_time` varchar(20) NOT NULL COMMENT 'ticket有效截止时间',
  `final_price` bigint unsigned NOT NULL COMMENT '订单最终价格（单位：分）',
  `status` int unsigned NOT NULL DEFAULT '10' COMMENT '订单状态：10-待付款，11-收银台支付完成（自动流转，对商家来说和10同等对待即可），20-待发货，30-待收货，100-完成，200-全部商品售后之后，订单取消，250-用户主动取消/待付款超时取消/商家取消',
  `finish_all_delivery` int unsigned DEFAULT NULL COMMENT '是否发货完成',
  `delivery_list` text COMMENT '快递数组',
  `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `transaction_id` varchar(32) DEFAULT NULL COMMENT '微信支付订单号',
  `time_end` varchar(14) DEFAULT NULL COMMENT '订单支付时间，格式为yyyyMMddHHmmss',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='组件订单表(视频号)';

-- ----------------------------
-- Table structure for eb_pay_component_order_product
-- ----------------------------
DROP TABLE IF EXISTS `eb_pay_component_order_product`;
CREATE TABLE `eb_pay_component_order_product` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `order_no` varchar(32) NOT NULL COMMENT '订单号,商家自定义订单ID',
  `component_order_id` bigint unsigned DEFAULT NULL COMMENT '微信侧订单id ',
  `product_id` int unsigned DEFAULT NULL COMMENT '交易组件平台内部商品ID',
  `out_product_id` varchar(20) NOT NULL COMMENT '商家自定义商品ID',
  `sku_id` int unsigned NOT NULL DEFAULT '0' COMMENT '交易组件平台内部skuID，可填0（如果这个product_id下没有sku）',
  `out_sku_id` varchar(20) NOT NULL COMMENT '商家自定义商品skuID，可填空字符串（如果这个product_id下没有sku）',
  `product_cnt` int unsigned NOT NULL COMMENT '购买的数量',
  `sale_price` bigint unsigned NOT NULL COMMENT '生成这次订单时商品的售卖价（单位：分），可以跟上传商品接口的价格不一致',
  `head_img` varchar(255) NOT NULL COMMENT '生成订单时商品的头图',
  `title` varchar(255) NOT NULL COMMENT '生成订单时商品的标题',
  `path` varchar(255) NOT NULL COMMENT '绑定的小程序商品路径',
  `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='组件订单详情表(视频号)';

-- ----------------------------
-- Table structure for eb_pay_component_product
-- ----------------------------
DROP TABLE IF EXISTS `eb_pay_component_product`;
CREATE TABLE `eb_pay_component_product` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID，商家自定义商品ID',
  `primary_product_id` int unsigned NOT NULL COMMENT '主商品ID',
  `component_product_id` int unsigned DEFAULT NULL COMMENT '交易组件平台内部商品ID',
  `title` varchar(255) NOT NULL COMMENT '标题',
  `path` varchar(255) DEFAULT NULL COMMENT '绑定的小程序商品路径',
  `head_img` text NOT NULL COMMENT '轮播图,多张',
  `qualification_pics` text COMMENT '商品资质图片,多张',
  `third_cat_id` int unsigned NOT NULL COMMENT '第三级类目ID',
  `brand_id` int unsigned NOT NULL COMMENT '品牌id',
  `info_version` varchar(255) NOT NULL DEFAULT '' COMMENT '预留字段，用于版本控制',
  `status` int unsigned NOT NULL DEFAULT '0' COMMENT '线上状态：0-初始值，5-上架，11-自主下架，13-违规下架/风控系统下架',
  `edit_status` int unsigned NOT NULL DEFAULT '1' COMMENT '商品草稿状态:1-未审核，2-审核中，3-审核失败，4-审核成功',
  `create_time` varchar(30) DEFAULT NULL COMMENT '创建时间',
  `update_time` varchar(30) DEFAULT NULL COMMENT '更新时间',
  `temp_id` int DEFAULT NULL COMMENT '运费模板ID',
  `stock` int unsigned NOT NULL DEFAULT '0' COMMENT '库存',
  `sales` int unsigned NOT NULL DEFAULT '0' COMMENT '销量',
  `unit_name` varchar(16) NOT NULL COMMENT '单位名称',
  `give_integral` int NOT NULL DEFAULT '0' COMMENT '反多少积分',
  `spec_type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '规格 0单 1多',
  `ficti` int NOT NULL DEFAULT '0' COMMENT '虚拟销量',
  `is_del` tinyint unsigned NOT NULL DEFAULT '0' COMMENT '是否删除 0未删除 1删除',
  `is_sub` tinyint unsigned NOT NULL DEFAULT '0' COMMENT '是否单独分佣',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='组件商品表(视频号)';

-- ----------------------------
-- Table structure for eb_pay_component_product_audit_info
-- ----------------------------
DROP TABLE IF EXISTS `eb_pay_component_product_audit_info`;
CREATE TABLE `eb_pay_component_product_audit_info` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `product_id` int unsigned NOT NULL COMMENT '商品ID',
  `component_product_id` int unsigned DEFAULT NULL COMMENT '交易组件平台内部商品ID',
  `submit_time` varchar(50) DEFAULT NULL COMMENT '上一次提交时间, yyyy-MM-dd HH:mm:ss',
  `audit_time` varchar(50) DEFAULT NULL COMMENT '上一次审核时间, yyyy-MM-dd HH:mm:ss',
  `reject_reason` varchar(255) DEFAULT NULL COMMENT '拒绝理由，只有edit_status为3时出现',
  `audit_id` varchar(50) DEFAULT NULL COMMENT '审核单id',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `product_id` (`product_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='组件商品审核信息表(视频号)';

-- ----------------------------
-- Table structure for eb_pay_component_product_info
-- ----------------------------
DROP TABLE IF EXISTS `eb_pay_component_product_info`;
CREATE TABLE `eb_pay_component_product_info` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `product_id` int unsigned NOT NULL COMMENT '商品ID',
  `component_product_id` int unsigned DEFAULT NULL COMMENT '交易组件平台内部商品ID',
  `desc` text NOT NULL COMMENT '商品详情',
  `imgs` text COMMENT '商品详情图片',
  `is_del` tinyint unsigned NOT NULL DEFAULT '0' COMMENT '是否删除 0未删除 1删除',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `product_id` (`product_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='组件商品详情表(视频号)';

-- ----------------------------
-- Table structure for eb_pay_component_product_sku
-- ----------------------------
DROP TABLE IF EXISTS `eb_pay_component_product_sku`;
CREATE TABLE `eb_pay_component_product_sku` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID，商家自定义skuID',
  `product_id` int unsigned NOT NULL COMMENT '商品ID',
  `component_product_id` int unsigned DEFAULT NULL COMMENT '交易组件平台内部商品ID',
  `sku_id` varchar(20) DEFAULT NULL COMMENT '交易组件平台自定义skuID',
  `thumb_img` varchar(500) NOT NULL COMMENT 'sku小图',
  `sale_price` bigint unsigned NOT NULL COMMENT '售卖价格,以分为单位',
  `market_price` bigint unsigned NOT NULL COMMENT '市场价格,以分为单位',
  `stock_num` int unsigned NOT NULL COMMENT '库存',
  `barcode` varchar(255) DEFAULT NULL COMMENT '条形码',
  `sku_code` varchar(255) DEFAULT NULL COMMENT '商品编码',
  `is_del` tinyint unsigned NOT NULL DEFAULT '0' COMMENT '是否删除 0未删除 1删除',
  `sku` varchar(128) DEFAULT NULL COMMENT '商品属性索引值 (attr_value|attr_value[|....])',
  `attr_value_id` int unsigned DEFAULT NULL COMMENT '商品规格属性id',
  `version` int NOT NULL DEFAULT '0' COMMENT '并发版本控制',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `product_id` (`product_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='组件商品sku表(视频号)';

-- ----------------------------
-- Table structure for eb_pay_component_product_sku_attr
-- ----------------------------
DROP TABLE IF EXISTS `eb_pay_component_product_sku_attr`;
CREATE TABLE `eb_pay_component_product_sku_attr` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID，商家自定义skuID',
  `sku_id` int unsigned NOT NULL COMMENT 'skuID',
  `component_sku_id` varchar(20) DEFAULT NULL COMMENT '交易组件平台自定义skuID',
  `attr_key` varchar(255) NOT NULL COMMENT '销售属性key（自定义）',
  `attr_value` varchar(255) NOT NULL COMMENT '销售属性value（自定义）',
  `is_del` tinyint unsigned NOT NULL DEFAULT '0' COMMENT '是否删除 0未删除 1删除',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `sku_id` (`sku_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='组件商品sku属性表(视频号)';

-- ----------------------------
-- Table structure for eb_pay_component_shop_brand
-- ----------------------------
DROP TABLE IF EXISTS `eb_pay_component_shop_brand`;
CREATE TABLE `eb_pay_component_shop_brand` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `brand_id` int unsigned DEFAULT NULL COMMENT '品牌ID',
  `audit_id` varchar(255) DEFAULT NULL COMMENT '审核单id',
  `license` text COMMENT '营业执照或组织机构代码证，图片url/media_id,逗号分隔',
  `brand_audit_type` int unsigned DEFAULT NULL COMMENT '认证审核类型，1：国内品牌申请-R标，2：国内品牌申请-TM标，3：海外品牌申请-R标，4：海外品牌申请-TM标',
  `trademark_type` varchar(3) DEFAULT NULL COMMENT '商标分类，共有45个分类',
  `brand_management_type` int unsigned DEFAULT NULL COMMENT '选择品牌经营类型：1-自有品牌，2-代理品牌，3-无品牌',
  `commodity_origin_type` int unsigned DEFAULT NULL COMMENT '商品产地是否进口：1-是，2-否',
  `brand_wording` varchar(255) DEFAULT NULL COMMENT '商标/品牌词',
  `sale_authorization` text COMMENT '销售授权书（如商持人为自然人，还需提供有其签名的身份证正反面扫描件)，图片url/media_id,逗号分隔',
  `trademark_registration_certificate` text COMMENT '商标注册证书，图片url/media_id,逗号分隔',
  `trademark_change_certificate` text COMMENT '商标变更证明，图片url/media_id,逗号分隔',
  `trademark_registrant` varchar(50) DEFAULT NULL COMMENT '商标注册人姓名',
  `trademark_registrant_nu` varchar(255) DEFAULT NULL COMMENT '商标注册号/申请号',
  `trademark_authorization_period` varchar(30) DEFAULT NULL COMMENT '商标有效期，yyyy-MM-dd HH:mm:ss',
  `trademark_registration_application` text COMMENT '商标注册申请受理通知书，图片url/media_id,逗号分隔',
  `trademark_applicant` varchar(50) DEFAULT NULL COMMENT '商标申请人姓名',
  `trademark_application_time` varchar(30) DEFAULT NULL COMMENT '商标申请时间, yyyy-MM-dd HH:mm:ss',
  `imported_goods_form` text COMMENT '中华人民共和国海关进口货物报关单，图片url/media_id,逗号分隔',
  `status` int unsigned DEFAULT NULL COMMENT '审核状态, 0：审核中，1：审核成功，9：审核拒绝',
  `reject_reason` varchar(255) DEFAULT NULL COMMENT '如果审核拒绝，返回拒绝原因',
  `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='组件商户品牌表(视频号)';

-- ----------------------------
-- Table structure for eb_product_day_record
-- ----------------------------
DROP TABLE IF EXISTS `eb_product_day_record`;
CREATE TABLE `eb_product_day_record` (
  `id` int NOT NULL AUTO_INCREMENT,
  `date` varchar(20) DEFAULT NULL COMMENT '日期',
  `product_id` int DEFAULT NULL COMMENT '商品id',
  `page_view` int DEFAULT NULL COMMENT '浏览量',
  `collect_num` int DEFAULT NULL COMMENT '收藏量',
  `add_cart_num` int DEFAULT NULL COMMENT '加购件数',
  `order_product_num` int DEFAULT NULL COMMENT '下单商品数（销售件数）',
  `order_success_product_fee` decimal(8,2) DEFAULT NULL COMMENT '销售额',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `date` (`date`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=14056 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='商品日记录表';

-- ----------------------------
-- Table structure for eb_schedule_job
-- ----------------------------
DROP TABLE IF EXISTS `eb_schedule_job`;
CREATE TABLE `eb_schedule_job` (
  `job_id` int NOT NULL AUTO_INCREMENT COMMENT '任务id',
  `bean_name` varchar(200) DEFAULT NULL COMMENT 'spring bean名称',
  `method_name` varchar(100) DEFAULT NULL COMMENT '方法名',
  `params` varchar(2000) DEFAULT NULL COMMENT '参数',
  `cron_expression` varchar(100) DEFAULT NULL COMMENT 'cron表达式',
  `status` tinyint DEFAULT NULL COMMENT '任务状态  0：正常  1：暂停',
  `remark` varchar(255) DEFAULT NULL COMMENT '备注',
  `is_delte` tinyint unsigned DEFAULT '0' COMMENT '是否删除',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  PRIMARY KEY (`job_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='定时任务';

-- ----------------------------
-- Table structure for eb_schedule_job_log
-- ----------------------------
DROP TABLE IF EXISTS `eb_schedule_job_log`;
CREATE TABLE `eb_schedule_job_log` (
  `log_id` int NOT NULL AUTO_INCREMENT COMMENT '任务日志id',
  `job_id` int NOT NULL COMMENT '任务id',
  `bean_name` varchar(200) DEFAULT NULL COMMENT 'spring bean名称',
  `method_name` varchar(100) DEFAULT NULL COMMENT '方法名',
  `params` varchar(2000) DEFAULT NULL COMMENT '参数',
  `status` tinyint NOT NULL COMMENT '任务状态    0：成功    1：失败',
  `error` varchar(2000) DEFAULT NULL COMMENT '失败信息',
  `times` int NOT NULL COMMENT '耗时(单位：毫秒)',
  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  PRIMARY KEY (`log_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=4624947 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='定时任务日志';

-- ----------------------------
-- Table structure for eb_sensitive_method_log
-- ----------------------------
DROP TABLE IF EXISTS `eb_sensitive_method_log`;
CREATE TABLE `eb_sensitive_method_log` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `admin_id` int NOT NULL COMMENT '管理员id',
  `admin_account` varchar(32) DEFAULT '' COMMENT '管理员账号',
  `description` varchar(50) DEFAULT '' COMMENT '接口描述',
  `method_type` varchar(30) DEFAULT '' COMMENT '业务类型',
  `method` varchar(100) DEFAULT '' COMMENT '方法名称',
  `request_method` varchar(10) DEFAULT '' COMMENT '请求方式',
  `url` varchar(255) DEFAULT '' COMMENT '请求URL',
  `ip` varchar(50) DEFAULT '' COMMENT '主机地址',
  `request_param` varchar(2000) DEFAULT '' COMMENT '请求参数',
  `result` varchar(2000) DEFAULT '' COMMENT '返回参数',
  `status` int DEFAULT '0' COMMENT '操作状态（0正常 1异常）',
  `error_msg` varchar(2000) DEFAULT '' COMMENT '错误消息',
  `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=449 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='敏感操作日志表';

-- ----------------------------
-- Table structure for eb_shipping_templates
-- ----------------------------
DROP TABLE IF EXISTS `eb_shipping_templates`;
CREATE TABLE `eb_shipping_templates` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '编号',
  `name` varchar(255) NOT NULL COMMENT '模板名称',
  `type` tinyint(1) NOT NULL DEFAULT '1' COMMENT '计费方式',
  `appoint` tinyint(1) NOT NULL DEFAULT '0' COMMENT '包邮类型：0-全国包邮，1-部分包邮，2-不包邮',
  `sort` int NOT NULL DEFAULT '0' COMMENT '排序',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='运费模板';

-- ----------------------------
-- Table structure for eb_shipping_templates_free
-- ----------------------------
DROP TABLE IF EXISTS `eb_shipping_templates_free`;
CREATE TABLE `eb_shipping_templates_free` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '编号',
  `temp_id` int NOT NULL DEFAULT '0' COMMENT '模板ID',
  `city_id` int NOT NULL DEFAULT '0' COMMENT '城市ID',
  `title` text COMMENT '描述',
  `number` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '包邮件数',
  `price` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '包邮金额',
  `type` tinyint(1) NOT NULL DEFAULT '1' COMMENT '计费方式',
  `uniqid` varchar(32) NOT NULL DEFAULT '' COMMENT '分组唯一值',
  `status` tinyint(1) DEFAULT '0' COMMENT '是否无效',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=2922 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='运费模板包邮';

-- ----------------------------
-- Table structure for eb_shipping_templates_region
-- ----------------------------
DROP TABLE IF EXISTS `eb_shipping_templates_region`;
CREATE TABLE `eb_shipping_templates_region` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '编号',
  `temp_id` int NOT NULL DEFAULT '0' COMMENT '模板ID',
  `city_id` int NOT NULL DEFAULT '0' COMMENT '城市ID',
  `title` text COMMENT '描述',
  `first` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '首件',
  `first_price` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '首件运费',
  `renewal` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '续件',
  `renewal_price` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '续件运费',
  `type` tinyint(1) NOT NULL DEFAULT '1' COMMENT '计费方式 1按件数 2按重量 3按体积',
  `uniqid` varchar(32) NOT NULL DEFAULT '' COMMENT '分组唯一值',
  `status` tinyint(1) DEFAULT '0' COMMENT '是否无效',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='运费模板指定区域费用';

-- ----------------------------
-- Table structure for eb_shopping_product_day_record
-- ----------------------------
DROP TABLE IF EXISTS `eb_shopping_product_day_record`;
CREATE TABLE `eb_shopping_product_day_record` (
  `id` int NOT NULL AUTO_INCREMENT,
  `date` varchar(20) DEFAULT NULL COMMENT '日期',
  `add_product_num` int DEFAULT NULL COMMENT '新增商品数量',
  `page_view` int DEFAULT NULL COMMENT '浏览量',
  `collect_num` int DEFAULT NULL COMMENT '收藏量',
  `add_cart_num` int DEFAULT NULL COMMENT '加购件数',
  `order_product_num` int DEFAULT NULL COMMENT '下单商品数',
  `order_success_product_num` int DEFAULT NULL COMMENT '交易成功商品数',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `date` (`date`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=271 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='商城商品日记录表';

-- ----------------------------
-- Table structure for eb_sms_record
-- ----------------------------
DROP TABLE IF EXISTS `eb_sms_record`;
CREATE TABLE `eb_sms_record` (
  `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT '短信发送记录编号',
  `uid` varchar(255) NOT NULL COMMENT '短信平台账号',
  `phone` char(11) NOT NULL COMMENT '接受短信的手机号',
  `content` text COMMENT '短信内容',
  `add_ip` varchar(30) DEFAULT NULL COMMENT '添加记录ip',
  `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `template` varchar(255) DEFAULT '' COMMENT '短信模板ID',
  `resultcode` int unsigned DEFAULT NULL COMMENT '状态码 100=成功,130=失败,131=空号,132=停机,133=关机,134=无状态',
  `record_id` int unsigned DEFAULT NULL COMMENT '发送记录id',
  `memo` text COMMENT '短信平台返回信息',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='短信发送记录表';

-- ----------------------------
-- Table structure for eb_sms_template
-- ----------------------------
DROP TABLE IF EXISTS `eb_sms_template`;
CREATE TABLE `eb_sms_template` (
  `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
  `temp_id` varchar(20) NOT NULL DEFAULT '0' COMMENT '短信模板id',
  `temp_type` tinyint NOT NULL DEFAULT '1' COMMENT '模板类型',
  `title` varchar(100) NOT NULL DEFAULT '' COMMENT '模板说明',
  `type` varchar(20) NOT NULL DEFAULT '' COMMENT '类型',
  `temp_key` varchar(50) NOT NULL DEFAULT '' COMMENT '模板编号',
  `status` tinyint NOT NULL DEFAULT '1' COMMENT '状态',
  `content` varchar(500) NOT NULL COMMENT '短息内容',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=573 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=COMPACT COMMENT='短信模板表';

-- ----------------------------
-- Table structure for eb_store_bargain
-- ----------------------------
DROP TABLE IF EXISTS `eb_store_bargain`;
CREATE TABLE `eb_store_bargain` (
  `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT '砍价商品ID',
  `product_id` int unsigned NOT NULL COMMENT '关联商品ID',
  `title` varchar(255) NOT NULL COMMENT '砍价活动名称',
  `image` varchar(150) NOT NULL COMMENT '砍价活动图片',
  `unit_name` varchar(16) DEFAULT NULL COMMENT '单位名称',
  `stock` int unsigned DEFAULT NULL COMMENT '库存',
  `sales` int unsigned DEFAULT NULL COMMENT '销量',
  `images` varchar(2000) NOT NULL COMMENT '砍价商品轮播图',
  `start_time` bigint unsigned NOT NULL COMMENT '砍价开启时间',
  `stop_time` bigint unsigned NOT NULL COMMENT '砍价结束时间',
  `store_name` varchar(255) DEFAULT NULL COMMENT '砍价商品名称',
  `price` decimal(8,2) unsigned DEFAULT NULL COMMENT '砍价金额',
  `min_price` decimal(8,2) unsigned DEFAULT NULL COMMENT '砍价商品最低价',
  `num` int unsigned DEFAULT NULL COMMENT '购买数量限制——单个活动每个用户发起砍价次数限制',
  `bargain_max_price` decimal(8,2) unsigned DEFAULT NULL COMMENT '用户每次砍价的最大金额',
  `bargain_min_price` decimal(8,2) unsigned DEFAULT NULL COMMENT '用户每次砍价的最小金额',
  `bargain_num` int unsigned NOT NULL DEFAULT '1' COMMENT '帮砍次数——单个商品用户可以帮砍的次数',
  `status` tinyint unsigned NOT NULL DEFAULT '1' COMMENT '砍价状态 0(到砍价时间不自动开启)  1(到砍价时间自动开启时间)',
  `give_integral` int DEFAULT '0' COMMENT '反多少积分',
  `info` varchar(255) DEFAULT NULL COMMENT '砍价活动简介',
  `cost` decimal(8,2) unsigned DEFAULT NULL COMMENT '成本价',
  `sort` int unsigned NOT NULL DEFAULT '0' COMMENT '排序',
  `is_hot` tinyint unsigned NOT NULL DEFAULT '0' COMMENT '是否推荐0不推荐1推荐',
  `is_del` tinyint unsigned NOT NULL DEFAULT '0' COMMENT '是否删除 0未删除 1删除',
  `add_time` bigint unsigned DEFAULT NULL COMMENT '添加时间',
  `is_postage` tinyint unsigned NOT NULL DEFAULT '1' COMMENT '是否包邮 0不包邮 1包邮',
  `postage` decimal(10,2) unsigned DEFAULT NULL COMMENT '邮费',
  `rule` text COMMENT '砍价规则',
  `look` int unsigned DEFAULT '0' COMMENT '砍价商品浏览量',
  `share` int unsigned DEFAULT '0' COMMENT '砍价商品分享量',
  `temp_id` int DEFAULT NULL COMMENT '运费模板ID',
  `weight` decimal(8,2) DEFAULT '0.00' COMMENT '重量',
  `volume` decimal(8,2) DEFAULT '0.00' COMMENT '体积',
  `quota` int NOT NULL DEFAULT '0' COMMENT '限购总数',
  `quota_show` int NOT NULL DEFAULT '0' COMMENT '限量总数显示',
  `people_num` int DEFAULT NULL COMMENT '砍价人数——需要多少人砍价成功',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='砍价表';

-- ----------------------------
-- Table structure for eb_store_bargain_user
-- ----------------------------
DROP TABLE IF EXISTS `eb_store_bargain_user`;
CREATE TABLE `eb_store_bargain_user` (
  `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT '用户参与砍价表ID',
  `uid` int unsigned DEFAULT NULL COMMENT '用户ID',
  `bargain_id` int unsigned DEFAULT NULL COMMENT '砍价商品id',
  `bargain_price_min` decimal(8,2) unsigned DEFAULT NULL COMMENT '砍价的最低价',
  `bargain_price` decimal(8,2) DEFAULT NULL COMMENT '砍价金额',
  `price` decimal(8,2) unsigned DEFAULT NULL COMMENT '砍掉的价格',
  `status` tinyint unsigned NOT NULL DEFAULT '0' COMMENT '状态 1参与中 2 活动结束参与失败 3活动结束参与成功',
  `add_time` bigint unsigned DEFAULT NULL COMMENT '参与时间',
  `is_del` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否取消',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='用户参与砍价表';

-- ----------------------------
-- Table structure for eb_store_bargain_user_help
-- ----------------------------
DROP TABLE IF EXISTS `eb_store_bargain_user_help`;
CREATE TABLE `eb_store_bargain_user_help` (
  `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT '砍价用户帮助表ID',
  `uid` int unsigned DEFAULT NULL COMMENT '帮助的用户id',
  `bargain_id` int unsigned DEFAULT NULL COMMENT '砍价商品ID',
  `bargain_user_id` int unsigned DEFAULT NULL COMMENT '用户参与砍价表id',
  `price` decimal(8,2) unsigned DEFAULT NULL COMMENT '帮助砍价多少金额',
  `add_time` bigint unsigned DEFAULT NULL COMMENT '添加时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='砍价用户帮助表';

-- ----------------------------
-- Table structure for eb_store_cart
-- ----------------------------
DROP TABLE IF EXISTS `eb_store_cart`;
CREATE TABLE `eb_store_cart` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '购物车表ID',
  `uid` int unsigned NOT NULL COMMENT '用户ID',
  `type` varchar(32) NOT NULL COMMENT '类型',
  `product_id` int unsigned NOT NULL COMMENT '商品ID',
  `product_attr_unique` varchar(16) NOT NULL DEFAULT '' COMMENT '商品属性',
  `cart_num` smallint unsigned NOT NULL DEFAULT '0' COMMENT '商品数量',
  `is_new` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否为立即购买',
  `combination_id` int unsigned DEFAULT '0' COMMENT '拼团id',
  `seckill_id` int unsigned NOT NULL DEFAULT '0' COMMENT '秒杀商品ID',
  `bargain_id` int unsigned NOT NULL DEFAULT '0' COMMENT '砍价id',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间',
  `update_time` timestamp NULL DEFAULT NULL COMMENT 'g',
  `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '购物车状态',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `user_id` (`uid`) USING BTREE,
  KEY `goods_id` (`product_id`) USING BTREE,
  KEY `uid` (`uid`) USING BTREE,
  KEY `uid_2` (`uid`) USING BTREE,
  KEY `uid_3` (`uid`,`is_new`) USING BTREE,
  KEY `type` (`type`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=COMPACT COMMENT='购物车表';

-- ----------------------------
-- Table structure for eb_store_combination
-- ----------------------------
DROP TABLE IF EXISTS `eb_store_combination`;
CREATE TABLE `eb_store_combination` (
  `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT '拼团商品ID',
  `product_id` int unsigned NOT NULL COMMENT '商品id',
  `mer_id` int unsigned DEFAULT '0' COMMENT '商户id',
  `image` varchar(255) NOT NULL COMMENT '推荐图',
  `images` varchar(2000) NOT NULL COMMENT '轮播图',
  `title` varchar(255) NOT NULL COMMENT '活动标题',
  `attr` varchar(255) DEFAULT NULL COMMENT '活动属性',
  `people` int unsigned NOT NULL COMMENT '参团人数',
  `info` varchar(255) NOT NULL COMMENT '简介',
  `price` decimal(10,2) unsigned NOT NULL COMMENT '价格',
  `sort` int unsigned NOT NULL DEFAULT '0' COMMENT '排序',
  `sales` int unsigned NOT NULL DEFAULT '0' COMMENT '销量',
  `stock` int unsigned NOT NULL COMMENT '库存',
  `add_time` bigint NOT NULL COMMENT '添加时间',
  `is_host` tinyint unsigned NOT NULL DEFAULT '0' COMMENT '推荐',
  `is_show` tinyint unsigned NOT NULL COMMENT '商品状态',
  `is_del` tinyint unsigned NOT NULL DEFAULT '0',
  `combination` tinyint unsigned DEFAULT '1',
  `mer_use` tinyint unsigned DEFAULT NULL COMMENT '商户是否可用1可用0不可用',
  `is_postage` tinyint unsigned DEFAULT NULL COMMENT '是否包邮1是0否',
  `postage` decimal(10,2) unsigned DEFAULT NULL COMMENT '邮费',
  `start_time` bigint unsigned NOT NULL COMMENT '拼团开始时间',
  `stop_time` bigint unsigned NOT NULL COMMENT '拼团结束时间',
  `effective_time` int NOT NULL DEFAULT '0' COMMENT '拼团订单有效时间(小时)',
  `cost` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '拼图商品成本',
  `browse` int DEFAULT '0' COMMENT '浏览量',
  `unit_name` varchar(32) NOT NULL DEFAULT '' COMMENT '单位名',
  `temp_id` int NOT NULL COMMENT '运费模板ID',
  `weight` decimal(8,2) DEFAULT '0.00' COMMENT '重量',
  `volume` decimal(8,2) DEFAULT '0.00' COMMENT '体积',
  `num` int DEFAULT NULL COMMENT '单次购买数量',
  `quota` int NOT NULL DEFAULT '0' COMMENT '限购总数',
  `quota_show` int NOT NULL DEFAULT '0' COMMENT '限量总数显示',
  `ot_price` decimal(10,2) NOT NULL COMMENT '原价',
  `once_num` int NOT NULL DEFAULT '0' COMMENT '每个订单可购买数量',
  `virtual_ration` int NOT NULL DEFAULT '100' COMMENT '虚拟成团百分比',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='拼团商品表';

-- ----------------------------
-- Table structure for eb_store_coupon
-- ----------------------------
DROP TABLE IF EXISTS `eb_store_coupon`;
CREATE TABLE `eb_store_coupon` (
  `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT '优惠券表ID',
  `name` varchar(64) NOT NULL DEFAULT '' COMMENT '优惠券名称',
  `money` decimal(8,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '兑换的优惠券面值',
  `is_limited` tinyint(1) DEFAULT '0' COMMENT '是否限量, 默认0 不限量， 1限量',
  `total` int NOT NULL DEFAULT '0' COMMENT '发放总数',
  `last_total` int DEFAULT '0' COMMENT '剩余数量',
  `use_type` tinyint NOT NULL DEFAULT '1' COMMENT '使用类型 1 全场通用, 2 商品券, 3 品类券',
  `primary_key` varchar(255) NOT NULL DEFAULT '' COMMENT '所属商品id / 分类id',
  `min_price` decimal(8,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '最低消费，0代表不限制',
  `receive_start_time` timestamp NOT NULL COMMENT '可领取开始时间',
  `receive_end_time` timestamp NULL DEFAULT NULL COMMENT '可领取结束时间',
  `is_fixed_time` tinyint(1) DEFAULT '0' COMMENT '是否固定使用时间, 默认0 否， 1是',
  `use_start_time` timestamp NULL DEFAULT NULL COMMENT '可使用时间范围 开始时间',
  `use_end_time` timestamp NULL DEFAULT NULL COMMENT '可使用时间范围 结束时间',
  `day` int DEFAULT '0' COMMENT '天数',
  `type` tinyint NOT NULL DEFAULT '1' COMMENT '优惠券类型 1 手动领取, 2 新人券, 3 赠送券',
  `sort` int unsigned NOT NULL DEFAULT '1' COMMENT '排序',
  `status` tinyint unsigned NOT NULL DEFAULT '1' COMMENT '状态（0：关闭，1：开启）',
  `is_del` tinyint unsigned NOT NULL DEFAULT '0' COMMENT '是否删除 状态（0：否，1：是）',
  `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `state` (`status`) USING BTREE,
  KEY `is_del` (`is_del`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='优惠券表';

-- ----------------------------
-- Table structure for eb_store_coupon_user
-- ----------------------------
DROP TABLE IF EXISTS `eb_store_coupon_user`;
CREATE TABLE `eb_store_coupon_user` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT 'id',
  `coupon_id` int NOT NULL COMMENT '优惠券发布id',
  `cid` int unsigned NOT NULL DEFAULT '0' COMMENT '兑换的项目id',
  `uid` int unsigned NOT NULL DEFAULT '0' COMMENT '领取人id',
  `name` varchar(32) NOT NULL DEFAULT '' COMMENT '优惠券名称',
  `money` decimal(8,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '优惠券的面值',
  `min_price` decimal(8,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '最低消费多少金额可用优惠券',
  `type` varchar(32) NOT NULL DEFAULT 'send' COMMENT '获取方式，send后台发放, 用户领取 get',
  `status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '状态（0：未使用，1：已使用, 2:已失效）',
  `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `start_time` timestamp NULL DEFAULT NULL COMMENT '开始使用时间',
  `end_time` timestamp NULL DEFAULT NULL COMMENT '过期时间',
  `use_time` timestamp NULL DEFAULT NULL COMMENT '使用时间',
  `use_type` tinyint(1) DEFAULT '1' COMMENT '使用类型 1 全场通用, 2 商品券, 3 品类券',
  `primary_key` varchar(255) DEFAULT NULL COMMENT '所属商品id / 分类id',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `cid` (`cid`) USING BTREE,
  KEY `uid` (`uid`) USING BTREE,
  KEY `end_time` (`end_time`) USING BTREE,
  KEY `status` (`status`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='优惠券记录表';

-- ----------------------------
-- Table structure for eb_store_order
-- ----------------------------
DROP TABLE IF EXISTS `eb_store_order`;
CREATE TABLE `eb_store_order` (
  `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT '订单ID',
  `order_id` varchar(32) NOT NULL COMMENT '订单号',
  `uid` int unsigned NOT NULL COMMENT '用户id',
  `real_name` varchar(32) NOT NULL COMMENT '用户姓名',
  `user_phone` varchar(18) NOT NULL COMMENT '用户电话',
  `user_address` varchar(100) NOT NULL COMMENT '详细地址',
  `freight_price` decimal(8,2) NOT NULL DEFAULT '0.00' COMMENT '运费金额',
  `total_num` int unsigned NOT NULL DEFAULT '0' COMMENT '订单商品总数',
  `total_price` decimal(8,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '订单总价',
  `total_postage` decimal(8,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '邮费',
  `pay_price` decimal(8,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '实际支付金额',
  `pay_postage` decimal(8,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '支付邮费',
  `deduction_price` decimal(8,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '抵扣金额',
  `coupon_id` int unsigned NOT NULL DEFAULT '0' COMMENT '优惠券id',
  `coupon_price` decimal(8,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '优惠券金额',
  `paid` tinyint unsigned NOT NULL DEFAULT '0' COMMENT '支付状态',
  `pay_time` timestamp NULL DEFAULT NULL COMMENT '支付时间',
  `pay_type` varchar(32) NOT NULL DEFAULT '' COMMENT '支付方式',
  `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '订单状态（0：待发货；1：待收货；2：已收货，待评价；3：已完成；）',
  `refund_status` tinyint unsigned NOT NULL DEFAULT '0' COMMENT '0 未退款 1 申请中 2 已退款 3 退款中',
  `refund_reason_wap_img` varchar(5000) DEFAULT NULL COMMENT '退款图片',
  `refund_reason_wap_explain` varchar(255) DEFAULT NULL COMMENT '退款用户说明',
  `refund_reason_wap` varchar(255) DEFAULT NULL COMMENT '前台退款原因',
  `refund_reason` varchar(255) DEFAULT NULL COMMENT '不退款的理由',
  `refund_reason_time` timestamp NULL DEFAULT NULL COMMENT '退款时间',
  `refund_price` decimal(8,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '退款金额',
  `delivery_name` varchar(64) DEFAULT NULL COMMENT '快递名称/送货人姓名',
  `delivery_type` varchar(32) DEFAULT NULL COMMENT '发货类型',
  `delivery_id` varchar(64) DEFAULT NULL COMMENT '快递单号/手机号',
  `gain_integral` int DEFAULT '0' COMMENT '消费赚取积分',
  `use_integral` int DEFAULT '0' COMMENT '使用积分',
  `back_integral` int DEFAULT '0' COMMENT '给用户退了多少积分',
  `mark` varchar(512) NOT NULL COMMENT '备注',
  `is_del` tinyint unsigned NOT NULL DEFAULT '0' COMMENT '是否删除',
  `remark` varchar(512) DEFAULT NULL COMMENT '管理员备注',
  `mer_id` int unsigned NOT NULL DEFAULT '0' COMMENT '商户ID',
  `is_mer_check` tinyint unsigned NOT NULL DEFAULT '0',
  `combination_id` int unsigned DEFAULT '0' COMMENT '拼团商品id0一般商品',
  `pink_id` int unsigned NOT NULL DEFAULT '0' COMMENT '拼团id 0没有拼团',
  `cost` decimal(8,2) unsigned NOT NULL COMMENT '成本价',
  `seckill_id` int unsigned NOT NULL DEFAULT '0' COMMENT '秒杀商品ID',
  `bargain_id` int unsigned DEFAULT '0' COMMENT '砍价id',
  `verify_code` varchar(12) NOT NULL DEFAULT '' COMMENT '核销码',
  `store_id` int NOT NULL DEFAULT '0' COMMENT '门店id',
  `shipping_type` tinyint(1) NOT NULL DEFAULT '1' COMMENT '配送方式 1=快递 ，2=门店自提',
  `clerk_id` int NOT NULL DEFAULT '0' COMMENT '店员id/核销员id',
  `is_channel` tinyint unsigned DEFAULT '0' COMMENT '支付渠道(0微信公众号1微信小程序2余额)',
  `is_remind` tinyint unsigned DEFAULT '0' COMMENT '消息提醒',
  `is_system_del` tinyint(1) DEFAULT '0' COMMENT '后台是否删除',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `delivery_code` varchar(50) DEFAULT NULL COMMENT '快递公司简称',
  `bargain_user_id` int unsigned NOT NULL DEFAULT '0' COMMENT '用户拼团活动id 0没有',
  `type` int NOT NULL DEFAULT '0' COMMENT '订单类型:0-普通订单，1-视频号订单',
  `pro_total_price` decimal(8,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '商品总价',
  `before_pay_price` decimal(8,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '改价前支付金额',
  `is_alter_price` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否改价,0-否，1-是',
  `out_trade_no` varchar(32) DEFAULT NULL COMMENT '商户系统内部的订单号,32个字符内、可包含字母, 其他说明见商户订单号',
  `shipment_pic` varchar(255) DEFAULT NULL COMMENT '商家寄件单号图片',
  `shipment_task_id` varchar(64) DEFAULT NULL COMMENT '商家寄件订单任务id',
  `shipment_order_id` varchar(64) DEFAULT NULL COMMENT '商家寄件订单单号',
  `shipment_num` varchar(64) DEFAULT NULL COMMENT '商家寄件快递单号',
  `express_record_type` int DEFAULT NULL COMMENT '发货记录类型，1快递、2送货, 3虚拟发货',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE KEY `order_id_2` (`order_id`,`uid`) USING BTREE,
  KEY `uid` (`uid`) USING BTREE,
  KEY `add_time` (`create_time`) USING BTREE,
  KEY `pay_price` (`pay_price`) USING BTREE,
  KEY `paid` (`paid`) USING BTREE,
  KEY `pay_time` (`pay_time`) USING BTREE,
  KEY `pay_type` (`pay_type`) USING BTREE,
  KEY `status` (`status`) USING BTREE,
  KEY `is_del` (`is_del`) USING BTREE,
  KEY `coupon_id` (`coupon_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=45 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='订单表';

-- ----------------------------
-- Table structure for eb_store_order_info
-- ----------------------------
DROP TABLE IF EXISTS `eb_store_order_info`;
CREATE TABLE `eb_store_order_info` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
  `order_id` int unsigned NOT NULL COMMENT '订单id',
  `product_id` int unsigned NOT NULL DEFAULT '0' COMMENT '商品ID',
  `info` text NOT NULL COMMENT '购买东西的详细信息',
  `unique` char(32) NOT NULL COMMENT '唯一id',
  `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间',
  `order_no` varchar(32) NOT NULL COMMENT '订单号',
  `product_name` varchar(128) NOT NULL COMMENT '商品名称',
  `attr_value_id` int unsigned DEFAULT NULL COMMENT '规格属性值id',
  `image` varchar(256) NOT NULL COMMENT '商品图片',
  `sku` varchar(128) NOT NULL COMMENT '商品sku',
  `price` decimal(8,2) unsigned NOT NULL COMMENT '商品价格',
  `pay_num` int unsigned NOT NULL DEFAULT '0' COMMENT '购买数量',
  `weight` decimal(8,2) unsigned NOT NULL COMMENT '重量',
  `volume` decimal(8,2) unsigned NOT NULL COMMENT '体积',
  `give_integral` int unsigned NOT NULL COMMENT '赠送积分',
  `is_reply` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否评价，0-未评价，1-已评价',
  `is_sub` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否单独分佣,0-否，1-是',
  `vip_price` decimal(8,2) unsigned NOT NULL COMMENT '会员价',
  `product_type` int NOT NULL DEFAULT '0' COMMENT '商品类型:0-普通，1-秒杀，2-砍价，3-拼团，4-视频号',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE KEY `oid` (`order_id`,`unique`) USING BTREE,
  KEY `product_id` (`product_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=45 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='订单购物详情表';

-- ----------------------------
-- Table structure for eb_store_order_status
-- ----------------------------
DROP TABLE IF EXISTS `eb_store_order_status`;
CREATE TABLE `eb_store_order_status` (
  `oid` int unsigned NOT NULL COMMENT '订单id',
  `change_type` varchar(32) NOT NULL COMMENT '操作类型',
  `change_message` varchar(256) NOT NULL COMMENT '操作备注',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '操作时间',
  KEY `oid` (`oid`) USING BTREE,
  KEY `change_type` (`change_type`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='订单操作记录表';

-- ----------------------------
-- Table structure for eb_store_pink
-- ----------------------------
DROP TABLE IF EXISTS `eb_store_pink`;
CREATE TABLE `eb_store_pink` (
  `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT '拼团ID',
  `uid` int unsigned NOT NULL COMMENT '用户id',
  `order_id` varchar(32) NOT NULL COMMENT '订单id 生成',
  `order_id_key` int unsigned NOT NULL COMMENT '订单id  数据库',
  `total_num` int unsigned NOT NULL COMMENT '购买商品个数',
  `total_price` decimal(10,2) unsigned NOT NULL COMMENT '购买总金额',
  `cid` int unsigned NOT NULL COMMENT '拼团商品id',
  `pid` int unsigned NOT NULL COMMENT '商品id',
  `people` int unsigned NOT NULL COMMENT '拼图总人数',
  `price` decimal(10,2) unsigned NOT NULL COMMENT '拼团商品单价',
  `add_time` bigint NOT NULL COMMENT '开始时间',
  `stop_time` bigint NOT NULL COMMENT '结束时间',
  `k_id` int unsigned NOT NULL DEFAULT '0' COMMENT '团长id 0为团长',
  `is_tpl` tinyint unsigned NOT NULL DEFAULT '0' COMMENT '是否发送模板消息0未发送1已发送',
  `is_refund` tinyint unsigned NOT NULL DEFAULT '0' COMMENT '是否退款 0未退款 1已退款',
  `status` tinyint unsigned NOT NULL DEFAULT '1' COMMENT '状态1进行中2已完成3未完成',
  `is_virtual` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否虚拟拼团',
  `nickname` varchar(64) NOT NULL DEFAULT '' COMMENT '用户昵称',
  `avatar` varchar(256) NOT NULL DEFAULT '' COMMENT '用户头像',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='拼团表';

-- ----------------------------
-- Table structure for eb_store_product
-- ----------------------------
DROP TABLE IF EXISTS `eb_store_product`;
CREATE TABLE `eb_store_product` (
  `id` mediumint NOT NULL AUTO_INCREMENT COMMENT '商品id',
  `mer_id` int unsigned NOT NULL DEFAULT '0' COMMENT '商户Id(0为总后台管理员创建,不为0的时候是商户后台创建)',
  `image` varchar(256) NOT NULL COMMENT '商品图片',
  `slider_image` varchar(2000) NOT NULL COMMENT '轮播图',
  `store_name` varchar(128) NOT NULL COMMENT '商品名称',
  `store_info` varchar(256) NOT NULL COMMENT '商品简介',
  `keyword` varchar(256) NOT NULL COMMENT '关键字',
  `bar_code` varchar(15) NOT NULL DEFAULT '' COMMENT '商品条码（一维码）',
  `cate_id` varchar(64) NOT NULL COMMENT '分类id',
  `price` decimal(8,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '商品价格',
  `vip_price` decimal(8,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '会员价格',
  `ot_price` decimal(8,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '市场价',
  `postage` decimal(8,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '邮费',
  `unit_name` varchar(32) NOT NULL COMMENT '单位名',
  `sort` smallint NOT NULL DEFAULT '0' COMMENT '排序',
  `sales` mediumint unsigned NOT NULL DEFAULT '0' COMMENT '销量',
  `stock` mediumint unsigned NOT NULL DEFAULT '0' COMMENT '库存',
  `is_show` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态（0：未上架，1：上架）',
  `is_hot` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否热卖',
  `is_benefit` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否优惠',
  `is_best` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否精品',
  `is_new` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否新品',
  `add_time` int unsigned NOT NULL COMMENT '添加时间',
  `is_postage` tinyint unsigned NOT NULL DEFAULT '0' COMMENT '是否包邮',
  `is_del` tinyint unsigned NOT NULL DEFAULT '0' COMMENT '是否删除',
  `mer_use` tinyint unsigned NOT NULL DEFAULT '0' COMMENT '商户是否代理 0不可代理1可代理',
  `give_integral` int DEFAULT '0' COMMENT '获得积分',
  `cost` decimal(8,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '成本价',
  `is_seckill` tinyint unsigned NOT NULL DEFAULT '0' COMMENT '秒杀状态 0 未开启 1已开启',
  `is_bargain` tinyint unsigned DEFAULT NULL COMMENT '砍价状态 0未开启 1开启',
  `is_good` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否优品推荐',
  `is_sub` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否单独分佣',
  `ficti` mediumint DEFAULT '100' COMMENT '虚拟销量',
  `browse` int DEFAULT '0' COMMENT '浏览量',
  `code_path` varchar(64) NOT NULL DEFAULT '' COMMENT '商品二维码地址(用户小程序海报)',
  `soure_link` varchar(255) DEFAULT '' COMMENT '淘宝京东1688类型',
  `video_link` varchar(200) NOT NULL DEFAULT '' COMMENT '主图视频链接',
  `temp_id` int NOT NULL DEFAULT '1' COMMENT '运费模板ID',
  `spec_type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '规格 0单 1多',
  `activity` varchar(255) NOT NULL DEFAULT '' COMMENT '活动显示排序0=默认, 1=秒杀，2=砍价，3=拼团',
  `flat_pattern` varchar(1000) NOT NULL DEFAULT '' COMMENT '展示图',
  `is_recycle` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否回收站',
  `version` int NOT NULL DEFAULT '0' COMMENT '并发版本控制',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `cate_id` (`cate_id`) USING BTREE,
  KEY `is_hot` (`is_hot`) USING BTREE,
  KEY `is_benefit` (`is_benefit`) USING BTREE,
  KEY `is_best` (`is_best`) USING BTREE,
  KEY `is_new` (`is_new`) USING BTREE,
  KEY `toggle_on_sale, is_del` (`is_del`) USING BTREE,
  KEY `price` (`price`) USING BTREE,
  KEY `is_show` (`is_show`) USING BTREE,
  KEY `sort` (`sort`) USING BTREE,
  KEY `sales` (`sales`) USING BTREE,
  KEY `add_time` (`add_time`) USING BTREE,
  KEY `is_postage` (`is_postage`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=64 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=COMPACT COMMENT='商品表';

-- ----------------------------
-- Table structure for eb_store_product_attr
-- ----------------------------
DROP TABLE IF EXISTS `eb_store_product_attr`;
CREATE TABLE `eb_store_product_attr` (
  `id` mediumint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `product_id` int unsigned NOT NULL DEFAULT '0' COMMENT '商品ID',
  `attr_name` varchar(32) NOT NULL COMMENT '属性名',
  `attr_values` varchar(1000) NOT NULL COMMENT '属性值',
  `type` tinyint(1) DEFAULT '0' COMMENT '活动类型 0=商品，1=秒杀，2=砍价，3=拼团',
  `is_del` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除,0-否，1-是',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `store_id` (`product_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=105 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=COMPACT COMMENT='商品属性表';

-- ----------------------------
-- Table structure for eb_store_product_attr_result
-- ----------------------------
DROP TABLE IF EXISTS `eb_store_product_attr_result`;
CREATE TABLE `eb_store_product_attr_result` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
  `product_id` int unsigned NOT NULL COMMENT '商品ID',
  `result` longtext NOT NULL COMMENT '商品属性参数',
  `change_time` int unsigned NOT NULL COMMENT '上次修改时间',
  `type` tinyint(1) DEFAULT '0' COMMENT '活动类型 0=商品，1=秒杀，2=砍价，3=拼团',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `product_id` (`product_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=COMPACT COMMENT='商品属性详情表';

-- ----------------------------
-- Table structure for eb_store_product_attr_value
-- ----------------------------
DROP TABLE IF EXISTS `eb_store_product_attr_value`;
CREATE TABLE `eb_store_product_attr_value` (
  `id` mediumint NOT NULL AUTO_INCREMENT COMMENT '主键',
  `product_id` int unsigned NOT NULL COMMENT '商品ID',
  `suk` varchar(128) NOT NULL COMMENT '商品属性索引值 (attr_value|attr_value[|....])',
  `stock` int unsigned NOT NULL COMMENT '属性对应的库存',
  `sales` int unsigned NOT NULL DEFAULT '0' COMMENT '销量',
  `price` decimal(8,2) unsigned NOT NULL COMMENT '属性金额',
  `image` varchar(1000) DEFAULT NULL COMMENT '图片',
  `unique` char(8) NOT NULL DEFAULT '' COMMENT '唯一值',
  `cost` decimal(8,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '成本价',
  `bar_code` varchar(50) NOT NULL DEFAULT '' COMMENT '商品条码',
  `ot_price` decimal(8,2) NOT NULL DEFAULT '0.00' COMMENT '原价',
  `weight` decimal(8,2) NOT NULL DEFAULT '0.00' COMMENT '重量',
  `volume` decimal(8,2) NOT NULL DEFAULT '0.00' COMMENT '体积',
  `brokerage` decimal(8,2) NOT NULL DEFAULT '0.00' COMMENT '一级返佣',
  `brokerage_two` decimal(8,2) NOT NULL DEFAULT '0.00' COMMENT '二级返佣',
  `type` tinyint(1) DEFAULT '0' COMMENT '活动类型 0=商品，1=秒杀，2=砍价，3=拼团',
  `quota` int DEFAULT NULL COMMENT '活动限购数量',
  `quota_show` int DEFAULT NULL COMMENT '活动限购数量显示',
  `attr_value` text COMMENT 'attr_values 创建更新时的属性对应',
  `is_del` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除,0-否，1-是',
  `version` int NOT NULL DEFAULT '0' COMMENT '并发版本控制',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `unique` (`unique`,`suk`) USING BTREE,
  KEY `store_id` (`product_id`,`suk`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=167 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='商品属性值表';

-- ----------------------------
-- Table structure for eb_store_product_cate
-- ----------------------------
DROP TABLE IF EXISTS `eb_store_product_cate`;
CREATE TABLE `eb_store_product_cate` (
  `id` int NOT NULL AUTO_INCREMENT,
  `product_id` int NOT NULL DEFAULT '0' COMMENT '商品id',
  `cate_id` int NOT NULL DEFAULT '0' COMMENT '分类id',
  `add_time` int NOT NULL DEFAULT '0' COMMENT '添加时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=COMPACT COMMENT='商品分类辅助表';

-- ----------------------------
-- Table structure for eb_store_product_coupon
-- ----------------------------
DROP TABLE IF EXISTS `eb_store_product_coupon`;
CREATE TABLE `eb_store_product_coupon` (
  `id` int NOT NULL AUTO_INCREMENT,
  `product_id` int NOT NULL DEFAULT '0' COMMENT '商品id',
  `issue_coupon_id` int NOT NULL DEFAULT '0' COMMENT '优惠劵id',
  `add_time` int NOT NULL DEFAULT '0' COMMENT '添加时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=COMPACT COMMENT='商品优惠券表';

-- ----------------------------
-- Table structure for eb_store_product_description
-- ----------------------------
DROP TABLE IF EXISTS `eb_store_product_description`;
CREATE TABLE `eb_store_product_description` (
  `product_id` int NOT NULL DEFAULT '0' COMMENT '商品ID',
  `description` text NOT NULL COMMENT '商品详情',
  `type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '商品类型',
  `id` int unsigned NOT NULL AUTO_INCREMENT,
  PRIMARY KEY (`id`) USING BTREE,
  KEY `product_id` (`product_id`,`type`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=146 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=COMPACT COMMENT='商品描述表';

-- ----------------------------
-- Table structure for eb_store_product_log
-- ----------------------------
DROP TABLE IF EXISTS `eb_store_product_log`;
CREATE TABLE `eb_store_product_log` (
  `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT '统计ID',
  `type` varchar(10) NOT NULL COMMENT '类型visit,cart,order,pay,collect,refund',
  `product_id` int NOT NULL DEFAULT '0' COMMENT '商品ID',
  `uid` int NOT NULL DEFAULT '0' COMMENT '用户ID',
  `visit_num` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否浏览',
  `cart_num` int NOT NULL DEFAULT '0' COMMENT '加入购物车数量',
  `order_num` int NOT NULL DEFAULT '0' COMMENT '下单数量',
  `pay_num` int NOT NULL DEFAULT '0' COMMENT '支付数量',
  `pay_price` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '支付金额',
  `cost_price` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '商品成本价',
  `pay_uid` int NOT NULL DEFAULT '0' COMMENT '支付用户ID',
  `refund_num` int NOT NULL DEFAULT '0' COMMENT '退款数量',
  `refund_price` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '退款金额',
  `collect_num` tinyint(1) NOT NULL DEFAULT '0' COMMENT '收藏',
  `add_time` bigint NOT NULL DEFAULT '0' COMMENT '添加时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='商品日志表';

-- ----------------------------
-- Table structure for eb_store_product_relation
-- ----------------------------
DROP TABLE IF EXISTS `eb_store_product_relation`;
CREATE TABLE `eb_store_product_relation` (
  `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
  `uid` int unsigned NOT NULL COMMENT '用户ID',
  `product_id` int unsigned NOT NULL COMMENT '商品ID',
  `type` varchar(32) NOT NULL COMMENT '类型(收藏(collect）、点赞(like))',
  `category` varchar(32) NOT NULL COMMENT '某种类型的商品(普通商品、秒杀商品)',
  `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE KEY `uid` (`uid`,`product_id`,`type`,`category`) USING BTREE,
  KEY `type` (`type`) USING BTREE,
  KEY `category` (`category`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='商品点赞和收藏表';

-- ----------------------------
-- Table structure for eb_store_product_reply
-- ----------------------------
DROP TABLE IF EXISTS `eb_store_product_reply`;
CREATE TABLE `eb_store_product_reply` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '评论ID',
  `uid` int NOT NULL DEFAULT '0' COMMENT '用户ID',
  `oid` int NOT NULL DEFAULT '0' COMMENT '订单ID',
  `unique` varchar(32) NOT NULL COMMENT '商品唯一id',
  `product_id` int NOT NULL COMMENT '商品id',
  `reply_type` varchar(32) NOT NULL DEFAULT 'product' COMMENT '某种商品类型(普通商品、秒杀商品）',
  `product_score` tinyint(1) NOT NULL COMMENT '商品分数',
  `service_score` tinyint(1) NOT NULL COMMENT '服务分数',
  `comment` varchar(512) NOT NULL COMMENT '评论内容',
  `pics` text NOT NULL COMMENT '评论图片',
  `merchant_reply_content` varchar(300) DEFAULT NULL COMMENT '管理员回复内容',
  `merchant_reply_time` int DEFAULT NULL COMMENT '管理员回复时间',
  `is_del` tinyint unsigned NOT NULL DEFAULT '0' COMMENT '0未删除1已删除',
  `is_reply` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0未回复1已回复',
  `nickname` varchar(64) NOT NULL COMMENT '用户名称',
  `avatar` varchar(255) NOT NULL COMMENT '用户头像',
  `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `sku` varchar(128) NOT NULL DEFAULT '' COMMENT '商品规格属性值,多个,号隔开',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `parent_id` (`reply_type`) USING BTREE,
  KEY `is_del` (`is_del`) USING BTREE,
  KEY `product_score` (`product_score`) USING BTREE,
  KEY `service_score` (`service_score`) USING BTREE,
  KEY `uid+oid` (`uid`,`oid`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=COMPACT COMMENT='评论表';

-- ----------------------------
-- Table structure for eb_store_product_rule
-- ----------------------------
DROP TABLE IF EXISTS `eb_store_product_rule`;
CREATE TABLE `eb_store_product_rule` (
  `id` int NOT NULL AUTO_INCREMENT,
  `rule_name` varchar(32) NOT NULL COMMENT '规格名称',
  `rule_value` text NOT NULL COMMENT '规格值',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=31 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=COMPACT COMMENT='商品规则值(规格)表';

-- ----------------------------
-- Table structure for eb_store_seckill
-- ----------------------------
DROP TABLE IF EXISTS `eb_store_seckill`;
CREATE TABLE `eb_store_seckill` (
  `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT '商品秒杀产品表id',
  `product_id` int unsigned NOT NULL COMMENT '商品id',
  `image` varchar(255) NOT NULL COMMENT '推荐图',
  `images` varchar(2000) NOT NULL COMMENT '轮播图',
  `title` varchar(255) NOT NULL COMMENT '活动标题',
  `info` varchar(255) NOT NULL COMMENT '简介',
  `price` decimal(10,2) unsigned NOT NULL COMMENT '价格',
  `cost` decimal(8,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '成本',
  `ot_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '原价',
  `give_integral` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '返多少积分',
  `sort` int unsigned NOT NULL DEFAULT '0' COMMENT '排序',
  `stock` int unsigned NOT NULL COMMENT '库存',
  `sales` int unsigned NOT NULL DEFAULT '0' COMMENT '销量',
  `unit_name` varchar(16) NOT NULL COMMENT '单位名',
  `postage` decimal(8,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '邮费',
  `description` text COMMENT '内容',
  `start_time` datetime NOT NULL COMMENT '开始时间',
  `stop_time` datetime NOT NULL COMMENT '结束时间',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间',
  `status` tinyint unsigned NOT NULL COMMENT '秒杀状态 0=关闭 1=开启',
  `is_postage` tinyint unsigned NOT NULL DEFAULT '0' COMMENT '是否包邮',
  `is_del` tinyint unsigned NOT NULL DEFAULT '0' COMMENT '删除 0未删除1已删除',
  `num` int unsigned NOT NULL COMMENT '当天参与活动次数',
  `is_show` tinyint unsigned NOT NULL DEFAULT '1' COMMENT '显示',
  `time_id` int DEFAULT NULL COMMENT '时间段ID',
  `temp_id` int NOT NULL DEFAULT '0' COMMENT '运费模板ID',
  `weight` decimal(8,2) NOT NULL DEFAULT '0.00' COMMENT '重量',
  `volume` decimal(8,2) NOT NULL DEFAULT '0.00' COMMENT '体积',
  `quota` int NOT NULL DEFAULT '0' COMMENT '限购总数,随减',
  `quota_show` int NOT NULL DEFAULT '0' COMMENT '限购总数显示.不变',
  `spec_type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '规格 0=单 1=多',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `product_id` (`product_id`) USING BTREE,
  KEY `start_time` (`start_time`,`stop_time`) USING BTREE,
  KEY `is_del` (`is_del`) USING BTREE,
  KEY `is_show` (`status`) USING BTREE,
  KEY `add_time` (`create_time`) USING BTREE,
  KEY `sort` (`sort`) USING BTREE,
  KEY `is_postage` (`is_postage`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='商品秒杀产品表';

-- ----------------------------
-- Table structure for eb_store_seckill_manger
-- ----------------------------
DROP TABLE IF EXISTS `eb_store_seckill_manger`;
CREATE TABLE `eb_store_seckill_manger` (
  `id` int unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) DEFAULT NULL COMMENT '秒杀名称',
  `start_time` int DEFAULT NULL COMMENT '秒杀开始时间段',
  `end_time` int DEFAULT NULL COMMENT '秒杀结束时间段',
  `img` text COMMENT '主图',
  `silder_imgs` text COMMENT '轮播图',
  `sort` int DEFAULT NULL COMMENT '排序',
  `status` int DEFAULT NULL COMMENT '状态 0=关闭 1=开启',
  `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `is_del` int NOT NULL DEFAULT '0' COMMENT '删除标记 0=为删除 1=删除',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;

-- ----------------------------
-- Table structure for eb_system_admin
-- ----------------------------
DROP TABLE IF EXISTS `eb_system_admin`;
CREATE TABLE `eb_system_admin` (
  `id` smallint unsigned NOT NULL AUTO_INCREMENT COMMENT '后台管理员表ID',
  `account` varchar(32) NOT NULL COMMENT '后台管理员账号',
  `pwd` char(32) NOT NULL COMMENT '后台管理员密码',
  `real_name` varchar(16) NOT NULL COMMENT '后台管理员姓名',
  `roles` varchar(128) NOT NULL COMMENT '后台管理员权限(menus_id)',
  `last_ip` varchar(16) DEFAULT NULL COMMENT '后台管理员最后一次登录ip',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '后台管理员最后一次登录时间',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '后台管理员添加时间',
  `login_count` int unsigned NOT NULL DEFAULT '0' COMMENT '登录次数',
  `level` tinyint unsigned NOT NULL DEFAULT '1' COMMENT '后台管理员级别',
  `status` tinyint unsigned NOT NULL DEFAULT '1' COMMENT '后台管理员状态 1有效0无效',
  `is_del` tinyint unsigned NOT NULL DEFAULT '0',
  `phone` varchar(15) DEFAULT NULL COMMENT '手机号码',
  `is_sms` tinyint unsigned DEFAULT '0' COMMENT '是否接收短信',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `account` (`account`) USING BTREE,
  KEY `status` (`status`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='后台管理员表';

-- ----------------------------
-- Table structure for eb_system_attachment
-- ----------------------------
DROP TABLE IF EXISTS `eb_system_attachment`;
CREATE TABLE `eb_system_attachment` (
  `att_id` int NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL DEFAULT '' COMMENT '附件名称',
  `att_dir` varchar(200) NOT NULL DEFAULT '' COMMENT '附件路径',
  `satt_dir` varchar(200) DEFAULT NULL COMMENT '压缩图片路径',
  `att_size` char(30) NOT NULL DEFAULT '' COMMENT '附件大小',
  `att_type` char(30) NOT NULL DEFAULT '' COMMENT '附件类型',
  `pid` int NOT NULL DEFAULT '0' COMMENT '分类ID0编辑器,1商品图片,2拼团图片,3砍价图片,4秒杀图片,5文章图片,6组合数据图， 7前台用户',
  `image_type` tinyint unsigned NOT NULL DEFAULT '1' COMMENT '图片上传类型 1本地 2七牛云 3OSS 4COS ',
  `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`att_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1494 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='附件管理表';

-- ----------------------------
-- Table structure for eb_system_city
-- ----------------------------
DROP TABLE IF EXISTS `eb_system_city`;
CREATE TABLE `eb_system_city` (
  `id` int NOT NULL,
  `city_id` int NOT NULL DEFAULT '0' COMMENT '城市id',
  `level` int NOT NULL DEFAULT '0' COMMENT '省市级别',
  `parent_id` int NOT NULL DEFAULT '0' COMMENT '父级id',
  `area_code` varchar(30) NOT NULL DEFAULT '' COMMENT '区号',
  `name` varchar(100) NOT NULL DEFAULT '' COMMENT '名称',
  `merger_name` varchar(255) NOT NULL DEFAULT '' COMMENT '合并名称',
  `lng` varchar(50) NOT NULL DEFAULT '' COMMENT '经度',
  `lat` varchar(50) NOT NULL DEFAULT '' COMMENT '纬度',
  `is_show` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否展示',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='城市表';

-- ----------------------------
-- Table structure for eb_system_config
-- ----------------------------
DROP TABLE IF EXISTS `eb_system_config`;
CREATE TABLE `eb_system_config` (
  `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT '配置id',
  `name` varchar(255) NOT NULL DEFAULT '' COMMENT '字段名称',
  `title` varchar(255) NOT NULL DEFAULT '' COMMENT '字段提示文字',
  `form_id` int DEFAULT '0' COMMENT '表单id',
  `value` varchar(5000) DEFAULT '' COMMENT '值',
  `status` tinyint(1) DEFAULT '0' COMMENT '是否隐藏',
  `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `status+name` (`name`) USING BTREE,
  KEY `name` (`name`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=8690 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='配置表';

-- ----------------------------
-- Table structure for eb_system_form_temp
-- ----------------------------
DROP TABLE IF EXISTS `eb_system_form_temp`;
CREATE TABLE `eb_system_form_temp` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '表单模板id',
  `name` varchar(500) NOT NULL DEFAULT '' COMMENT '表单名称',
  `info` varchar(500) NOT NULL DEFAULT '' COMMENT '表单简介',
  `content` text NOT NULL COMMENT '表单内容',
  `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=147 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='表单模板';

-- ----------------------------
-- Table structure for eb_system_group
-- ----------------------------
DROP TABLE IF EXISTS `eb_system_group`;
CREATE TABLE `eb_system_group` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '组合数据ID',
  `name` varchar(50) NOT NULL DEFAULT '' COMMENT '数据组名称',
  `info` varchar(256) NOT NULL DEFAULT '' COMMENT '简介',
  `form_id` int NOT NULL DEFAULT '0' COMMENT 'form 表单 id',
  `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=74 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='组合数据表';

-- ----------------------------
-- Table structure for eb_system_group_data
-- ----------------------------
DROP TABLE IF EXISTS `eb_system_group_data`;
CREATE TABLE `eb_system_group_data` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '组合数据详情ID',
  `gid` int NOT NULL DEFAULT '0' COMMENT '对应的数据组id',
  `value` text NOT NULL COMMENT '数据组对应的数据值（json数据）',
  `sort` int NOT NULL DEFAULT '0' COMMENT '数据排序',
  `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态（1：开启；2：关闭；）',
  `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=2063 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='组合数据详情表';

-- ----------------------------
-- Table structure for eb_system_menu
-- ----------------------------
DROP TABLE IF EXISTS `eb_system_menu`;
CREATE TABLE `eb_system_menu` (
  `id` int NOT NULL AUTO_INCREMENT,
  `pid` int unsigned NOT NULL DEFAULT '0' COMMENT '父级ID',
  `name` varchar(100) DEFAULT NULL COMMENT '名称',
  `icon` varchar(255) DEFAULT NULL COMMENT 'icon',
  `perms` varchar(200) DEFAULT NULL COMMENT '权限标识',
  `component` varchar(200) DEFAULT NULL COMMENT '组件路径',
  `menu_type` varchar(2) DEFAULT 'M' COMMENT '类型，M-目录，C-菜单，A-按钮',
  `sort` int NOT NULL DEFAULT '99999' COMMENT '排序',
  `is_show` tinyint(1) NOT NULL DEFAULT '1' COMMENT '显示状态',
  `is_delte` tinyint unsigned DEFAULT '0' COMMENT '是否删除',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=500 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='系统菜单表';

-- ----------------------------
-- Table structure for eb_system_notification
-- ----------------------------
DROP TABLE IF EXISTS `eb_system_notification`;
CREATE TABLE `eb_system_notification` (
  `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
  `mark` varchar(50) NOT NULL DEFAULT '' COMMENT '标识',
  `type` varchar(50) NOT NULL DEFAULT '' COMMENT '通知类型',
  `description` varchar(100) NOT NULL DEFAULT '' COMMENT '通知场景说明',
  `is_wechat` tinyint NOT NULL DEFAULT '0' COMMENT '公众号模板消息（0：不存在，1：开启，2：关闭）',
  `wechat_id` int NOT NULL DEFAULT '0' COMMENT '模板消息id',
  `is_routine` tinyint NOT NULL DEFAULT '0' COMMENT '小程序订阅消息（0：不存在，1：开启，2：关闭）',
  `routine_id` int NOT NULL DEFAULT '0' COMMENT '订阅消息id',
  `is_sms` tinyint NOT NULL DEFAULT '0' COMMENT '发送短信（0：不存在，1：开启，2：关闭）',
  `sms_id` int NOT NULL DEFAULT '0' COMMENT '短信id',
  `send_type` tinyint NOT NULL DEFAULT '1' COMMENT '发送类型（1：用户，2：管理员）',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `mark` (`mark`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='通知设置表';

-- ----------------------------
-- Table structure for eb_system_role
-- ----------------------------
DROP TABLE IF EXISTS `eb_system_role`;
CREATE TABLE `eb_system_role` (
  `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT '身份管理id',
  `role_name` varchar(32) NOT NULL COMMENT '身份管理名称',
  `rules` text NOT NULL COMMENT '身份管理权限(menus_id)',
  `level` tinyint unsigned NOT NULL DEFAULT '0',
  `status` tinyint unsigned NOT NULL DEFAULT '1' COMMENT '状态',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `status` (`status`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='身份管理表';

-- ----------------------------
-- Table structure for eb_system_role_menu
-- ----------------------------
DROP TABLE IF EXISTS `eb_system_role_menu`;
CREATE TABLE `eb_system_role_menu` (
  `rid` int NOT NULL COMMENT '角色id',
  `menu_id` int NOT NULL COMMENT '权限id',
  PRIMARY KEY (`rid`,`menu_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='角色菜单关联表';

-- ----------------------------
-- Table structure for eb_system_store
-- ----------------------------
DROP TABLE IF EXISTS `eb_system_store`;
CREATE TABLE `eb_system_store` (
  `id` int unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL DEFAULT '' COMMENT '门店名称',
  `introduction` varchar(1000) NOT NULL DEFAULT '' COMMENT '简介',
  `phone` char(25) NOT NULL DEFAULT '' COMMENT '手机号码',
  `address` varchar(255) NOT NULL DEFAULT '' COMMENT '省市区',
  `detailed_address` varchar(255) NOT NULL DEFAULT '' COMMENT '详细地址',
  `image` varchar(255) NOT NULL DEFAULT '' COMMENT '门店logo',
  `latitude` char(25) NOT NULL DEFAULT '' COMMENT '纬度',
  `longitude` char(25) NOT NULL DEFAULT '' COMMENT '经度',
  `valid_time` varchar(100) NOT NULL DEFAULT '' COMMENT '核销有效日期',
  `day_time` varchar(100) NOT NULL DEFAULT '' COMMENT '每日营业开关时间',
  `is_show` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否显示',
  `is_del` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `phone` (`phone`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='门店自提';

-- ----------------------------
-- Table structure for eb_system_store_staff
-- ----------------------------
DROP TABLE IF EXISTS `eb_system_store_staff`;
CREATE TABLE `eb_system_store_staff` (
  `id` int unsigned NOT NULL AUTO_INCREMENT,
  `uid` int unsigned NOT NULL COMMENT '管理员id',
  `avatar` varchar(255) NOT NULL DEFAULT '' COMMENT '店员头像',
  `store_id` int NOT NULL COMMENT '门店id',
  `staff_name` varchar(64) DEFAULT '' COMMENT '店员名称',
  `phone` char(15) DEFAULT NULL COMMENT '手机号码',
  `verify_status` tinyint NOT NULL DEFAULT '0' COMMENT '核销开关',
  `status` tinyint DEFAULT '1' COMMENT '状态',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='门店店员表';

-- ----------------------------
-- Table structure for eb_system_user_level
-- ----------------------------
DROP TABLE IF EXISTS `eb_system_user_level`;
CREATE TABLE `eb_system_user_level` (
  `id` int NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL DEFAULT '' COMMENT '会员名称',
  `experience` int NOT NULL DEFAULT '0' COMMENT '达到多少升级经验',
  `is_show` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否显示 1=显示,0=隐藏',
  `grade` int NOT NULL DEFAULT '0' COMMENT '会员等级',
  `discount` int NOT NULL DEFAULT '100' COMMENT '享受折扣',
  `icon` varchar(255) NOT NULL DEFAULT '' COMMENT '会员图标',
  `is_del` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除.1=删除,0=未删除',
  `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='普通会员等级';

-- ----------------------------
-- Table structure for eb_template_message
-- ----------------------------
DROP TABLE IF EXISTS `eb_template_message`;
CREATE TABLE `eb_template_message` (
  `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT '模板id',
  `type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0=订阅消息,1=微信模板消息',
  `temp_key` char(50) NOT NULL DEFAULT '' COMMENT '模板编号',
  `name` char(100) NOT NULL COMMENT '模板名',
  `content` varchar(1000) NOT NULL COMMENT '回复内容',
  `temp_id` char(100) DEFAULT NULL COMMENT '模板ID',
  `status` tinyint NOT NULL DEFAULT '1' COMMENT '状态',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=COMPACT COMMENT='微信模板';

-- ----------------------------
-- Table structure for eb_trading_day_record
-- ----------------------------
DROP TABLE IF EXISTS `eb_trading_day_record`;
CREATE TABLE `eb_trading_day_record` (
  `id` int NOT NULL AUTO_INCREMENT,
  `date` varchar(20) DEFAULT NULL COMMENT '日期',
  `product_order_num` int DEFAULT NULL COMMENT '订单数量',
  `product_order_pay_num` int DEFAULT NULL COMMENT '订单支付数量',
  `product_order_pay_fee` decimal(8,2) DEFAULT NULL COMMENT '订单支付金额',
  `product_order_refund_num` int DEFAULT NULL COMMENT '订单退款数量',
  `product_order_refund_fee` decimal(8,2) DEFAULT NULL COMMENT '订单退款金额',
  `recharge_order_num` int DEFAULT NULL COMMENT '充值订单数量',
  `recharge_order_fee` decimal(8,2) DEFAULT NULL COMMENT '充值订单金额',
  `balance_pay_fee` decimal(8,2) DEFAULT NULL COMMENT '余额支付金额',
  `brokerage_fee` decimal(8,2) DEFAULT NULL COMMENT '支付佣金金额（用户确认到账佣金）',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `date` (`date`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=271 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='商城交易日记录表';

-- ----------------------------
-- Table structure for eb_user
-- ----------------------------
DROP TABLE IF EXISTS `eb_user`;
CREATE TABLE `eb_user` (
  `uid` int unsigned NOT NULL AUTO_INCREMENT COMMENT '用户id',
  `account` varchar(32) NOT NULL DEFAULT '' COMMENT '用户账号',
  `pwd` varchar(32) DEFAULT '' COMMENT '用户密码',
  `real_name` varchar(25) DEFAULT '' COMMENT '真实姓名',
  `birthday` varchar(32) DEFAULT '' COMMENT '生日',
  `card_id` varchar(20) DEFAULT '' COMMENT '身份证号码',
  `mark` varchar(255) DEFAULT '' COMMENT '用户备注',
  `partner_id` int DEFAULT NULL COMMENT '合伙人id',
  `group_id` varchar(255) DEFAULT '' COMMENT '用户分组id',
  `tag_id` varchar(255) DEFAULT '' COMMENT '标签id',
  `nickname` varchar(255) DEFAULT '' COMMENT '用户昵称',
  `avatar` varchar(256) DEFAULT '' COMMENT '用户头像',
  `phone` char(15) DEFAULT NULL COMMENT '手机号码',
  `add_ip` varchar(16) DEFAULT '' COMMENT '添加ip',
  `last_ip` varchar(16) DEFAULT '' COMMENT '最后一次登录ip',
  `now_money` decimal(16,2) unsigned DEFAULT '0.00' COMMENT '用户余额',
  `brokerage_price` decimal(8,2) DEFAULT '0.00' COMMENT '佣金金额',
  `integral` int DEFAULT '0' COMMENT '用户剩余积分',
  `experience` int unsigned DEFAULT '0' COMMENT '用户剩余经验',
  `sign_num` int DEFAULT '0' COMMENT '连续签到天数',
  `status` tinyint(1) DEFAULT '1' COMMENT '1为正常，0为禁止',
  `level` tinyint unsigned DEFAULT '0' COMMENT '等级',
  `spread_uid` int unsigned DEFAULT '0' COMMENT '推广员id',
  `spread_time` timestamp NULL DEFAULT NULL COMMENT '推广员关联时间',
  `user_type` varchar(32) NOT NULL DEFAULT '' COMMENT '用户类型',
  `is_promoter` tinyint unsigned DEFAULT '0' COMMENT '是否为推广员',
  `pay_count` int unsigned DEFAULT '0' COMMENT '用户购买次数',
  `spread_count` int DEFAULT '0' COMMENT '下级人数',
  `addres` varchar(255) DEFAULT '' COMMENT '详细地址',
  `adminid` int unsigned DEFAULT '0' COMMENT '管理员编号 ',
  `login_type` varchar(36) NOT NULL DEFAULT '' COMMENT '用户登陆类型，h5,wechat,routine',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `last_login_time` timestamp NULL DEFAULT NULL COMMENT '最后一次登录时间',
  `clean_time` timestamp NULL DEFAULT NULL COMMENT '清除时间',
  `path` varchar(255) NOT NULL DEFAULT '/0/' COMMENT '推广等级记录',
  `subscribe` tinyint DEFAULT '0' COMMENT '是否关注公众号',
  `subscribe_time` timestamp NULL DEFAULT NULL COMMENT '关注公众号时间',
  `sex` tinyint(1) DEFAULT '1' COMMENT '性别，0未知，1男，2女，3保密',
  `country` varchar(20) DEFAULT 'CN' COMMENT '国家，中国CN，其他OTHER',
  `promoter_time` timestamp NULL DEFAULT NULL COMMENT '成为分销员时间',
  PRIMARY KEY (`uid`) USING BTREE,
  UNIQUE KEY `account` (`account`) USING BTREE,
  KEY `spreaduid` (`spread_uid`) USING BTREE,
  KEY `level` (`level`) USING BTREE,
  KEY `status` (`status`) USING BTREE,
  KEY `is_promoter` (`is_promoter`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='用户表';

-- ----------------------------
-- Table structure for eb_user_address
-- ----------------------------
DROP TABLE IF EXISTS `eb_user_address`;
CREATE TABLE `eb_user_address` (
  `id` mediumint unsigned NOT NULL AUTO_INCREMENT COMMENT '用户地址id',
  `uid` int unsigned NOT NULL COMMENT '用户id',
  `real_name` varchar(32) NOT NULL DEFAULT '' COMMENT '收货人姓名',
  `phone` varchar(16) NOT NULL DEFAULT '' COMMENT '收货人电话',
  `province` varchar(64) NOT NULL DEFAULT '' COMMENT '收货人所在省',
  `city` varchar(64) NOT NULL DEFAULT '' COMMENT '收货人所在市',
  `city_id` int NOT NULL DEFAULT '0' COMMENT '城市id',
  `district` varchar(64) NOT NULL DEFAULT '' COMMENT '收货人所在区',
  `detail` varchar(256) NOT NULL DEFAULT '' COMMENT '收货人详细地址',
  `post_code` int NOT NULL DEFAULT '0' COMMENT '邮编',
  `longitude` varchar(16) NOT NULL DEFAULT '0' COMMENT '经度',
  `latitude` varchar(16) NOT NULL DEFAULT '0' COMMENT '纬度',
  `is_default` tinyint unsigned NOT NULL DEFAULT '0' COMMENT '是否默认',
  `is_del` tinyint unsigned NOT NULL DEFAULT '0' COMMENT '是否删除',
  `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `uid` (`uid`) USING BTREE,
  KEY `is_default` (`is_default`) USING BTREE,
  KEY `is_del` (`is_del`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='用户地址表';

-- ----------------------------
-- Table structure for eb_user_bill
-- ----------------------------
DROP TABLE IF EXISTS `eb_user_bill`;
CREATE TABLE `eb_user_bill` (
  `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT '用户账单id',
  `uid` int unsigned NOT NULL DEFAULT '0' COMMENT '用户uid',
  `link_id` varchar(32) NOT NULL DEFAULT '0' COMMENT '关联id',
  `pm` tinyint unsigned NOT NULL DEFAULT '0' COMMENT '0 = 支出 1 = 获得',
  `title` varchar(64) NOT NULL DEFAULT '' COMMENT '账单标题',
  `category` varchar(64) NOT NULL DEFAULT '' COMMENT '明细种类',
  `type` varchar(64) NOT NULL DEFAULT '' COMMENT '明细类型',
  `number` decimal(8,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '明细数字',
  `balance` decimal(16,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '剩余',
  `mark` varchar(512) NOT NULL DEFAULT '' COMMENT '备注',
  `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '0 = 带确定 1 = 有效 -1 = 无效',
  `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间',
  `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `openid` (`uid`) USING BTREE,
  KEY `status` (`status`) USING BTREE,
  KEY `add_time` (`create_time`) USING BTREE,
  KEY `pm` (`pm`) USING BTREE,
  KEY `type` (`category`,`type`,`link_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='用户账单表';

-- ----------------------------
-- Table structure for eb_user_brokerage_record
-- ----------------------------
DROP TABLE IF EXISTS `eb_user_brokerage_record`;
CREATE TABLE `eb_user_brokerage_record` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '记录id',
  `uid` int NOT NULL DEFAULT '0' COMMENT '用户uid',
  `link_id` varchar(32) NOT NULL DEFAULT '0' COMMENT '关联id（orderNo,提现id）',
  `link_type` varchar(32) NOT NULL DEFAULT '0' COMMENT '关联类型（order,extract，yue）',
  `type` int NOT NULL DEFAULT '1' COMMENT '类型：1-增加，2-扣减（提现）',
  `title` varchar(64) NOT NULL DEFAULT '' COMMENT '标题',
  `price` decimal(8,2) NOT NULL DEFAULT '0.00' COMMENT '金额',
  `balance` decimal(16,2) NOT NULL DEFAULT '0.00' COMMENT '剩余',
  `mark` varchar(512) NOT NULL DEFAULT '' COMMENT '备注',
  `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态：1-订单创建，2-冻结期，3-完成，4-失效（订单退款），5-提现申请',
  `frozen_time` int NOT NULL DEFAULT '0' COMMENT '冻结期时间（天）',
  `thaw_time` bigint NOT NULL DEFAULT '0' COMMENT '解冻时间',
  `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间',
  `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `brokerage_level` int DEFAULT NULL COMMENT '分销等级',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `openid` (`uid`) USING BTREE,
  KEY `status` (`status`) USING BTREE,
  KEY `add_time` (`create_time`) USING BTREE,
  KEY `type` (`type`) USING BTREE,
  KEY `type_link` (`type`,`link_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='用户佣金记录表';

-- ----------------------------
-- Table structure for eb_user_experience_record
-- ----------------------------
DROP TABLE IF EXISTS `eb_user_experience_record`;
CREATE TABLE `eb_user_experience_record` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '记录id',
  `uid` int NOT NULL DEFAULT '0' COMMENT '用户uid',
  `link_id` varchar(32) NOT NULL DEFAULT '0' COMMENT '关联id-orderNo,(sign,system默认为0）',
  `link_type` varchar(32) NOT NULL DEFAULT 'order' COMMENT '关联类型（order,sign,system）',
  `type` int NOT NULL DEFAULT '1' COMMENT '类型：1-增加，2-扣减',
  `title` varchar(64) NOT NULL DEFAULT '' COMMENT '标题',
  `experience` int NOT NULL DEFAULT '0' COMMENT '经验',
  `balance` int NOT NULL DEFAULT '0' COMMENT '剩余',
  `mark` varchar(512) NOT NULL DEFAULT '' COMMENT '备注',
  `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态：1-成功（保留字段）',
  `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间',
  `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `openid` (`uid`) USING BTREE,
  KEY `status` (`status`) USING BTREE,
  KEY `add_time` (`create_time`) USING BTREE,
  KEY `type` (`type`) USING BTREE,
  KEY `type_link` (`type`,`link_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='用户经验记录表';

-- ----------------------------
-- Table structure for eb_user_extract
-- ----------------------------
DROP TABLE IF EXISTS `eb_user_extract`;
CREATE TABLE `eb_user_extract` (
  `id` int unsigned NOT NULL AUTO_INCREMENT,
  `uid` int unsigned DEFAULT NULL,
  `real_name` varchar(64) DEFAULT NULL COMMENT '名称',
  `extract_type` varchar(32) DEFAULT 'bank' COMMENT 'bank = 银行卡 alipay = 支付宝 weixin=微信',
  `bank_code` varchar(32) DEFAULT '0' COMMENT '银行卡',
  `bank_address` varchar(256) DEFAULT '' COMMENT '开户地址',
  `alipay_code` varchar(64) DEFAULT '' COMMENT '支付宝账号',
  `extract_price` decimal(8,2) unsigned DEFAULT '0.00' COMMENT '提现金额',
  `mark` varchar(512) DEFAULT NULL,
  `balance` decimal(8,2) unsigned DEFAULT '0.00',
  `fail_msg` varchar(128) DEFAULT NULL COMMENT '无效原因',
  `status` tinyint DEFAULT '0' COMMENT '-1 未通过 0 审核中 1 已提现',
  `wechat` varchar(15) DEFAULT NULL COMMENT '微信号',
  `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `fail_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '失败时间',
  `bank_name` varchar(512) DEFAULT NULL COMMENT '银行名称',
  `qrcode_url` varchar(512) DEFAULT NULL COMMENT '微信收款二维码',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `extract_type` (`extract_type`) USING BTREE,
  KEY `status` (`status`) USING BTREE,
  KEY `openid` (`uid`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='用户提现表';

-- ----------------------------
-- Table structure for eb_user_group
-- ----------------------------
DROP TABLE IF EXISTS `eb_user_group`;
CREATE TABLE `eb_user_group` (
  `id` smallint unsigned NOT NULL AUTO_INCREMENT,
  `group_name` varchar(64) DEFAULT NULL COMMENT '用户分组名称',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='用户分组表';

-- ----------------------------
-- Table structure for eb_user_integral_record
-- ----------------------------
DROP TABLE IF EXISTS `eb_user_integral_record`;
CREATE TABLE `eb_user_integral_record` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '记录id',
  `uid` int NOT NULL DEFAULT '0' COMMENT '用户uid',
  `link_id` varchar(32) NOT NULL DEFAULT '0' COMMENT '关联id-orderNo,(sign,system默认为0）',
  `link_type` varchar(32) NOT NULL DEFAULT 'order' COMMENT '关联类型（order,sign,system）',
  `source_detail` varchar(50) DEFAULT NULL COMMENT '来源详情：check_in(打卡)/photo(照片)/share(分享)/streak(连续打卡)/exchange(兑换)/consult(咨询)/order(订单)/sign(签到)/system(系统)',
  `type` int NOT NULL DEFAULT '1' COMMENT '类型：1-增加，2-扣减',
  `title` varchar(64) NOT NULL DEFAULT '' COMMENT '标题',
  `integral` int NOT NULL DEFAULT '0' COMMENT '积分',
  `balance` int NOT NULL DEFAULT '0' COMMENT '剩余',
  `mark` varchar(512) NOT NULL DEFAULT '' COMMENT '备注',
  `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态：1-订单创建，2-冻结期，3-完成，4-失效（订单退款）',
  `frozen_time` int NOT NULL DEFAULT '0' COMMENT '冻结期时间（天）',
  `thaw_time` bigint NOT NULL DEFAULT '0' COMMENT '解冻时间',
  `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间',
  `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `openid` (`uid`) USING BTREE,
  KEY `status` (`status`) USING BTREE,
  KEY `add_time` (`create_time`) USING BTREE,
  KEY `type` (`type`) USING BTREE,
  KEY `type_link` (`type`,`link_id`) USING BTREE,
  KEY `idx_source_detail` (`source_detail`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='用户积分记录表';

-- ----------------------------
-- Table structure for eb_user_level
-- ----------------------------
DROP TABLE IF EXISTS `eb_user_level`;
CREATE TABLE `eb_user_level` (
  `id` int NOT NULL AUTO_INCREMENT,
  `uid` int NOT NULL DEFAULT '0' COMMENT '用户uid',
  `level_id` int NOT NULL DEFAULT '0' COMMENT '等级vip',
  `grade` int NOT NULL DEFAULT '0' COMMENT '会员等级',
  `status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0:禁止,1:正常',
  `mark` varchar(255) NOT NULL DEFAULT '' COMMENT '备注',
  `remind` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否已通知',
  `is_del` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除,0=未删除,1=删除',
  `discount` int NOT NULL DEFAULT '100' COMMENT '享受折扣',
  `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `expired_time` timestamp NULL DEFAULT NULL COMMENT '过期时间',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE KEY `id` (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='用户等级记录表';

-- ----------------------------
-- Table structure for eb_user_recharge
-- ----------------------------
DROP TABLE IF EXISTS `eb_user_recharge`;
CREATE TABLE `eb_user_recharge` (
  `id` int unsigned NOT NULL AUTO_INCREMENT,
  `uid` int DEFAULT NULL COMMENT '充值用户UID',
  `order_id` varchar(32) DEFAULT NULL COMMENT '订单号',
  `price` decimal(8,2) DEFAULT NULL COMMENT '充值金额',
  `give_price` decimal(8,2) NOT NULL DEFAULT '0.00' COMMENT '购买赠送金额',
  `recharge_type` varchar(32) DEFAULT NULL COMMENT '充值类型',
  `paid` tinyint(1) DEFAULT '0' COMMENT '是否充值',
  `pay_time` timestamp NULL DEFAULT NULL COMMENT '充值支付时间',
  `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '充值时间',
  `refund_price` decimal(10,2) DEFAULT '0.00' COMMENT '退款金额',
  `is_wechat_shipping` tinyint NOT NULL DEFAULT '0' COMMENT '是否上传微信发货管理',
  `out_trade_no` varchar(32) NOT NULL DEFAULT '' COMMENT '支付服务方订单号',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE KEY `order_id` (`order_id`) USING BTREE,
  KEY `uid` (`uid`) USING BTREE,
  KEY `recharge_type` (`recharge_type`) USING BTREE,
  KEY `paid` (`paid`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='用户充值表';

-- ----------------------------
-- Table structure for eb_user_sign
-- ----------------------------
DROP TABLE IF EXISTS `eb_user_sign`;
CREATE TABLE `eb_user_sign` (
  `id` int NOT NULL AUTO_INCREMENT,
  `uid` int NOT NULL DEFAULT '0' COMMENT '用户uid',
  `title` varchar(255) NOT NULL DEFAULT '' COMMENT '签到说明',
  `number` int NOT NULL DEFAULT '0' COMMENT '获得',
  `balance` int NOT NULL DEFAULT '0' COMMENT '剩余',
  `type` tinyint(1) NOT NULL DEFAULT '1' COMMENT '类型，1积分，2经验',
  `plan_id` bigint 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 DEFAULT NULL COMMENT '实际能量摄入(kcal)',
  `actual_potassium` int DEFAULT NULL COMMENT '实际钾摄入(mg)',
  `actual_phosphorus` int DEFAULT NULL COMMENT '实际磷摄入(mg)',
  `actual_sodium` int DEFAULT NULL COMMENT '实际钠摄入(mg)',
  `target_protein` decimal(5,1) DEFAULT NULL COMMENT '目标蛋白质摄入(g)',
  `target_energy` int DEFAULT NULL COMMENT '目标能量摄入(kcal)',
  `compliance_rate` int 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 DEFAULT '0' COMMENT '报告下载次数',
  `report_share_count` int DEFAULT '0' COMMENT '报告分享次数',
  `ai_comments_json` text COMMENT 'AI生成的点评，JSON格式：{strengths:[], suggestions:[], next_meal_advice:""}',
  `nutrition_score` int DEFAULT NULL COMMENT '营养评分（0-100）',
  `copied_from_sign_id` int 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',
  `enable_ai_video` tinyint DEFAULT NULL COMMENT 'AI生成视频开关标记：0=否，1=是',
  `enable_ai_analysis` tinyint 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=24 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='签到记录表';

-- ----------------------------
-- Table structure for eb_user_tag
-- ----------------------------
DROP TABLE IF EXISTS `eb_user_tag`;
CREATE TABLE `eb_user_tag` (
  `id` smallint unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(64) DEFAULT NULL COMMENT '标签名称',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='标签管理';

-- ----------------------------
-- Table structure for eb_user_token
-- ----------------------------
DROP TABLE IF EXISTS `eb_user_token`;
CREATE TABLE `eb_user_token` (
  `id` int NOT NULL AUTO_INCREMENT,
  `uid` int unsigned NOT NULL COMMENT '用户 id',
  `token` varchar(255) NOT NULL DEFAULT '' COMMENT 'token',
  `type` tinyint(1) DEFAULT '1' COMMENT '类型，1 公众号， 2 小程序, 3 unionid, 5AppIos,6AppAndroid,7ios',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `expires_time` datetime DEFAULT NULL COMMENT '到期时间',
  `login_ip` varchar(32) DEFAULT NULL COMMENT '登录ip',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE KEY `type+token` (`type`,`token`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;

-- ----------------------------
-- Table structure for eb_user_visit_record
-- ----------------------------
DROP TABLE IF EXISTS `eb_user_visit_record`;
CREATE TABLE `eb_user_visit_record` (
  `id` int NOT NULL AUTO_INCREMENT,
  `date` varchar(20) DEFAULT NULL COMMENT '日期',
  `uid` int DEFAULT NULL COMMENT '用户uid',
  `visit_type` int DEFAULT NULL COMMENT '访问类型',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `date` (`date`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1470 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='用户访问记录表';

-- ----------------------------
-- Table structure for eb_wechat_callback
-- ----------------------------
DROP TABLE IF EXISTS `eb_wechat_callback`;
CREATE TABLE `eb_wechat_callback` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  `to_user_name` varchar(255) DEFAULT NULL COMMENT '商家小程序名称',
  `from_user_name` varchar(255) DEFAULT NULL COMMENT '微信团队的 OpenID(固定值)',
  `create_time` bigint unsigned DEFAULT NULL COMMENT '事件时间,Unix时间戳',
  `msg_type` varchar(255) DEFAULT NULL COMMENT '消息类型',
  `event` varchar(255) DEFAULT NULL COMMENT '事件类型',
  `content` text COMMENT '内容',
  `add_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='微信回调表';

-- ----------------------------
-- Table structure for eb_wechat_exceptions
-- ----------------------------
DROP TABLE IF EXISTS `eb_wechat_exceptions`;
CREATE TABLE `eb_wechat_exceptions` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT 'id',
  `errcode` varchar(64) DEFAULT '' COMMENT '错误码',
  `errmsg` varchar(255) DEFAULT '' COMMENT '错误信息',
  `data` text COMMENT '回复数据',
  `remark` text COMMENT '备注',
  `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1311456 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='微信异常表';

-- ----------------------------
-- Table structure for eb_wechat_pay_info
-- ----------------------------
DROP TABLE IF EXISTS `eb_wechat_pay_info`;
CREATE TABLE `eb_wechat_pay_info` (
  `id` int NOT NULL AUTO_INCREMENT,
  `app_id` varchar(50) DEFAULT NULL COMMENT '公众号唯一标识',
  `mch_id` varchar(50) DEFAULT NULL COMMENT '商户号',
  `device_info` varchar(50) DEFAULT NULL COMMENT '设备号,PC网页或公众号内支付可以传-WEB',
  `open_id` varchar(50) DEFAULT NULL COMMENT '用户的唯一标识',
  `nonce_str` varchar(50) DEFAULT NULL COMMENT '随机字符串',
  `sign` varchar(70) DEFAULT NULL COMMENT '签名',
  `sign_type` varchar(20) DEFAULT 'MD5' COMMENT '签名类型，默认为MD5，支持HMAC-SHA256和MD5',
  `body` varchar(500) DEFAULT NULL COMMENT '商品描述',
  `detail` text COMMENT '商品详细描述，对于使用单品优惠的商户，该字段必须按照规范上传',
  `attach` varchar(255) DEFAULT NULL COMMENT '附加数据，在查询API和支付通知中原样返回，可作为自定义参数使用',
  `out_trade_no` varchar(50) DEFAULT NULL COMMENT '商户订单号,要求32个字符内',
  `fee_type` varchar(50) DEFAULT NULL COMMENT '标价币种：CNY：人民币 GBP：英镑 HKD：港币 USD：美元 JPY：日元 CAD：加拿大元 AUD：澳大利亚元 EUR：欧元 NZD：新西兰元 KRW：韩元 THB：泰铢',
  `total_fee` int DEFAULT NULL COMMENT '标价金额',
  `spbill_create_ip` varchar(64) DEFAULT NULL COMMENT '终端IP',
  `time_start` varchar(20) DEFAULT NULL COMMENT '交易起始时间',
  `time_expire` varchar(20) DEFAULT NULL COMMENT '交易结束时间',
  `notify_url` varchar(300) DEFAULT NULL COMMENT '通知地址',
  `trade_type` varchar(20) DEFAULT NULL COMMENT '交易类型,取值为：JSAPI，NATIVE，APP等',
  `product_id` varchar(32) DEFAULT NULL COMMENT '商品ID',
  `scene_info` varchar(256) DEFAULT NULL COMMENT '场景信息',
  `err_code` varchar(50) DEFAULT NULL COMMENT '错误代码',
  `prepay_id` varchar(100) DEFAULT NULL COMMENT '预支付交易会话标识',
  `code_url` varchar(64) DEFAULT NULL COMMENT '二维码链接',
  `is_subscribe` varchar(2) DEFAULT NULL COMMENT '是否关注公众账号',
  `trade_state` varchar(32) DEFAULT NULL COMMENT '交易状态',
  `bank_type` varchar(20) DEFAULT NULL COMMENT '付款银行',
  `cash_fee` int DEFAULT NULL COMMENT '现金支付金额',
  `coupon_fee` int DEFAULT NULL COMMENT '代金券金额',
  `transaction_id` varchar(50) DEFAULT NULL COMMENT '微信支付订单号',
  `time_end` varchar(20) DEFAULT NULL COMMENT '支付完成时间',
  `trade_state_desc` varchar(256) DEFAULT NULL COMMENT '交易状态描述',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `out_trade_no` (`out_trade_no`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=42 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='微信订单表';

-- ----------------------------
-- Table structure for eb_wechat_program_my_temp
-- ----------------------------
DROP TABLE IF EXISTS `eb_wechat_program_my_temp`;
CREATE TABLE `eb_wechat_program_my_temp` (
  `id` int unsigned NOT NULL AUTO_INCREMENT,
  `tid` int NOT NULL COMMENT '微信模板id',
  `title` varchar(200) NOT NULL DEFAULT '' COMMENT '模版标题',
  `kid` varchar(200) NOT NULL DEFAULT '' COMMENT '模板关键字id，多个逗号分割',
  `scene_desc` varchar(500) NOT NULL DEFAULT '' COMMENT '场景描述',
  `temp_id` varchar(50) DEFAULT NULL COMMENT '微信模板id',
  `extra` text COMMENT '扩展字段',
  `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态 0，禁用，1启用',
  `type` varchar(100) DEFAULT NULL COMMENT '应用场景',
  `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='小程序我的模板';

-- ----------------------------
-- Table structure for eb_wechat_program_public_temp
-- ----------------------------
DROP TABLE IF EXISTS `eb_wechat_program_public_temp`;
CREATE TABLE `eb_wechat_program_public_temp` (
  `id` int unsigned NOT NULL AUTO_INCREMENT,
  `tid` int NOT NULL COMMENT '微信模板id',
  `title` varchar(200) NOT NULL DEFAULT '' COMMENT '模版标题',
  `type` tinyint(1) NOT NULL COMMENT '模版类型，2 为一次性订阅，3 为长期订阅',
  `category_id` int NOT NULL COMMENT '模版所属类目 id',
  `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE KEY `tid` (`tid`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=359 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='小程序微信公共模板库';

-- ----------------------------
-- Table structure for eb_wechat_reply
-- ----------------------------
DROP TABLE IF EXISTS `eb_wechat_reply`;
CREATE TABLE `eb_wechat_reply` (
  `id` mediumint unsigned NOT NULL AUTO_INCREMENT COMMENT '微信关键字回复id',
  `keywords` varchar(64) NOT NULL DEFAULT '' COMMENT '关键字',
  `type` varchar(32) NOT NULL DEFAULT '' COMMENT '回复类型',
  `data` text NOT NULL COMMENT '回复数据',
  `status` tinyint unsigned NOT NULL DEFAULT '1' COMMENT '回复状态 0=不可用  1 =可用',
  `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE KEY `key` (`keywords`) USING BTREE,
  KEY `type` (`type`) USING BTREE,
  KEY `status` (`status`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='微信关键字回复表';

-- ----------------------------
-- Table structure for v2_ai_conversations
-- ----------------------------
DROP TABLE IF EXISTS `v2_ai_conversations`;
CREATE TABLE `v2_ai_conversations` (
  `conversation_id` bigint NOT NULL AUTO_INCREMENT COMMENT '对话ID',
  `user_id` bigint NOT NULL COMMENT '用户ID',
  `title` varchar(100) DEFAULT NULL COMMENT '对话标题（自动生成或用户自定义）',
  `status` varchar(20) DEFAULT 'active' COMMENT '状态：active(进行中)/archived(已归档)/deleted(已删除)',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `last_message_at` timestamp NULL DEFAULT NULL COMMENT '最后消息时间',
  PRIMARY KEY (`conversation_id`),
  KEY `idx_user_id` (`user_id`),
  KEY `idx_status` (`status`),
  KEY `idx_last_message_at` (`last_message_at`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='AI营养师对话表';

-- ----------------------------
-- Table structure for v2_ai_messages
-- ----------------------------
DROP TABLE IF EXISTS `v2_ai_messages`;
CREATE TABLE `v2_ai_messages` (
  `message_id` bigint NOT NULL AUTO_INCREMENT COMMENT '消息ID',
  `conversation_id` bigint NOT NULL COMMENT '对话ID',
  `user_id` bigint NOT NULL COMMENT '用户ID',
  `message_type` varchar(20) NOT NULL COMMENT '消息类型：text(文本)/image(图片)/voice(语音)',
  `content` text COMMENT '消息内容（文本内容或语音转文字）',
  `image_url` varchar(500) DEFAULT NULL COMMENT '图片URL（当type为image时）',
  `voice_url` varchar(500) DEFAULT NULL COMMENT '语音URL（当type为voice时）',
  `sender` varchar(20) NOT NULL COMMENT '发送者：user(用户)/ai(AI营养师)',
  `ai_response` text COMMENT 'AI回复内容',
  `ai_response_status` varchar(20) DEFAULT 'pending' COMMENT 'AI回复状态：pending(待回复)/success(成功)/failed(失败)',
  `ai_response_time` timestamp NULL DEFAULT NULL COMMENT 'AI回复时间',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  PRIMARY KEY (`message_id`),
  KEY `idx_conversation_id` (`conversation_id`),
  KEY `idx_user_id` (`user_id`),
  KEY `idx_created_at` (`created_at`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='AI营养师消息表';

-- ----------------------------
-- Table structure for v2_calculator_results
-- ----------------------------
DROP TABLE IF EXISTS `v2_calculator_results`;
CREATE TABLE `v2_calculator_results` (
  `result_id` bigint NOT NULL AUTO_INCREMENT COMMENT '计算结果ID',
  `user_id` bigint NOT NULL COMMENT '用户ID',
  `gender` varchar(10) DEFAULT NULL COMMENT '性别：male/female',
  `age` int DEFAULT NULL COMMENT '年龄',
  `height` int DEFAULT NULL COMMENT '身高(cm)',
  `weight` decimal(5,2) DEFAULT NULL COMMENT '体重(kg)',
  `has_dialysis` tinyint(1) DEFAULT '0' COMMENT '是否透析：0=否，1=是',
  `dialysis_type` varchar(20) DEFAULT NULL COMMENT '透析类型：hemodialysis(血液透析)/peritoneal(腹膜透析)',
  `dry_weight` decimal(5,2) DEFAULT NULL COMMENT '干体重(kg)',
  `creatinine` decimal(8,2) DEFAULT NULL COMMENT '血肌酐(μmol/L)',
  `egfr` decimal(5,2) DEFAULT NULL COMMENT 'eGFR值',
  `standard_weight` decimal(5,2) DEFAULT NULL COMMENT '标准体重(kg)',
  `bmi` decimal(4,1) DEFAULT NULL COMMENT 'BMI值',
  `bmi_status` varchar(24) DEFAULT NULL COMMENT 'BMI状态描述：体型过轻/正常/超重/肥胖',
  `ckd_stage` varchar(50) DEFAULT NULL COMMENT 'CKD分期',
  `protein_intake` decimal(5,1) DEFAULT NULL COMMENT '蛋白质摄入量(g/天)',
  `energy_intake` int DEFAULT NULL COMMENT '能量摄入量(kcal/天)',
  `food_list_json` text COMMENT '食物份数建议 JSON',
  `meal_plan_json` text COMMENT '配餐方案JSON，包含早中晚三餐详情',
  `tips_json` text COMMENT '重要提示 JSON',
  `is_adopted` tinyint(1) DEFAULT '0' COMMENT '是否已采纳：0=未采纳，1=已采纳',
  `adopted_at` 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 '更新时间',
  PRIMARY KEY (`result_id`),
  KEY `idx_user_id` (`user_id`),
  KEY `idx_is_adopted` (`is_adopted`),
  KEY `idx_created_at` (`created_at`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='食谱计算器结果表';

-- ----------------------------
-- Table structure for v2_community_comments
-- ----------------------------
DROP TABLE IF EXISTS `v2_community_comments`;
CREATE TABLE `v2_community_comments` (
  `comment_id` bigint NOT NULL AUTO_INCREMENT COMMENT '评论ID',
  `post_id` bigint NOT NULL COMMENT '内容ID',
  `user_id` bigint NOT NULL COMMENT '用户ID',
  `content` text NOT NULL COMMENT '评论内容',
  `parent_comment_id` bigint DEFAULT NULL COMMENT '父评论ID，NULL为一级评论',
  `reply_to_user_id` bigint DEFAULT NULL COMMENT '@的用户ID',
  `like_count` int DEFAULT '0' COMMENT '点赞数',
  `status` varchar(20) DEFAULT 'published' COMMENT '状态：published(已发布)/deleted(已删除)/banned(已封禁)',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  PRIMARY KEY (`comment_id`),
  KEY `idx_post_id` (`post_id`),
  KEY `idx_user_id` (`user_id`),
  KEY `idx_parent_comment_id` (`parent_comment_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='社区评论表';

-- ----------------------------
-- Table structure for v2_community_follows
-- ----------------------------
DROP TABLE IF EXISTS `v2_community_follows`;
CREATE TABLE `v2_community_follows` (
  `follow_id` bigint NOT NULL AUTO_INCREMENT COMMENT '关注ID',
  `follower_id` bigint NOT NULL COMMENT '关注者ID',
  `followee_id` bigint NOT NULL COMMENT '被关注者ID',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  PRIMARY KEY (`follow_id`),
  UNIQUE KEY `uk_follower_followee` (`follower_id`,`followee_id`),
  KEY `idx_follower_id` (`follower_id`),
  KEY `idx_followee_id` (`followee_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='关注关系表';

-- ----------------------------
-- Table structure for v2_community_interactions
-- ----------------------------
DROP TABLE IF EXISTS `v2_community_interactions`;
CREATE TABLE `v2_community_interactions` (
  `interaction_id` bigint NOT NULL AUTO_INCREMENT COMMENT '互动ID',
  `user_id` bigint NOT NULL COMMENT '用户ID',
  `post_id` bigint NOT NULL COMMENT '内容ID',
  `interaction_type` varchar(20) NOT NULL COMMENT '互动类型：like(点赞)/collect(收藏)/share(分享)/view(查看)',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  PRIMARY KEY (`interaction_id`),
  UNIQUE KEY `uk_user_post_type` (`user_id`,`post_id`,`interaction_type`),
  KEY `idx_post_id` (`post_id`),
  KEY `idx_user_id` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='社区互动表';

-- ----------------------------
-- Table structure for v2_community_posts
-- ----------------------------
DROP TABLE IF EXISTS `v2_community_posts`;
CREATE TABLE `v2_community_posts` (
  `post_id` bigint NOT NULL AUTO_INCREMENT COMMENT '内容ID',
  `user_id` bigint NOT NULL COMMENT '用户ID',
  `check_in_record_id` int 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 DEFAULT '0' COMMENT '点赞数',
  `comment_count` int DEFAULT '0' COMMENT '评论数',
  `collect_count` int DEFAULT '0' COMMENT '收藏数',
  `share_count` int DEFAULT '0' COMMENT '分享数',
  `view_count` int DEFAULT '0' COMMENT '查看数',
  `quick_checkin_count` int DEFAULT '0' COMMENT '被一键打卡次数',
  `ai_video_count` int 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 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=303 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='社区内容表';

-- ----------------------------
-- Table structure for v2_foods
-- ----------------------------
DROP TABLE IF EXISTS `v2_foods`;
CREATE TABLE `v2_foods` (
  `food_id` bigint NOT NULL AUTO_INCREMENT COMMENT '食物ID',
  `name` varchar(100) NOT NULL COMMENT '食物名称',
  `alias` varchar(200) DEFAULT NULL COMMENT '别名（多个用逗号分隔）',
  `category` varchar(50) DEFAULT NULL COMMENT '分类：grain(主食)/vegetable(蔬菜)/fruit(水果)/meat(肉类)/seafood(海鲜)/dairy(乳制品)/other(其他)',
  `image` varchar(500) DEFAULT NULL COMMENT '食物图片URL',
  `protein` decimal(5,2) DEFAULT NULL COMMENT '蛋白质(g)',
  `fat` decimal(5,2) DEFAULT NULL COMMENT '脂肪(g)',
  `carbohydrate` decimal(5,2) DEFAULT NULL COMMENT '碳水化合物(g)',
  `energy` int DEFAULT NULL COMMENT '能量(kcal)',
  `potassium` int DEFAULT NULL COMMENT '钾(mg)',
  `phosphorus` int DEFAULT NULL COMMENT '磷(mg)',
  `sodium` int DEFAULT NULL COMMENT '钠(mg)',
  `calcium` int DEFAULT NULL COMMENT '钙(mg)',
  `iron` decimal(5,2) DEFAULT NULL COMMENT '铁(mg)',
  `vitamin_c` decimal(5,2) DEFAULT NULL COMMENT '维生素C(mg)',
  `nutrients_json` text COMMENT '其他营养成分，JSON格式',
  `suitability_level` varchar(20) DEFAULT NULL COMMENT '适宜性等级：suitable(适宜)/moderate(适量)/restricted(限制)/forbidden(禁止)',
  `suitability_desc` text COMMENT '适宜性说明',
  `caution_level` int DEFAULT '0' COMMENT '注意事项等级：0=无，1=低，2=中，3=高',
  `caution_desc` text COMMENT '注意事项说明',
  `recommended_amount` varchar(50) DEFAULT NULL COMMENT '推荐用量，如：50-100g/天',
  `cooking_tips` text COMMENT '烹饪建议',
  `status` varchar(20) DEFAULT 'active' COMMENT '状态：active(启用)/inactive(禁用)',
  `sort_order` int DEFAULT '0' COMMENT '排序',
  `view_count` int DEFAULT '0' COMMENT '查看次数',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`food_id`),
  KEY `idx_name` (`name`),
  KEY `idx_category` (`category`),
  KEY `idx_suitability_level` (`suitability_level`),
  KEY `idx_status` (`status`)
) ENGINE=InnoDB AUTO_INCREMENT=1323 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='食物百科表';

-- ----------------------------
-- Table structure for v2_knowledge
-- ----------------------------
DROP TABLE IF EXISTS `v2_knowledge`;
CREATE TABLE `v2_knowledge` (
  `knowledge_id` bigint NOT NULL AUTO_INCREMENT COMMENT '知识ID',
  `title` varchar(200) NOT NULL COMMENT '标题',
  `content` text NOT NULL COMMENT '内容',
  `summary` varchar(500) DEFAULT NULL COMMENT '摘要',
  `cover_image` varchar(500) DEFAULT NULL COMMENT '封面图URL',
  `images_json` text COMMENT '内容图片数组，JSON格式',
  `type` varchar(50) DEFAULT NULL COMMENT '类型：nutrients(营养素)/guide(指南)/article(文章)/recipe(食谱)',
  `category` varchar(50) DEFAULT NULL COMMENT '分类',
  `tags_json` text COMMENT '标签数组，JSON格式',
  `nutrient_name` varchar(50) DEFAULT NULL COMMENT '关联的营养素名称（当type为nutrients时）',
  `view_count` int DEFAULT '0' COMMENT '查看次数',
  `like_count` int DEFAULT '0' COMMENT '点赞次数',
  `collect_count` int DEFAULT '0' COMMENT '收藏次数',
  `share_count` int DEFAULT '0' COMMENT '分享次数',
  `status` varchar(20) DEFAULT 'published' COMMENT '状态：draft(草稿)/published(已发布)/deleted(已删除)',
  `is_recommend` tinyint(1) DEFAULT '0' COMMENT '是否推荐：0=否，1=是',
  `sort_order` int DEFAULT '0' COMMENT '排序',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `published_at` timestamp NULL DEFAULT NULL COMMENT '发布时间',
  PRIMARY KEY (`knowledge_id`),
  KEY `idx_type` (`type`),
  KEY `idx_category` (`category`),
  KEY `idx_nutrient_name` (`nutrient_name`),
  KEY `idx_status` (`status`),
  KEY `idx_is_recommend` (`is_recommend`),
  KEY `idx_created_at` (`created_at`)
) ENGINE=InnoDB AUTO_INCREMENT=1071 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='营养知识表';

-- ----------------------------
-- Table structure for v2_nutrition_plans
-- ----------------------------
DROP TABLE IF EXISTS `v2_nutrition_plans`;
CREATE TABLE `v2_nutrition_plans` (
  `plan_id` bigint NOT NULL AUTO_INCREMENT COMMENT '营养计划ID',
  `user_id` bigint NOT NULL COMMENT '用户ID',
  `result_id` bigint DEFAULT NULL COMMENT '关联的计算结果ID',
  `gender` varchar(10) DEFAULT NULL COMMENT '性别：male/female',
  `age` int DEFAULT NULL COMMENT '年龄',
  `height` int DEFAULT NULL COMMENT '身高(cm)',
  `weight` decimal(5,2) DEFAULT NULL COMMENT '体重(kg)',
  `has_dialysis` tinyint(1) DEFAULT '0' COMMENT '是否透析：0=否，1=是',
  `dialysis_type` varchar(20) DEFAULT NULL COMMENT '透析类型：hemodialysis(血液透析)/peritoneal(腹膜透析)',
  `creatinine` decimal(8,2) DEFAULT NULL COMMENT '血肌酐(μmol/L)',
  `egfr` decimal(5,2) DEFAULT NULL COMMENT 'eGFR值',
  `standard_weight` decimal(5,2) DEFAULT NULL COMMENT '标准体重(kg)',
  `bmi` decimal(4,1) DEFAULT NULL COMMENT 'BMI值',
  `ckd_stage` varchar(50) DEFAULT NULL COMMENT 'CKD分期',
  `protein_intake` decimal(5,1) DEFAULT NULL COMMENT '蛋白质摄入量(g/天)',
  `energy_intake` int DEFAULT NULL COMMENT '能量摄入量(kcal/天)',
  `meal_plan_json` text COMMENT '配餐方案JSON，包含早中晚三餐详情',
  `status` varchar(20) DEFAULT 'active' COMMENT '状态：active(进行中)/completed(已完成)/abandoned(已放弃)',
  `start_date` date DEFAULT NULL COMMENT '计划开始日期',
  `end_date` date DEFAULT NULL COMMENT '计划结束日期（通常为start_date + 7天）',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`plan_id`),
  KEY `idx_user_id` (`user_id`),
  KEY `idx_status` (`status`),
  KEY `idx_start_date` (`start_date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='营养计划表';

-- ----------------------------
-- Table structure for v2_nutritionist_consultations
-- ----------------------------
DROP TABLE IF EXISTS `v2_nutritionist_consultations`;
CREATE TABLE `v2_nutritionist_consultations` (
  `consultation_id` bigint NOT NULL AUTO_INCREMENT COMMENT '咨询ID',
  `user_id` bigint NOT NULL COMMENT '用户ID',
  `consult_type` varchar(20) NOT NULL COMMENT '咨询类型：text(图文)/voice(语音)/video(视频)',
  `status` varchar(20) NOT NULL DEFAULT 'pending' COMMENT '状态：pending(待处理)/in_progress(进行中)/completed(已完成)/cancelled(已取消)',
  `question_text` text COMMENT '用户提问',
  `question_images_json` text COMMENT '问题相关图片URL数组，JSON格式',
  `related_report_id` varchar(50) DEFAULT NULL COMMENT '关联的营养报告ID',
  `related_check_in_id` int DEFAULT NULL COMMENT '关联的打卡记录ID（关联eb_user_sign.id，当type=3时）',
  `nutritionist_id` bigint DEFAULT NULL COMMENT '营养师ID',
  `nutritionist_reply` text COMMENT '营养师回复',
  `reply_images_json` text COMMENT '回复相关图片，JSON格式',
  `follow_up_count` int DEFAULT '0' COMMENT '追问次数',
  `follow_up_questions_json` text COMMENT '追问和回复记录，JSON格式',
  `call_start_time` timestamp NULL DEFAULT NULL COMMENT '通话开始时间',
  `call_end_time` timestamp NULL DEFAULT NULL COMMENT '通话结束时间',
  `call_duration` int DEFAULT NULL COMMENT '通话时长（秒）',
  `call_recording_url` varchar(500) DEFAULT NULL COMMENT '通话录音URL（可选）',
  `points_cost` int DEFAULT '0' COMMENT '消耗积分',
  `cash_cost` decimal(10,2) DEFAULT '0.00' COMMENT '现金支付（元）',
  `user_rating` int DEFAULT NULL COMMENT '用户评分（1-5星）',
  `user_feedback` text COMMENT '用户反馈',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `replied_at` timestamp NULL DEFAULT NULL COMMENT '营养师回复时间',
  PRIMARY KEY (`consultation_id`),
  KEY `idx_user_id` (`user_id`),
  KEY `idx_nutritionist_id` (`nutritionist_id`),
  KEY `idx_status` (`status`),
  KEY `idx_created_at` (`created_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='营养师咨询记录表';

-- ----------------------------
-- Table structure for v2_quick_checkin_records
-- ----------------------------
DROP TABLE IF EXISTS `v2_quick_checkin_records`;
CREATE TABLE `v2_quick_checkin_records` (
  `quick_checkin_id` bigint NOT NULL AUTO_INCREMENT COMMENT '一键打卡ID',
  `user_id` bigint NOT NULL COMMENT '借鉴者ID',
  `source_post_id` bigint NOT NULL COMMENT '借鉴的社区内容ID',
  `source_user_id` bigint NOT NULL COMMENT '原创者ID',
  `dishes_json` text COMMENT '借鉴的菜品清单（可能有修改），JSON格式',
  `nutrition_json` text COMMENT '营养数据，JSON格式',
  `is_modified` tinyint(1) DEFAULT '0' COMMENT '是否修改了菜品清单：0=否，1=是',
  `checkin_date` date NOT NULL COMMENT '打卡日期',
  `meal_type` varchar(20) NOT NULL COMMENT '餐次：breakfast(早餐)/lunch(午餐)/dinner(晚餐)',
  `check_in_record_id` int DEFAULT NULL COMMENT '生成的打卡记录ID（关联eb_user_sign.id，当type=3时）',
  `article_id` int DEFAULT NULL COMMENT '生成的AI视频文章ID（关联eb_article.id，当type=2时）',
  `video_generated` tinyint(1) DEFAULT '0' COMMENT '是否生成了AI视频：0=否，1=是',
  `points_earned` int DEFAULT '0' COMMENT '借鉴者获得的积分',
  `points_to_author` int DEFAULT '0' COMMENT '原创者获得的积分',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `completed_at` timestamp NULL DEFAULT NULL COMMENT '打卡完成时间',
  PRIMARY KEY (`quick_checkin_id`),
  KEY `idx_user_id` (`user_id`),
  KEY `idx_source_post_id` (`source_post_id`),
  KEY `idx_source_user_id` (`source_user_id`),
  KEY `idx_checkin_date` (`checkin_date`),
  KEY `idx_article_id` (`article_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='一键打卡记录表';

-- ----------------------------
-- Table structure for v2_recipes
-- ----------------------------
DROP TABLE IF EXISTS `v2_recipes`;
CREATE TABLE `v2_recipes` (
  `recipe_id` bigint NOT NULL AUTO_INCREMENT COMMENT '食谱ID',
  `user_id` bigint DEFAULT NULL COMMENT '用户ID（用户自定义食谱时）',
  `name` varchar(100) NOT NULL COMMENT '食谱名称',
  `description` text COMMENT '食谱描述',
  `cover_image` varchar(500) DEFAULT NULL COMMENT '封面图URL',
  `images_json` text COMMENT '食谱图片数组，JSON格式',
  `meal_type` varchar(20) DEFAULT NULL COMMENT '餐次：breakfast(早餐)/lunch(午餐)/dinner(晚餐)/snack(加餐)',
  `category` varchar(50) DEFAULT NULL COMMENT '分类',
  `tags_json` text COMMENT '标签数组，JSON格式',
  `ingredients_json` text COMMENT '食材清单，JSON格式：[{name, amount, unit}]',
  `steps_json` text COMMENT '制作步骤，JSON格式：[{step, description, image}]',
  `total_protein` decimal(5,1) DEFAULT NULL COMMENT '总蛋白质(g)',
  `total_energy` int DEFAULT NULL COMMENT '总能量(kcal)',
  `total_potassium` int DEFAULT NULL COMMENT '总钾(mg)',
  `total_phosphorus` int DEFAULT NULL COMMENT '总磷(mg)',
  `total_sodium` int DEFAULT NULL COMMENT '总钠(mg)',
  `nutrition_json` text COMMENT '其他营养成分，JSON格式',
  `suitable_stages_json` text COMMENT '适宜的CKD分期，JSON格式：["stage1", "stage2"]',
  `suitable_dialysis` tinyint(1) DEFAULT NULL COMMENT '是否适合透析患者：0=否，1=是',
  `view_count` int DEFAULT '0' COMMENT '查看次数',
  `like_count` int DEFAULT '0' COMMENT '点赞次数',
  `collect_count` int DEFAULT '0' COMMENT '收藏次数',
  `cook_count` int DEFAULT '0' COMMENT '制作次数',
  `status` varchar(20) DEFAULT 'published' COMMENT '状态：draft(草稿)/published(已发布)/deleted(已删除)',
  `is_recommend` tinyint(1) DEFAULT '0' COMMENT '是否推荐：0=否，1=是',
  `is_official` tinyint(1) DEFAULT '0' COMMENT '是否官方食谱：0=否，1=是',
  `sort_order` int DEFAULT '0' COMMENT '排序',
  `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`recipe_id`),
  KEY `idx_user_id` (`user_id`),
  KEY `idx_meal_type` (`meal_type`),
  KEY `idx_category` (`category`),
  KEY `idx_status` (`status`),
  KEY `idx_is_recommend` (`is_recommend`),
  KEY `idx_created_at` (`created_at`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='食谱表';

-- ----------------------------
-- Table structure for v2_user_points
-- ----------------------------
DROP TABLE IF EXISTS `v2_user_points`;
CREATE TABLE `v2_user_points` (
  `user_id` bigint NOT NULL COMMENT '用户ID',
  `total_points` int DEFAULT '0' COMMENT '累计总积分',
  `available_points` int DEFAULT '0' COMMENT '可用积分',
  `used_points` int DEFAULT '0' COMMENT '已使用积分',
  `total_check_ins` int DEFAULT '0' COMMENT '总打卡次数',
  `current_streak` int DEFAULT '0' COMMENT '当前连续打卡天数',
  `longest_streak` int DEFAULT '0' COMMENT '最长连续打卡天数',
  `last_check_in_date` date DEFAULT NULL COMMENT '最后打卡日期',
  `free_consult_text_count` int DEFAULT '0' COMMENT '可用的图文咨询次数',
  `free_consult_voice_count` int DEFAULT '0' COMMENT '可用的语音/视频咨询次数',
  `ai_consult_unlimited_expire_at` timestamp NULL DEFAULT NULL COMMENT 'AI不限次咨询过期时间',
  `updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='用户积分表';

SET FOREIGN_KEY_CHECKS = 1;
