入夏第一天了,可是武汉依然这样让我非常的惆怅,但是总不能荒废,必须的坐点什么,于是想着天天吃鸡,研究签到奖励大概设计模式,再结合以前签到做了如下表设计,大概就是如下图了,当然没有powerdesigner做数据库设计,自己搞吗就不用那么麻烦了,手敲出所有表在一个页面也能看出大概关联了

用户签到mysql表设计 签到数据库表设计_卡时间

 参考的页面如下:

用户签到mysql表设计 签到数据库表设计_用户签到mysql表设计_02

用户签到mysql表设计 签到数据库表设计_配置文件_03

用户签到mysql表设计 签到数据库表设计_卡时间_04

用户签到mysql表设计 签到数据库表设计_卡时间_05

 

用户签到mysql表设计 签到数据库表设计_二维码_06

用户签到mysql表设计 签到数据库表设计_配置文件_07

这些图片站酷的也有,千图的也有截图的部分app的也有将就着看吧。你看吃鸡是每天都有金币奖励或者服饰币奖励,所以设计谁知道运营那天我每天要赠送一个积分是吧 ,上面图片只需要在加上一张奖励记录表就好

create table ph_colockin(
colock_id tinyint(1) primary key AUTO_INCREMENT,
colock_desc text not null comment '玩法规则',
mornong_number_user MEDIUMINT not null default '0'comment '早起打卡参与人数',
morning_start_time int not null default '0' comment '早起可打卡时间开始时间',
morning_end_time int not null default '0' comment '早起可打卡时间结束时间',
night_number_user MEDIUMINT not null default '0' comment '晚上打卡参与人数',
night_start_time int not null default '0' comment '晚上可打卡时间开始时间',
night_end_time int not null default '0' comment '晚上可打卡时间结束时间'
)

create table ph_colockin_images(
colock_id int primary key AUTO_INCREMENT,
colock_images varchar(255) not null comment '图片url',
colock_img_type tinyint not null comment '类型1:打卡图片 2:分享图片'
) comment '打卡图片库表'


create table ph_colcokin_user(
user_id int primary key,
accumulation_day smallint not null default '0' comment '累计打卡天数',
continuation_morning smallint not null default '0' comment '连续早起',
share_number smallint not null default '0' comment '分享累加',
last__morningtoday int not null comment '上次早起打卡时间',
continuation_night smallint not null default '0' comment '连续早睡',
last_nighttoday int not null default '0' comment '上次睡觉打卡时间',
history_max_today SMALLINT not null default '0' comment '历史最高签到天数',
colcokin_achievement_all varchar(255) not null default '' comment '签到勋章,号分割',
share_achievement_all varchar(255) not null default '' comment '分享勋章,号分割'
) comment '用户签到表'

create table ph_achievement(
id smallint primary key AUTO_INCREMENT,
number smallint not null default '0' comment '条件数量(签到天数,分享人数)',
achievement_img varchar(255) not null comment '成就未点亮图标',
acheievement_hover_img varchar(255) not null comment '成就点亮图标',
type tinyint(1) not null comment '类型 1:签到勋章 2:分享勋章'
) comment '勋章表'

create table ph_colcokin_user_log(
id int primary key AUTO_INCREMENT,
user_id int not null comment '用户id',
oneday_time int not null comment '今天日期',
morning_colockin int not null default '0' comment '早晨打卡时间',
night_colockin int not null default '0' comment '晚上打卡时间',
sleep int not null default '0' comment '睡眠时间第二天早起时间减去晚睡打卡时间'
) comment '用户每日签到记录表,最长31天,按时间覆盖,后面替换前面代码处理'

create table ph_colockin_prize(
cp_id int primary key,
number smallint not null comment '达到多少天赠送奖励,不能有重复的',
type tinyint(1) not null comment '奖励类型1:抽奖次数 2:补签卡 3:积分',
third_id mediumint not null default '0' comment '抽奖活动id,type:1赠送抽奖就是luckdraw表自增id,type:3,赠送的积分'
) comment '签到奖励表'

顺带说说可能我把一张图片上的二维码去掉了,哪里扫码会出现一个支付购买东西的页面,重分享链接注册的人会给分享人累加分享次数,

欢迎大家私信补充或者评论补充

2020年4月28号补充:下午实际写代码的时候觉得第一张表不靠谱,去掉了,直接把保存在配置文件里面去了,因为这个是不会经常改动的,或者问你们有系统表的,直接存json丢到表里面比较好,因为这种一次性的数据,大可不必浪费查询数据库时间