-- ----------------------------
-- Table structure for qimall_addons_scratch
-- ----------------------------
DROP TABLE IF EXISTS `qimall_addons_scratch`;
CREATE TABLE `qimall_addons_scratch`  (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `mall_id` int(11) NOT NULL DEFAULT 0,
  `name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '奖品名称',
  `pic` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '奖品图片',
  `type` int(11) NOT NULL DEFAULT 0 COMMENT '1.红包2.余额3.优惠卷4.积分5.实物',
  `goods_id` int(11) NOT NULL DEFAULT 0 COMMENT '商品id',
  `attr_id` int(11) NOT NULL DEFAULT 0 COMMENT '商品规格id',
  `num` int(11) NOT NULL DEFAULT 0 COMMENT '数量',
  `price` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '红包价格',
  `coupon_id` int(11) NOT NULL DEFAULT 0 COMMENT '优惠券',
  `stock` int(11) NOT NULL DEFAULT 0 COMMENT '库存',
  `balance` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '余额',
  `status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态 0 关闭 1开启',
  `updated_at` int(11) NOT NULL DEFAULT 0,
  `created_at` int(11) NOT NULL DEFAULT 0,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '刮刮卡奖品表' ROW_FORMAT = COMPACT;

-- ----------------------------
-- Table structure for qimall_addons_scratch_log
-- ----------------------------
DROP TABLE IF EXISTS `qimall_addons_scratch_log`;
CREATE TABLE `qimall_addons_scratch_log`  (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `mall_id` int(11) NOT NULL DEFAULT 0,
  `scratch_id` int(11) NOT NULL DEFAULT 0,
  `user_id` int(11) NOT NULL DEFAULT 0,
  `status` int(11) NOT NULL DEFAULT 0 COMMENT ' 0预领取 1 未领取 2 已领取',
  `type` int(11) NOT NULL DEFAULT 0 COMMENT '1.红包2.余额3.优惠卷4.积分5.实物',
  `num` int(11) NOT NULL DEFAULT 0 COMMENT '积分数量',
  `detail` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '详情',
  `price` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '价格',
  `coupon_id` int(11) NOT NULL DEFAULT 0 COMMENT '优惠券id',
  `order_id` int(11) NOT NULL DEFAULT 0,
  `goods_id` int(11) NOT NULL DEFAULT 0 COMMENT '商品ID',
  `attr_id` int(11) NOT NULL DEFAULT 0 COMMENT '商品规格id',
  `raffled_at` int(11) NOT NULL DEFAULT 0 COMMENT '抽奖时间',
  `created_at` int(11) NOT NULL DEFAULT 0,
  `updated_at` int(11) NOT NULL DEFAULT 0 COMMENT '修改时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '刮刮卡抽奖记录' ROW_FORMAT = COMPACT;

-- ----------------------------
-- Table structure for qimall_addons_scratch_log_coupon_relation
-- ----------------------------
DROP TABLE IF EXISTS `qimall_addons_scratch_log_coupon_relation`;
CREATE TABLE `qimall_addons_scratch_log_coupon_relation`  (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `mall_id` int(11) NOT NULL DEFAULT 0,
  `user_id` int(11) NOT NULL DEFAULT 0,
  `user_coupon_id` int(11) NOT NULL DEFAULT 0 COMMENT '用户优惠券id',
  `scratch_log_id` int(11) NOT NULL DEFAULT 0 COMMENT '记录id',
  `status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态：-1删除，1正常；',
  `created_at` int(11) NOT NULL DEFAULT 0,
  `updated_at` int(11) NOT NULL DEFAULT 0 COMMENT '修改时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '刮刮卡优惠券中奖日志' ROW_FORMAT = COMPACT;

-- ----------------------------
-- Table structure for qimall_addons_scratch_order
-- ----------------------------
DROP TABLE IF EXISTS `qimall_addons_scratch_order`;
CREATE TABLE `qimall_addons_scratch_order`  (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `mall_id` int(11) NOT NULL DEFAULT 0,
  `scratch_log_id` int(11) NOT NULL DEFAULT 0,
  `order_id` int(11) NOT NULL DEFAULT 0,
  `status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态：-1删除，1正常；',
  `created_at` int(11) NOT NULL DEFAULT 0,
  `updated_at` int(11) NOT NULL DEFAULT 0,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '刮刮卡商品中奖领取表' ROW_FORMAT = COMPACT;

-- ----------------------------
-- Table structure for qimall_addons_scratch_setting
-- ----------------------------
DROP TABLE IF EXISTS `qimall_addons_scratch_setting`;
CREATE TABLE `qimall_addons_scratch_setting`  (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `mall_id` int(11) NOT NULL DEFAULT 0,
  `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '小程序标题',
  `type` smallint(1) NOT NULL DEFAULT 0 COMMENT '1.天 2.用户',
  `probability` int(11) NOT NULL DEFAULT 0 COMMENT '概率',
  `oppty` int(11) NOT NULL DEFAULT 0 COMMENT '抽奖次数',
  `start_at` int(11) NOT NULL DEFAULT 0 COMMENT '开始时间',
  `end_at` int(11) NOT NULL DEFAULT 0 COMMENT '结束时间',
  `deplete_integral_num` int(11) NOT NULL DEFAULT 0 COMMENT '消耗积分',
  `rule` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '规则',
  `created_at` int(11) NOT NULL DEFAULT 0,
  `updated_at` int(11) NOT NULL DEFAULT 0,
  `payment_type` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '支付方式',
  `send_type` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '发货方式',
  `is_sms` tinyint(1) NOT NULL DEFAULT 0 COMMENT '开启短信提醒',
  `is_wechat` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否开启微信推送提醒',
  `is_mail` tinyint(1) NOT NULL DEFAULT 0 COMMENT '开启邮件提醒',
  `is_print` tinyint(1) NOT NULL DEFAULT 0 COMMENT '开启打印',
  `background_imgs` varchar(3000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '背景图设置',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '刮刮卡配置表' ROW_FORMAT = COMPACT;
