网易一元夺宝数据库分析(未涉及管理员)
文末有关系模型/*==============================================================*/
/* Table: Y_address */
/*==============================================================*/
create table Y_address
(uid int not null comment '用户ID',aid int not null comment '地址编号',aaddress varchar(1000) not null comment '收获地址',aperson varchar(30) not null comment '收货人',aphone bigint not null comment '收货人电话',primary key (uid, aid)
);alter table Y_address comment '收货地址管理';/*==============================================================*/
/* Table: Y_buyed */
/*==============================================================*/
create table Y_buyed
(bid int not null auto_increment comment '购买ID',uid int not null comment '用户ID',sid int not null comment '商品ID',bnum int not null default 1 comment '购买数量(默认为1)',saimg01 varbinary(100) comment '晒单图01',saimg02 varbinary(100) comment '晒单图02',saimg03 varbinary(100) comment '晒单图03',btime datetime not null comment '购买时间',primary key (bid)
);alter table Y_buyed comment '全价购买表
';/*==============================================================*/
/* Table: Y_buyedappraise */
/*==============================================================*/
create table Y_buyedappraise
(bpid int not null auto_increment comment '评论ID',uid int not null comment '用户ID',sid int not null comment '商品ID',bpcontent varchar(1000) not null comment '评论内容',bptime datetime not null comment '评论时间',primary key (bpid)
);alter table Y_buyedappraise comment '全价商品购买评价';/*==============================================================*/
/* Table: Y_duobao */
/*==============================================================*/
create table Y_duobao
(dduonum bigint not null auto_increment comment '夺宝号码(‘前台使用时在次号码前拼接100或1000’)',uid int not null comment '用户id',sid int not null comment '商品id',dlasttime datetime not null comment '最后一次夺宝时间',dstaic tinyint not null default 0,primary key (dduonum)
);alter table Y_duobao comment '夺宝记录表';/*==============================================================*/
/* Table: Y_rechare */
/*==============================================================*/
create table Y_rechare
(rid int not null auto_increment comment '充值ID',uid int not null comment '用户ID',rmoney int not null comment '充值金额',rtime datetime not null comment '充值时间',primary key (rid)
);alter table Y_rechare comment '用户充值';/*==============================================================*/
/* Table: Y_shop */
/*==============================================================*/
create table Y_shop
(sid int not null auto_increment comment '商品ID',sname varchar(100) not null comment '商品名',svid int not null comment '商品种类ID',sprice int not null comment '商品总价格(最小单位/元)',ssingleprice tinyint default 1 comment '夺宝单价(1元/人;10元/人,默认是一元夺宝)',smainimg varchar(100) not null comment '正面商品图',sjieshaoimg01 varchar(100) not null comment '商品介绍图第一张',sjieshaoimg02 varchar(100) not null comment '商品介绍图第二张',sjieshaoimg03 varchar(100) comment '商品介绍图第三张',sjieshaoimg04 varchar(100) comment '商品介绍图第四张',sjieshao varchar(300) comment '商品介绍',ssave int not null default 200 comment '商品库存(默认200)',sstaic tinyint not null default 1 comment '是否下架(默认为1,未下架)',ssavetime datetime not null comment '入库时间',primary key (sid)
);alter table Y_shop comment '商品信息表';/*==============================================================*/
/* Table: Y_shopappraise */
/*==============================================================*/
create table Y_shopappraise
(pid int not null auto_increment comment '评论编号',luckynum int not null comment '幸运号码',pcontent varchar(1000) comment '评价',saimg01 varbinary(100) comment '晒单图01',saimg02 varbinary(100) comment '晒单图02',saimg03 varbinary(100) comment '晒单图03',ptime datetime not null comment '评价时间',primary key (pid)
);alter table Y_shopappraise comment '商品评价
';/*==============================================================*/
/* Table: Y_shoppingcar */
/*==============================================================*/
create table Y_shoppingcar
(uid int not null comment '用户ID',sid int not null comment '商品ID',snum int not null default 1 comment '购买数量(默认为1)',sctime datetime not null comment '加入购物车时间',primary key (uid, sid)
);alter table Y_shoppingcar comment '购物车(仅针对全价购买商品,夺宝清单参照duobao表)';/*==============================================================*/
/* Table: Y_shopvariety */
/*==============================================================*/
create table Y_shopvariety
(svid int not null comment '商品种类ID',svmiaoshu varchar(60) not null comment '种类描述',svnote varchar(600) comment '备注',primary key (svid)
);alter table Y_shopvariety comment '商品种类
';/*==============================================================*/
/* Table: Y_showbuyed */
/*==============================================================*/
create table Y_showbuyed
(luckynum int not null comment '幸运号',swtime datetime not null comment '夺宝成功的时间(或者说是揭晓时间)',primary key (luckynum)
);alter table Y_showbuyed comment '晒单(夺宝成功商品)';/*==============================================================*/
/* Table: Y_user */
/*==============================================================*/
create table Y_user
(uid int not null auto_increment comment '用户ID',uname varchar(30) comment '用户的真实姓名',ushowname varchar(200) comment '用户昵称',uIDnumber varchar(18) comment '身份证号码',uemail varchar(100) not null comment '用户邮箱',uphone bigint not null comment '手机号码',upassword varchar(32) not null comment '用户密码',utouxiang varchar(100) not null comment '用户头像',umoney bigint not null default 100 comment '用户初始余额(100元)',ucoupon int default 5 comment '用户优惠券(抵用现金/元,初始为5元)',ubaoshi int default 20 comment '用户宝石(用于兑换商品/个,初始为20个)',uregtiem datetime not null comment '用户注册时间',ustaic tinyint not null default 1 comment '用户当前状态(默认为“1”,有效用户)',primary key (uid),unique key AK_Key_2 (uIDnumber),unique key AK_Key_3 (uphone),unique key AK_Key_4 (uemail)
);alter table Y_user comment '用户表
';alter table Y_address add constraint FK_AU foreign key (uid)references Y_user (uid) on delete restrict on update restrict;alter table Y_buyed add constraint FK_BS foreign key (sid)references Y_shop (sid) on delete restrict on update restrict;alter table Y_buyed add constraint FK_BU foreign key (uid)references Y_user (uid) on delete restrict on update restrict;alter table Y_buyedappraise add constraint FK_BP_S foreign key (sid)references Y_shop (sid) on delete restrict on update restrict;alter table Y_buyedappraise add constraint FK_BP_U foreign key (uid)references Y_user (uid) on delete restrict on update restrict;alter table Y_duobao add constraint FK_Lucky_S foreign key (sid)references Y_shop (sid) on delete restrict on update restrict;alter table Y_duobao add constraint FK_Lucky_U foreign key (uid)references Y_user (uid) on delete restrict on update restrict;alter table Y_rechare add constraint FK_RU foreign key (uid)references Y_user (uid) on delete restrict on update restrict;alter table Y_shop add constraint FK_SV foreign key (svid)references Y_shopvariety (svid) on delete restrict on update restrict;alter table Y_shopappraise add constraint FK_PD foreign key (luckynum)references Y_duobao (dduonum) on delete restrict on update restrict;alter table Y_shoppingcar add constraint FK_CS foreign key (sid)references Y_shop (sid) on delete restrict on update restrict;alter table Y_shoppingcar add constraint FK_UC foreign key (uid)references Y_user (uid) on delete restrict on update restrict;alter table Y_showbuyed add constraint FK_Lucky_D foreign key (luckynum)references Y_duobao (dduonum) on delete restrict on update restrict;
##更改:建立期号表 create table Y_qihao (qnum int comment '期号',sid int comment '商品ID',qtime datetime comment '该期开始时间',qlasttime datetime comment '该期结束时间',primary key (qnum,qtime) );
alter table y_duobao add constraint FK_DQ foreign key (dqihao)references Y_qihao (qnum) on delete restrict on update restrict; ALTER TABLE y_qihao ADD CONSTRAINT FK_QS FOREIGN KEY (sid)REFERENCES Y_shop (sid) ON DELETE RESTRICT ON UPDATE RESTRICT;
关系模型图:
网易一元夺宝数据库分析(未涉及管理员)相关推荐
- 【程序哥】分析 网易一元夺宝是否有作弊空间,真像媒体所说的吗?
最近网易 一元购 报道了不好负面消息.有人去网易大楼维权,咱先不说一元购的道德法律是层面.就从技术方面分析一下,一元购真像媒体所说的吗?是否有作假的空间. 网易1元夺宝的中奖机制公平吗? 在网易一元夺 ...
- Android 仿网易一元夺宝客户端下拉加载动画实现(一)
上上周写的一个demo,仿照网易一元夺宝的下拉刷新效果. 原效果是(第一部分)一个小太阳拉下来,然后松开回弹上去, (第二部分)再掉下来一个硬币进行中轴旋转. 本文实现的效果的是第一部分的,效果演示图 ...
- 仿网易一元夺宝算法,宽长度数据计算,字符串实现
为什么80%的码农都做不了架构师?>>> /** * @company * @version 1.0 * @author fangjianming * @email fa ...
- 游戏开发笔记(一):一元夺宝
说说近期开发的一元夺宝新功能,和网易一元夺宝功能类似,大概规则是,每个玩家出一块钱买一个很贵的道具,然后系统会从这些出一块钱购买的玩家中中随机出来一个人获得道具,和网易不一样的是每一组商品次数没有购买 ...
- 一元夺宝的2种押注策略分析
前言 京东和网易上都有一元夺宝的游戏,押注方式有两种:一种是单次多买几注:另一种是每次买一注,多参加几次,直到买中停止.那么哪一种方式的中奖概率更大一些呢?请看下面的分析: 场景:商品A需要1000人 ...
- 一元夺宝项目设计(上)
听说网易的一元夺宝项目一天的现金流水就达到了1个亿,老板听说有这回事,就着手让我这边逆向一个自己的一元夺宝.既然是老板钦定的项目,必须要积极的应对,不过对于外界传言一天一个亿的流水,写个爬虫抓取他们家 ...
- 高并发秒杀系统架构设计 · 抢购、微信红包、一元夺宝
秒杀业务与难点 秒杀业务在各业务中已然非常流行,这里我将互联网行业中的秒杀定义为:在非常短的时间内,将一件商品分成多份进行购买的行为.微信抢红包..双11大促等业务本质上都可视作秒杀业务.而最近大热的 ...
- 为什么那么多人想开发一元夺宝类app?
别拿你的无知和愚蠢,来证明主观的判断! 国人对一切事物具有怀疑的本性是好的, 但是若不建立于科学的分析方法, 那就是愚昧! 身边有朋友玩夺宝投入较多,产出较少,于是向我求助.想从数据分析的角度知道到底 ...
- 夺宝观察:从一元夺宝用户的舆论看行业发展
一个新事物的兴起,往往伴随着争议,无论是之前的P2P还是如今的一元夺宝.这两个都有很多相似之处,一者投资一者购物,并且都有希望获得较大的收益.两者都是新兴事物,在短时间内崛起,但是又因为缺乏法律法规的 ...
最新文章
- PIXI 下落文字消除(3)
- 慢SQL,压垮团队的最后一根稻草No.92
- VMM2012中虚拟机的创建
- 008_多配置文件的引入
- hdu 4358(莫队算法+dfs序列)
- Automatic Exploit Generation:漏洞利用自动化
- go基本数据类型与运算符
- 最初版本的simplecall是如何把2个callleg连起来的
- 网传“杭州市聘罗永浩为形象大使”?官方:为不实信息
- 艾伟:如何实现用返回值重载
- 个人作业-软件产品案例分析
- linux安装oracle11g视频,Linux安装oracle11g详细步骤及问题汇总
- 身份证合法验证查询易语言代码
- java 回收器有几种_Java垃圾回收器种类
- 怎么在线制作软件的logo
- 计算机辅助设计中常用的输入工具,cad怎么输入坐标点?cad三种常用坐标系的输入方法...
- 【解密】OpenSea免费创造的NFT都没上链竟能出现在我的钱包里?
- 知识点 - 多边形的重心、核、三角形的心
- shader学习之路——更复杂的光照之Base Pass 和 Additional Pass和光照的衰减
- android 7.0 Settings 省电模式