-- ----------------------------
-- Table structure for qimall_addons_user_gift_grant_log
-- ----------------------------
DROP TABLE IF EXISTS `qimall_addons_user_gift_grant_log`;
CREATE TABLE `qimall_addons_user_gift_grant_log`  (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `mall_id` int(10) NOT NULL COMMENT '商城id',
  `gift_type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '礼包类型',
  `user_id` int(10) NOT NULL DEFAULT 0 COMMENT '用户id',
  `coupon` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '优惠券详细',
  `coupon_num` int(10) NULL DEFAULT 0 COMMENT '优惠券数量',
  `score` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '积分',
  `balance` decimal(10, 2) NULL DEFAULT NULL COMMENT '余额',
  `status` tinyint(4) NOT NULL DEFAULT 1 COMMENT '状态[-1:删除;0:禁用;1启用]',
  `created_at` int(10) NOT NULL DEFAULT 0 COMMENT '创建时间',
  `updated_at` int(10) NOT NULL DEFAULT 0 COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `mall_id`(`mall_id`) USING BTREE,
  INDEX `user_id`(`user_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '会员礼包发放明细' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Table structure for qimall_addons_user_gift_statistics
-- ----------------------------
DROP TABLE IF EXISTS `qimall_addons_user_gift_statistics`;
CREATE TABLE `qimall_addons_user_gift_statistics`  (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `mall_id` int(10) NOT NULL DEFAULT 0 COMMENT '商城id',
  `gift_type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '礼包类型',
  `coupon` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '优惠券详细',
  `coupon_num` int(10) NULL DEFAULT 0 COMMENT '优惠券数量',
  `actual_coupon_num` int(10) NULL DEFAULT 0 COMMENT '实发优惠券数量',
  `score` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '应发积分',
  `actual_score` decimal(10, 2) NULL DEFAULT 0.00 COMMENT '实发积分',
  `balance` decimal(10, 2) NULL DEFAULT NULL COMMENT '应发余额',
  `actual_balance` decimal(10, 2) NULL DEFAULT NULL COMMENT '实发余额',
  `grant_num` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '发放总人数',
  `status` tinyint(4) NOT NULL DEFAULT 1 COMMENT '状态[-1:删除;0:禁用;1启用]',
  `created_at` int(10) NOT NULL DEFAULT 0 COMMENT '创建时间',
  `updated_at` int(10) NOT NULL DEFAULT 0 COMMENT '更新时间',
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `mall_id`(`mall_id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '会员礼包发放统计' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- 插入定时任务表
-- ----------------------------
INSERT INTO `qimall_crontab_task`(`name`, `command`, `type`, `rule`, `is_warning`, `status`, `created_at`, `updated_at`) VALUES ('生日礼包定时任务', 'birthday-crontab/execute', 2, '0 0 2 * * *', 0, 1, 1640143513, 1640143513);

