|
|
@@ -5,22 +5,24 @@ CREATE TABLE `xhHb` (
|
|
|
`mainId` int(11) NOT NULL DEFAULT '0' COMMENT '中央id',
|
|
|
`shopId` int(11) NOT NULL DEFAULT '0' COMMENT '门店id',
|
|
|
`userId` int(11) NOT NULL DEFAULT '0' COMMENT '用户id',
|
|
|
- `name` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '红包' COMMENT '红包名称',
|
|
|
- `amount` int(11) NOT NULL DEFAULT '0' COMMENT '红包金额,单位元',
|
|
|
- `miniCost` int(11) NOT NULL DEFAULT '0' COMMENT '最低消费金额,0表示没有要求',
|
|
|
- `beginTime` int(11) NOT NULL DEFAULT '0' COMMENT '开始时间',
|
|
|
- `endTime` int(11) NOT NULL DEFAULT '0' COMMENT '实际到期时间,永不过期用数值4102416000表示即2100-01-01 00:00:00,不另外建字段,方便查询',
|
|
|
- `willTime` int(11) NOT NULL DEFAULT '0' COMMENT '将要到期时间,永不过期用数值4102416000表示即2100-01-01 00:00:00,不另外建字段,方便查询',
|
|
|
+ `customId` int(11) NOT NULL DEFAULT '0' COMMENT '客户表id',
|
|
|
+ `name` varchar(20) NOT NULL DEFAULT '红包' COMMENT '红包名称',
|
|
|
+ `amount` decimal(9,2) NOT NULL DEFAULT '0.00' COMMENT '红包金额,单位元',
|
|
|
+ `minConsume` decimal(9,2) NOT NULL DEFAULT '0.00' COMMENT '最低消费金额,0表示没有要求',
|
|
|
+ `beginTime` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '开始时间',
|
|
|
+ `endTime` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '实际到期时间,永不过期用数值4102416000表示即2100-01-01 00:00:00,不另外建字段,方便查询',
|
|
|
+ `willTime` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '将要到期时间,永不过期用数值4102416000表示即2100-01-01 00:00:00,不另外建字段,方便查询',
|
|
|
`duration` smallint(6) NOT NULL DEFAULT '1' COMMENT '有效时长,天',
|
|
|
`getType` tinyint(4) NOT NULL DEFAULT '0' COMMENT '取得方式 0新人领取 1门店发放 2充值赠送',
|
|
|
- `status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '状态 -1作废 0未使用 1已使用。0时还要结合deadline来判断是否过期',
|
|
|
+ `status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '状态 -1作废 0未使用 1已使用。0时还要结合endTime来判断是否过期',
|
|
|
`orderId` int(11) NOT NULL DEFAULT '0' COMMENT '红包使用的订单id',
|
|
|
- `createdAt` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
|
|
|
- `updatedAt` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, CURRENT_TIMESTAMP COMMENT '修改时间',
|
|
|
+ `createdAt` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
|
+ `updatedAt` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
|
|
PRIMARY KEY (`id`),
|
|
|
KEY `idx_mainId` (`mainId`),
|
|
|
KEY `idx_shopId` (`shopId`),
|
|
|
- KEY `idx_userId_createdAt_status` (`userId`, `createdAt`, `status`),
|
|
|
+ KEY `idx_userId` (`userId`),
|
|
|
+ KEY `idx_customId_createdAt_status` (`customId`, `createdAt`, `status`),
|
|
|
KEY `idx_createdAt_status` (`createdAt`, `status`),
|
|
|
KEY `idx_orderId` (`orderId`)
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='零售端红包表';
|
|
|
@@ -30,16 +32,16 @@ CREATE TABLE `xhHb` (
|
|
|
```
|
|
|
CREATE TABLE `xhHbManage` (
|
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
|
- `hbId` int(11) NOT NULL DEFAULT '0' COMMENT '红包id',
|
|
|
+ `hbId` int(11) NOT NULL DEFAULT '0' COMMENT '零售端红包表id',
|
|
|
`getType` tinyint(4) NOT NULL DEFAULT '0' COMMENT '取得方式 0新人领取 1门店发放 2充值赠送',
|
|
|
`getTargetId` int(11) NOT NULL DEFAULT '0' COMMENT '根据getType判断是哪个表的id,新人领取主键id,门店发放主键id,充值赠送主键id,没有则不存',
|
|
|
`createStaffId` int(11) NOT NULL DEFAULT '0' COMMENT '发放人',
|
|
|
- `createStaffName` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '发放人名称',
|
|
|
+ `createStaffName` varchar(30) NOT NULL DEFAULT '' COMMENT '发放人名称',
|
|
|
`remark` varchar(200) NOT NULL DEFAULT '' COMMENT '备注',
|
|
|
`cancelStaffId` int(11) NOT NULL DEFAULT '0' COMMENT '作废人',
|
|
|
- `cancelStaffName` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '作废人名称',
|
|
|
+ `cancelStaffName` varchar(30) NOT NULL DEFAULT '' COMMENT '作废人名称',
|
|
|
`cancelTime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' COMMENT '作废时间',
|
|
|
- `createdAt` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
|
|
|
+ `createdAt` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
|
`updatedAt` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
|
PRIMARY KEY (`id`),
|
|
|
KEY `idx_hbId` (`hbId`),
|