| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305 |
- -- ----------------------------
- -- Table structure for qimall_addons_coupon
- -- ----------------------------
- DROP TABLE IF EXISTS `qimall_addons_coupon`;
- CREATE TABLE `qimall_addons_coupon` (
- `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
- `mall_id` int(10) UNSIGNED NOT NULL,
- `mch_id` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '商户id',
- `store_id` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '门店id',
- `name` varchar(150) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '优惠券名称',
- `type` tinyint(1) NOT NULL DEFAULT 2 COMMENT '优惠券类型,1:折扣,2:满减',
- `discount` decimal(3, 2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '折扣率',
- `discount_limit` decimal(10, 2) UNSIGNED NULL DEFAULT NULL COMMENT '折扣优惠金额上限',
- `pic_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '优惠券图片(未使用)',
- `desc` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '优惠券简述(未使用)',
- `min_price` decimal(12, 2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '最低消费金额',
- `sub_price` decimal(12, 2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '优惠金额',
- `total_count` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '优惠券总数量',
- `sort` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '排序按升序排列',
- `expire_type` tinyint(1) NOT NULL DEFAULT 2 COMMENT '到期类型:1=领取后n天过期,2=指定有效期,3=领取后n天生效,生效后m天过期',
- `expire_day` int(10) UNSIGNED NOT NULL DEFAULT 1 COMMENT '有效天数,expire_type=1和3时',
- `effect_days` tinyint(3) UNSIGNED NOT NULL DEFAULT 1 COMMENT '领取到生效之间间隔的天数(领取后n天生效)',
- `begin_at` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '有效期开始时间',
- `end_at` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '有效期结束时间',
- `appoint_type` tinyint(4) NOT NULL DEFAULT 3 COMMENT '1 指定分类 2 指定商品 3全部',
- `rule` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '使用说明',
- `is_remind` tinyint(4) NOT NULL DEFAULT 0 COMMENT '是否开启提醒',
- `remind_days` tinyint(4) NOT NULL DEFAULT 3 COMMENT '提前提醒天数(到期前多少天提醒),is_remind=1 时有效',
- `is_receive_limit` tinyint(4) NOT NULL DEFAULT 0 COMMENT '是否限制领取',
- `receive_count` int(10) UNSIGNED NOT NULL DEFAULT 1 COMMENT '每人可以领取的数量,is_receive_limit=1时有意义',
- `is_member` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否指定会员等级',
- `is_original_use` tinyint(4) NOT NULL DEFAULT 0 COMMENT '是否原价购买使用(如果是,则只有原价购买商品时可以使用该优惠券)',
- `is_public_receive` tinyint(4) NOT NULL DEFAULT 1 COMMENT '是否公开领取,公开领取的优惠券会展示在商品详情页',
- `is_giving` tinyint(1) NOT NULL DEFAULT 0 COMMENT '启用优惠券转送功能:0-否;1-是;',
- `status` tinyint(4) NOT NULL DEFAULT 1 COMMENT '状态[-1:删除;0:禁用;1启用]',
- `coupon_status` tinyint(4) NOT NULL DEFAULT 1 COMMENT '优惠券状态,1:未开始,2:领取中,3:已过期,4:已失效(后台操作失效)',
- `is_giving_reward` tinyint(4) NOT NULL DEFAULT 0 COMMENT '是否开启转赠奖励,开启后转赠优惠券自己可以获得额外奖励;is_giving=1 时有效',
- `is_consume_reward` tinyint(4) NOT NULL DEFAULT 0 COMMENT '是否开启使用奖励,开启后使用该优惠券可以获得额外奖励;is_giving=1 时有效',
- `qrcode_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '优惠券分享二维码保存路径,二维码包含内容:页面路径+优惠券id',
- `poster_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '优惠券分享海报图片保存路径',
- `created_at` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
- `updated_at` int(10) UNSIGNED NOT NULL DEFAULT 0,
- PRIMARY KEY (`id`) USING BTREE,
- INDEX `idx_mall_id`(`mall_id`) USING BTREE,
- INDEX `idx_type`(`type`) USING BTREE,
- INDEX `idx_sort`(`sort`) USING BTREE,
- INDEX `idx_expire_time`(`begin_at`, `end_at`) USING BTREE
- ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '优惠券' ROW_FORMAT = Dynamic;
- -- ----------------------------
- -- Table structure for qimall_addons_coupon_cat_relate
- -- ----------------------------
- DROP TABLE IF EXISTS `qimall_addons_coupon_cat_relate`;
- CREATE TABLE `qimall_addons_coupon_cat_relate` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `coupon_id` int(11) NOT NULL COMMENT '优惠券id',
- `cate_id` int(11) NOT NULL COMMENT '分类id',
- `created_at` int(11) NOT NULL DEFAULT 0 COMMENT '创建时间',
- `updated_at` int(11) NOT NULL DEFAULT 0 COMMENT '修改时间',
- PRIMARY KEY (`id`) USING BTREE
- ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '分类下相关优惠券' ROW_FORMAT = DYNAMIC;
- -- ----------------------------
- -- Table structure for qimall_addons_coupon_give_item_setting
- -- ----------------------------
- DROP TABLE IF EXISTS `qimall_addons_coupon_give_item_setting`;
- CREATE TABLE `qimall_addons_coupon_give_item_setting` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `mall_id` int(11) NOT NULL COMMENT '商城ID',
- `is_enable` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否独立设置:0:否;1是',
- `item_id` int(11) NOT NULL DEFAULT 0 COMMENT '项目id',
- `item_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '0' COMMENT '项目类型:商品goods',
- `status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态[-1:删除;0:禁用;1启用]',
- `created_at` int(11) NOT NULL DEFAULT 0,
- `updated_at` int(11) NOT NULL DEFAULT 0,
- 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;
- -- ----------------------------
- -- Table structure for qimall_addons_coupon_give_item_setting_detail
- -- ----------------------------
- DROP TABLE IF EXISTS `qimall_addons_coupon_give_item_setting_detail`;
- CREATE TABLE `qimall_addons_coupon_give_item_setting_detail` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `mall_id` int(11) NOT NULL COMMENT '商城ID',
- `coupon_give_item_setting_id` int(11) NOT NULL DEFAULT 0 COMMENT '设置id',
- `coupon_id` int(11) NOT NULL DEFAULT 0 COMMENT '优惠券id',
- `num` int(11) NOT NULL DEFAULT 0 COMMENT '赠送数量',
- `status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态[-1:删除;0:禁用;1启用]',
- `created_at` int(11) NOT NULL DEFAULT 0,
- `updated_at` int(11) NOT NULL DEFAULT 0,
- 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;
- -- ----------------------------
- -- Table structure for qimall_addons_coupon_good_statistics
- -- ----------------------------
- DROP TABLE IF EXISTS `qimall_addons_coupon_good_statistics`;
- CREATE TABLE `qimall_addons_coupon_good_statistics` (
- `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
- `mall_id` int(10) UNSIGNED NOT NULL,
- `coupon_id` int(10) UNSIGNED NOT NULL,
- `good_id` int(10) UNSIGNED NOT NULL,
- `booking_number` int(11) NOT NULL DEFAULT 0 COMMENT '该商品使用该优惠券下单的总数量',
- `payed_number` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '使用该优惠券已支付的该商品数量',
- `booking_user_number` int(11) NOT NULL DEFAULT 0 COMMENT '该商品使用该优惠券下单的总人数',
- `buyed_user_number` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '使用该优惠券已购买该商品人数',
- `created_at` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
- `updated_at` int(10) UNSIGNED NOT NULL DEFAULT 0,
- PRIMARY KEY (`id`) USING BTREE,
- INDEX `idx_mall_coupon_id`(`mall_id`, `coupon_id`) USING BTREE
- ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '使用优惠券购买的商品的相关数据统计' ROW_FORMAT = DYNAMIC;
- -- ----------------------------
- -- Table structure for qimall_addons_coupon_goods_relate
- -- ----------------------------
- DROP TABLE IF EXISTS `qimall_addons_coupon_goods_relate`;
- CREATE TABLE `qimall_addons_coupon_goods_relate` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `coupon_id` int(11) NOT NULL COMMENT '优惠券id',
- `goods_id` int(11) NOT NULL COMMENT '商品id',
- `created_at` int(11) NOT NULL DEFAULT 0 COMMENT '创建时间',
- `updated_at` int(11) NOT NULL DEFAULT 0 COMMENT '修改时间',
- PRIMARY KEY (`id`) USING BTREE
- ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '商品优惠券表' ROW_FORMAT = DYNAMIC;
- -- ----------------------------
- -- Table structure for qimall_addons_coupon_member_relate
- -- ----------------------------
- DROP TABLE IF EXISTS `qimall_addons_coupon_member_relate`;
- CREATE TABLE `qimall_addons_coupon_member_relate` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `mall_id` int(11) NOT NULL,
- `coupon_id` int(11) NOT NULL COMMENT '优惠券id',
- `member_level` int(11) NOT NULL COMMENT '会员等级',
- `created_at` int(11) NOT NULL DEFAULT 0 COMMENT '创建时间',
- `updated_at` int(11) NOT NULL DEFAULT 0,
- PRIMARY KEY (`id`) USING BTREE
- ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '会员等级下优惠券表' ROW_FORMAT = DYNAMIC;
- -- ----------------------------
- -- Table structure for qimall_addons_coupon_remind
- -- ----------------------------
- DROP TABLE IF EXISTS `qimall_addons_coupon_remind`;
- CREATE TABLE `qimall_addons_coupon_remind` (
- `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
- `mall_id` int(10) UNSIGNED NOT NULL,
- `coupon_id` int(10) UNSIGNED NOT NULL,
- `user_id` int(10) UNSIGNED NOT NULL,
- `expire_time` int(10) UNSIGNED NOT NULL,
- `status` tinyint(4) NOT NULL DEFAULT 0 COMMENT '状态[-1:删除;0:禁用;1启用]',
- `send_status` tinyint(4) NOT NULL DEFAULT 2 COMMENT '提醒状态,1:未发送提醒,2:已发送提醒,3:不需要发送提醒,已使用或者已转赠或者优惠券已过期或者优惠券已经失效',
- `created_at` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
- `updated_at` int(10) UNSIGNED NOT NULL DEFAULT 0,
- PRIMARY KEY (`id`) USING BTREE,
- INDEX `idx_mall_coupon_user_id`(`mall_id`, `coupon_id`, `user_id`) USING BTREE
- ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '优惠券过期提醒记录表' ROW_FORMAT = DYNAMIC;
- -- ----------------------------
- -- Table structure for qimall_addons_coupon_reward
- -- ----------------------------
- DROP TABLE IF EXISTS `qimall_addons_coupon_reward`;
- CREATE TABLE `qimall_addons_coupon_reward` (
- `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
- `mall_id` int(10) UNSIGNED NOT NULL,
- `coupon_id` int(10) UNSIGNED NOT NULL COMMENT '优惠券id',
- `reward_type` tinyint(4) NOT NULL DEFAULT 0 COMMENT '奖励类型,1:转赠奖励,2:使用奖励',
- `balance` decimal(12, 2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '奖励余额',
- `score` decimal(12, 2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '奖励积分',
- `red_packet` decimal(12, 2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '奖励红包',
- `reward_currency_type` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '奖励货币种类,记录货币 code',
- `number` decimal(12, 2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '奖励货币数量',
- `created_at` int(10) UNSIGNED NOT NULL DEFAULT 0,
- `updated_at` int(10) UNSIGNED NOT NULL DEFAULT 0,
- PRIMARY KEY (`id`) USING BTREE,
- INDEX `idx_mallcoupon_id`(`mall_id`, `coupon_id`) USING BTREE
- ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '优惠券奖励记录表' ROW_FORMAT = DYNAMIC;
- -- ----------------------------
- -- Table structure for qimall_addons_coupon_reward_log
- -- ----------------------------
- DROP TABLE IF EXISTS `qimall_addons_coupon_reward_log`;
- CREATE TABLE `qimall_addons_coupon_reward_log` (
- `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
- `mall_id` int(10) UNSIGNED NOT NULL,
- `user_id` int(10) UNSIGNED NOT NULL,
- `coupon_id` int(10) UNSIGNED NOT NULL COMMENT '优惠券id',
- `reward_number` decimal(12, 2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '奖励数额',
- `reward_scenarios` tinyint(4) NOT NULL DEFAULT 0 COMMENT '奖励场景,1:转赠奖励,2:使用奖励',
- `reward_type` tinyint(4) NOT NULL DEFAULT 0 COMMENT '奖励类型,1:余额,2:红包,3:积分,4:系统虚拟货币',
- `reward_type_code` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '奖励类型代码,balance:余额,red_packet:红包,score:积分,如果是虚拟货币,则记录其 code',
- `source_table` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '数据来源表',
- `source_id` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '数据来源id',
- `created_at` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
- `updated_at` int(10) UNSIGNED NOT NULL DEFAULT 0,
- PRIMARY KEY (`id`) USING BTREE,
- INDEX `idx_mall_user_coupon_id`(`mall_id`, `user_id`, `coupon_id`) USING BTREE
- ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '优惠券奖励发放记录' ROW_FORMAT = DYNAMIC;
- -- ----------------------------
- -- Table structure for qimall_addons_coupon_share_log
- -- ----------------------------
- DROP TABLE IF EXISTS `qimall_addons_coupon_share_log`;
- CREATE TABLE `qimall_addons_coupon_share_log` (
- `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
- `mall_id` int(10) UNSIGNED NOT NULL,
- `coupon_id` int(10) UNSIGNED NOT NULL,
- `user_coupon_id` int(11) NOT NULL DEFAULT 0 COMMENT '赠送者coupon_user_relate表的id',
- `get_user_coupon_id` int(11) NOT NULL DEFAULT 0 COMMENT '领取者coupon_user_relate表的id',
- `giving_user_id` int(10) UNSIGNED NOT NULL COMMENT '转出会员id,值为 0 说明是平台赠送的优惠券',
- `receive_user_id` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '受赠会员id,尚未被领取此字段值为0',
- `giving_status` tinyint(4) NOT NULL DEFAULT 1 COMMENT '转赠状态,1:转赠中(已分享出去,未被领取),2:已被领取',
- `created_at` int(10) UNSIGNED NOT NULL DEFAULT 0,
- `updated_at` int(10) UNSIGNED NOT NULL DEFAULT 0,
- PRIMARY KEY (`id`) USING BTREE,
- INDEX `idx_mall_coupon_id`(`mall_id`, `coupon_id`) USING BTREE,
- INDEX `idx_gr_user_id`(`giving_user_id`, `receive_user_id`) USING BTREE
- ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '优惠券分享记录表' ROW_FORMAT = DYNAMIC;
- -- ----------------------------
- -- Table structure for qimall_addons_coupon_statistics
- -- ----------------------------
- DROP TABLE IF EXISTS `qimall_addons_coupon_statistics`;
- CREATE TABLE `qimall_addons_coupon_statistics` (
- `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
- `mall_id` int(10) UNSIGNED NOT NULL,
- `coupon_id` int(10) UNSIGNED NOT NULL,
- `received_number` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '已领取数量',
- `used_number` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '已使用数量',
- `giveing_times` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '优惠券被转赠的次数',
- `use_probability` decimal(5, 2) NOT NULL DEFAULT 0.00 COMMENT '优惠券使用率,等于领取数量比使用数量',
- `total_discount_amount` decimal(12, 2) NOT NULL DEFAULT 0.00 COMMENT '累计优惠金额',
- `receive_user_number` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '领券会员总数量',
- `use_user_number` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '用券会员总数量',
- `giving_user_number` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '转赠优惠券的会员总数量',
- `use_order_number` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '使用优惠券支付的订单总数量',
- `total_use_coupon_payed_amount` decimal(12, 2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '使用优惠券后实际支付的总金额',
- `total_payed_amount` decimal(12, 2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '使用优惠券支付的订单原价总金额',
- `created_at` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
- `updated_at` int(10) UNSIGNED NOT NULL DEFAULT 0,
- PRIMARY KEY (`id`) USING BTREE,
- INDEX `idx_mall_coupon_id`(`mall_id`, `coupon_id`) USING BTREE
- ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '优惠券相关数据统计记录表' ROW_FORMAT = DYNAMIC;
- -- ----------------------------
- -- Table structure for qimall_addons_coupon_use_log
- -- ----------------------------
- DROP TABLE IF EXISTS `qimall_addons_coupon_use_log`;
- CREATE TABLE `qimall_addons_coupon_use_log` (
- `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `mall_id` int(11) NOT NULL DEFAULT 0 COMMENT 'mall_id',
- `user_id` int(11) NOT NULL DEFAULT 0 COMMENT 'user_id',
- `order_id` int(11) NOT NULL DEFAULT 0 COMMENT 'order_id',
- `coupon_id` int(11) NOT NULL DEFAULT 0 COMMENT 'coupon_id',
- `user_coupon_id` int(11) NOT NULL DEFAULT 0 COMMENT 'user_coupon_id',
- `status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态[-1:删除;0:禁用;1启用]',
- `created_at` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
- `updated_at` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '修改时间',
- PRIMARY KEY (`id`) USING BTREE,
- INDEX `idx_user_coupon_id`(`user_coupon_id`) USING BTREE
- ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '优惠券使用记录表' ROW_FORMAT = DYNAMIC;
- -- ----------------------------
- -- Table structure for qimall_addons_coupon_user_relate
- -- ----------------------------
- DROP TABLE IF EXISTS `qimall_addons_coupon_user_relate`;
- CREATE TABLE `qimall_addons_coupon_user_relate` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `mall_id` int(11) NOT NULL,
- `user_id` int(11) NOT NULL COMMENT '用户',
- `coupon_id` int(11) NOT NULL COMMENT '优惠卷',
- `coupon_status` tinyint(4) NOT NULL DEFAULT 2 COMMENT '优惠券状态,2:领取中,3:已过期,4:已失效(后台操作失效、转赠被领取后、使用之后)',
- `status` tinyint(4) NOT NULL DEFAULT 1 COMMENT '状态[-1:删除;0:禁用;1启用]',
- `start_time` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '优惠券开始生效时间',
- `end_time` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '优惠券过期时间',
- `is_use` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否已使用:0=未使用,1=已使用',
- `is_giving` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否已赠送:0-否;1-是;',
- `giving_status` tinyint(4) NOT NULL DEFAULT 0 COMMENT '转赠状态,0:未转赠,1:转赠中,2:已被领取(转赠完成)',
- `receive_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '获取方式,如\"商品详情页领取\"',
- `receive_platform` varchar(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'h5' COMMENT '领取来源,从哪个平台领取的,wechat:微信,mp-wx:微信小程序,h5,app,work-wx:企业微信',
- `is_force_failure` tinyint(4) NOT NULL DEFAULT 0 COMMENT '是否强制失效,后台操作用户已领取的优惠券失效',
- `is_send_reward` tinyint(4) NOT NULL DEFAULT 0 COMMENT '是否已经发放优惠券奖励,1:是,0:否',
- `created_at` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
- `updated_at` int(10) UNSIGNED NOT NULL DEFAULT 0,
- PRIMARY KEY (`id`) USING BTREE,
- INDEX `idx_cpid`(`coupon_id`) USING BTREE,
- INDEX `idx_cpstatus`(`coupon_status`) USING BTREE,
- INDEX `idx_user_id`(`user_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
- ('定时清理过期的优惠券', 'coupon-crontab/clear', 2, '0 */30 * * * *', 0, 0, 1638599725, 1640861509),
- ('自动更新优惠券状态', 'coupon/coupon-crontab/update-coupon-status', 2, '0 */1 * * * *', 0, 1, 1640861018, 1644290563),
- ('优惠券相关统计', 'coupon/coupon-crontab/coupon-statistics', 2, '0 */3 * * * *', 0, 1, 1640861071, 1644290607),
- ('统计商品使用优惠券相关数据', 'coupon/coupon-crontab/coupon-good-stat', 2, '0 */3 * * * *', 0, 1, 1640861143, 1644290634);
- alter table qimall_addons_coupon add `is_open_screen` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否开屏显示';
|