-- ----------------------------
-- Table structure for qimall_addons_album
-- ----------------------------
DROP TABLE IF EXISTS `qimall_addons_album`;
CREATE TABLE `qimall_addons_album`  (
  `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
  `mall_id` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '商城ID',
  `title` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '画册标题',
  `bg_image` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '画册背景图',
  `bg_video` varchar(5000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '背景音乐',
  `bg_color` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '画册背景颜色',
  `size_type` tinyint(3) UNSIGNED NULL DEFAULT 0 COMMENT '预设尺寸',
  `file` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '附件下载地址',
  `share_title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '自定义分享标题',
  `share_desc` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '自定义分享描述',
  `share_image` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '自定义分享图片',
  `author_id` int(11) UNSIGNED NULL DEFAULT 0 COMMENT '发布者，会员id',
  `author_nick` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '发布者，会员昵称',
  `author_mobile` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '发布者，手机号',
  `created_at` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '添加时间戳',
  `updated_at` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间戳',
  `album_image` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '封面图片',
  `goods_count` int(11) UNSIGNED NULL DEFAULT 0 COMMENT '画册商品数量',
  `page_num` int(11) NULL DEFAULT 0 COMMENT '页数',
  `status` int(11) NULL DEFAULT 1 COMMENT '-1是删除，0是禁用，1是启用',
  `bg_type` int(11) NULL DEFAULT 1 COMMENT '1是背景图片，2是背景颜色',
  `goods_ids` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '商品id，多个商品逗号隔开',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '智能画册表' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for qimall_addons_album_date_statistics
-- ----------------------------
DROP TABLE IF EXISTS `qimall_addons_album_date_statistics`;
CREATE TABLE `qimall_addons_album_date_statistics`  (
  `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `mall_id` int(10) UNSIGNED NOT NULL COMMENT '商城ID',
  `visit_count` int(10) NULL DEFAULT 0 COMMENT '访问量，一个会员最多占一个访问量',
  `views_count` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '浏览量',
  `shares_click_count` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '分享后用户点击访问商品统计',
  `shares_count` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '分享量',
  `goods_click_count` int(10) NULL DEFAULT NULL COMMENT '商品点击',
  `goods_views_count` int(11) NULL DEFAULT 0 COMMENT '商品访问统计',
  `pay_count` int(11) NULL DEFAULT NULL COMMENT '支付人数',
  `order_count` int(11) NULL DEFAULT 0 COMMENT '订单统计',
  `created_at` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
  `updated_at` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
  `goods_amount` decimal(11, 2) UNSIGNED NULL DEFAULT 0.00 COMMENT '成交金额',
  `album_id` int(11) NULL DEFAULT NULL COMMENT '智能画册ID',
  `stop_time` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '停留时长单位（秒）',
  `date` date NULL DEFAULT NULL COMMENT '日期',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `mall_album`(`mall_id`, `created_at`, `album_id`) USING BTREE COMMENT '常用数据统计'
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '智能画册每天数据统计表' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for qimall_addons_album_goods_visit
-- ----------------------------
DROP TABLE IF EXISTS `qimall_addons_album_goods_visit`;
CREATE TABLE `qimall_addons_album_goods_visit`  (
  `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `mall_id` int(10) UNSIGNED NOT NULL COMMENT '商城ID',
  `album_id` int(10) UNSIGNED NOT NULL COMMENT '内容 id',
  `goods_id` int(10) UNSIGNED NOT NULL COMMENT '商品 id',
  `created_at` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
  `updated_at` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
  `visit_count` int(11) NULL DEFAULT NULL COMMENT '访问人数',
  `pay_count` int(11) NULL DEFAULT NULL COMMENT '支付人数',
  `amount` decimal(11, 2) NULL DEFAULT NULL COMMENT '支付金额',
  `status` int(11) NULL DEFAULT 1 COMMENT '-1是删除，0是禁用，1是启用',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '画册商品统计表' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for qimall_addons_album_order
-- ----------------------------
DROP TABLE IF EXISTS `qimall_addons_album_order`;
CREATE TABLE `qimall_addons_album_order`  (
  `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
  `mall_id` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '商城ID',
  `order_id` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '订单id',
  `order_detail_id` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '订单详情id',
  `user_id` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '用户id',
  `album_id` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '画册id',
  `album_page_id` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '画册页id',
  `goods_id` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '商品id',
  `order_count` int(11) NULL DEFAULT NULL COMMENT '订单数量',
  `amount` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '支付金额',
  `created_at` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '添加时间戳',
  `date` date NOT NULL COMMENT '日期',
  `updated_at` int(11) NULL DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `mall_album`(`mall_id`, `album_id`) USING BTREE COMMENT '统计快速查'
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '智能画册订单表' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for qimall_addons_album_page
-- ----------------------------
DROP TABLE IF EXISTS `qimall_addons_album_page`;
CREATE TABLE `qimall_addons_album_page`  (
  `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
  `album_id` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '画册ID',
  `image` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '画册单页图片',
  `goods_ids` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '商品id，多个商品逗号隔开',
  `created_at` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '添加时间戳',
  `updated_at` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间戳',
  `mall_id` int(11) NULL DEFAULT NULL COMMENT '商城ID',
  `status` int(11) NULL DEFAULT 1 COMMENT '-1是删除，0是禁用，1是启用',
  `sort` int(11) NULL DEFAULT NULL COMMENT '排序',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `mall_album`(`album_id`) USING BTREE COMMENT '统计查询'
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '智能画册页面' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for qimall_addons_album_page_share
-- ----------------------------
DROP TABLE IF EXISTS `qimall_addons_album_page_share`;
CREATE TABLE `qimall_addons_album_page_share`  (
  `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
  `album_id` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '画册ID',
  `album_page_id` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '画册页ID',
  `mall_id` int(11) UNSIGNED NOT NULL DEFAULT 0,
  `user_id` int(11) UNSIGNED NOT NULL DEFAULT 0,
  `created_at` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '分享时间',
  `date` date NOT NULL COMMENT '日期',
  `updated_at` int(11) NULL DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `album`(`album_id`, `created_at`, `mall_id`) USING BTREE COMMENT '相册ID'
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '智能画册页面分享记录表' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for qimall_addons_album_statistics
-- ----------------------------
DROP TABLE IF EXISTS `qimall_addons_album_statistics`;
CREATE TABLE `qimall_addons_album_statistics`  (
  `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `mall_id` int(10) UNSIGNED NOT NULL COMMENT '商城ID',
  `visit_count` int(10) NULL DEFAULT 0 COMMENT '访问量，一个会员最多占一个访问量',
  `views_count` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '浏览量',
  `shares_click_count` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '分享后用户点击访问商品统计',
  `shares_count` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '分享量',
  `stop_time` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '停留时长单位（秒）',
  `goods_click_count` int(10) NULL DEFAULT 0 COMMENT '商品点击',
  `goods_views_count` int(11) NULL DEFAULT 0 COMMENT '商品访问统计',
  `order_count` int(11) NULL DEFAULT 0 COMMENT '订单统计',
  `created_at` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
  `updated_at` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
  `goods_amount` decimal(11, 2) UNSIGNED NULL DEFAULT 0.00 COMMENT '成交金额',
  `album_id` int(11) NULL DEFAULT NULL COMMENT '智能画册ID',
  `pay_count` int(11) NULL DEFAULT 0 COMMENT '支付人数',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `mall_album`(`mall_id`, `created_at`) USING BTREE COMMENT '统计查询'
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '智能画册每个画册数据统计表' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for qimall_addons_album_visit
-- ----------------------------
DROP TABLE IF EXISTS `qimall_addons_album_visit`;
CREATE TABLE `qimall_addons_album_visit`  (
  `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
  `album_id` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '画册ID',
  `album_page_id` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '画册页ID',
  `mall_id` int(11) UNSIGNED NOT NULL DEFAULT 0,
  `user_id` int(11) UNSIGNED NOT NULL DEFAULT 0,
  `begin_time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '浏览开始时间',
  `end_time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '浏览结束时间',
  `stay_time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '浏览时长',
  `date` date NOT NULL COMMENT '日期',
  `created_at` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '添加时间戳',
  `updated_at` int(11) NULL DEFAULT NULL COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `mall_album`(`album_id`, `mall_id`, `user_id`, `created_at`, `stay_time`) USING BTREE COMMENT '统计查询'
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '智能画册访问页面' ROW_FORMAT = DYNAMIC;
