后台配置抽奖活动:活动列表、创建活动、编辑活动、删除活动
C端:首页、抽奖动画、中奖弹框、我的奖品
数据库表: 1. 抽奖活动表 2. 奖品字典表 3. 抽奖活动奖品配置表 4. 中奖记录表 5. 抽奖记录表
1.抽奖活动表
xxxxxxxxxx
191CREATE TABLE `t_lottery_act` (
2 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
3 `name` varchar(100) NOT NULL DEFAULT '' COMMENT '活动名称',
4 `rule_intro` text COMMENT '规则说明',
5 `rule_config` text COMMENT '针对每个活动的个性化中奖规格配置,json格式',
6 `online_start_time` int(10) unsigned DEFAULT '0' COMMENT '活动上线时间,活动链接可以访问了',
7 `online_end_time` int(10) unsigned DEFAULT '0' COMMENT '活动下线时间,活动链接不能访问',
8 `act_start_time` int(10) unsigned DEFAULT '0' COMMENT '活动开始时间,说明活动开始举行了',
9 `act_end_time` int(10) unsigned DEFAULT '0' COMMENT '活动结束时间,活动结束,停止抽奖',
10 `share_title` varchar(100) DEFAULT '' COMMENT '分享标题',
11 `share_icon` varchar(255) DEFAULT '' COMMENT '分享图片地址',
12 `share_intro` varchar(255) DEFAULT '' COMMENT '分享描述',
13 `act_ext` text COMMENT '活动扩展信息,json格式',
14 `status` tinyint(4) unsigned DEFAULT '1' COMMENT '状态 1:正常 0:删除',
15 `created_at` int(10) unsigned DEFAULT '0' COMMENT '创建时间',
16 `updated_at` int(10) unsigned DEFAULT '0' COMMENT '更新时间',
17 `deleted_at` int(10) unsigned DEFAULT '0' COMMENT '删除时间',
18 PRIMARY KEY (`id`)
19) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='抽奖活动表';
xxxxxxxxxx
131CREATE TABLE `t_lottery_prize` (
2 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
3 `prize_name` varchar(100) NOT NULL DEFAULT '' COMMENT '奖品名称',
4 `prize_code` varchar(100) DEFAULT NULL COMMENT '奖品唯一代号,用于处理特殊逻辑',
5 `prize_icon` varchar(255) DEFAULT '' COMMENT '奖品图片',
6 `prize_type` tinyint(4) unsigned DEFAULT '0' COMMENT '奖品类型,1.虚拟物品-系统在线发放(如金币),2.邮寄实物(需要邮寄的,如电视,手机),3.用于填坑位的未中奖奖品(如谢谢参与),4.线下处理物品(如充值卡,线下人工转现金)',
7 `prize_ext` text COMMENT '奖品扩展信息,json格式',
8 `status` tinyint(4) unsigned DEFAULT '1' COMMENT '状态 1:正常 0:删除',
9 `created_at` int(10) unsigned DEFAULT '0' COMMENT '创建时间',
10 `updated_at` int(10) unsigned DEFAULT '0' COMMENT '更新时间',
11 `deleted_at` int(10) unsigned DEFAULT '0' COMMENT '删除时间',
12 PRIMARY KEY (`id`)
13) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='奖品字典表';
xxxxxxxxxx
171CREATE TABLE `t_lottery_act_prize` (
2 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
3 `act_id` int(10) unsigned DEFAULT '0' COMMENT '活动Id',
4 `prize_id` int(10) unsigned DEFAULT '0' COMMENT '奖品Id',
5 `prize_info` varchar(1000) DEFAULT '' COMMENT '冗余原始奖品信息,因为奖品信息不能修改,json格式',
6 `prize_total_num` int(10) unsigned DEFAULT '0' COMMENT '奖品总数量,prize_total_num=prize_num+win_num',
7 `prize_num` int(10) unsigned DEFAULT '0' COMMENT '奖品库存,剩余数量',
8 `win_num` int(10) unsigned DEFAULT '0' COMMENT '已中奖数量',
9 `act_prize_rule` text COMMENT '当前活动下当前奖品中奖规则配置,如中奖概率,json格式',
10 `act_prize_ext` text COMMENT '当前活动下当前奖品扩展信息,json格式',
11 `status` tinyint(4) unsigned DEFAULT '1' COMMENT '状态 1:正常 0:删除',
12 `created_at` int(10) unsigned DEFAULT '0' COMMENT '创建时间',
13 `updated_at` int(10) unsigned DEFAULT '0' COMMENT '更新时间',
14 `deleted_at` int(10) unsigned DEFAULT '0' COMMENT '删除时间',
15 PRIMARY KEY (`id`),
16 KEY `idx_actid` (`act_id`) USING BTREE
17) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='抽奖活动奖品配置表';
xxxxxxxxxx
221CREATE TABLE `t_lottery_win` (
2 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
3 `userid` int(10) unsigned DEFAULT '0' COMMENT '用户userid',
4 `act_id` int(10) unsigned DEFAULT '0' COMMENT '活动Id',
5 `prize_id` int(10) unsigned DEFAULT '0' COMMENT '奖品Id',
6 `user_ip` char(15) DEFAULT '' COMMENT '用户ip',
7 `rule_snapshot` text COMMENT '中奖时的规则快照,json格式',
8 `prize_snapshot` text COMMENT '中奖时的奖品快照,json格式',
9 `win_ext` text COMMENT '预览扩展数据,json格式',
10 `user_realname` varchar(50) DEFAULT '' COMMENT '用户姓名,中奖时填写',
11 `user_mobile` char(11) DEFAULT '' COMMENT '用户手机号,中奖时填写',
12 `user_address` varchar(255) DEFAULT '' COMMENT '用户收货地址,中奖时填写',
13 `user_zip` varchar(10) DEFAULT '' COMMENT '用户邮编,中奖时填写',
14 `hashkey` char(32) DEFAULT NULL COMMENT '防并发,防重复记录,值唯一',
15 `fafang_status` tinyint(4) unsigned DEFAULT '0' COMMENT '0无需发放,1待发放,2发放流程中(邮件中),3已发放完成成功,4发放失败',
16 `status` tinyint(4) unsigned DEFAULT '1' COMMENT '状态 1:正常 0:删除',
17 `created_at` int(10) unsigned DEFAULT '0' COMMENT '创建时间,中奖抽奖',
18 `updated_at` int(10) unsigned DEFAULT '0' COMMENT '更新时间',
19 `deleted_at` int(10) unsigned DEFAULT '0' COMMENT '删除时间',
20 PRIMARY KEY (`id`),
21 UNIQUE KEY `udx_hashkey` (`hashkey`) USING BTREE
22) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='中奖记录表';
xxxxxxxxxx
161CREATE TABLE `t_lottery_log` (
2 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
3 `userid` int(10) unsigned DEFAULT '0' COMMENT '用户userid,抽奖人',
4 `act_id` int(10) unsigned DEFAULT '0' COMMENT '活动Id',
5 `user_ip` char(15) DEFAULT '' COMMENT '用户ip',
6 `log_ext` text COMMENT '预览扩展数据,如是否中奖,中奖Id,json格式',
7 `hashkey` varchar(32) DEFAULT NULL COMMENT '防并发,防重复记录,值唯一',
8 `date` char(8) DEFAULT '0' COMMENT '抽奖日期,年月日',
9 `status` tinyint(4) unsigned DEFAULT '1' COMMENT '状态 1:正常 0:删除',
10 `created_at` int(10) unsigned DEFAULT '0' COMMENT '创建时间,抽奖时间',
11 `updated_at` int(10) unsigned DEFAULT '0' COMMENT '更新时间',
12 `deleted_at` int(10) unsigned DEFAULT '0' COMMENT '删除时间',
13 PRIMARY KEY (`id`),
14 UNIQUE KEY `udx_hashkey` (`hashkey`) USING BTREE,
15 KEY `idx_userid_date` (`userid`,`date`) USING BTREE
16) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='抽奖记录表';
大转盘、砸金蛋、摇一摇、抽奖箱、刮刮乐、老虎机