web-3g-163(网易)-邮箱和博客-数据架构设计

专题图ylbtech-asp.net编号:ylbtechASPNET

1,功能描述

 

2,技术与环境

 

3,数据库设计

3g163EMail.sql

USE MASTER
go
-- =============================================
-- ylb: 3g版网易邮箱
-- url: http://m.mail.163.com/
-- devloper:ylb,tech
-- author: YuanBo
-- date: 11:11 2012-07-05
-- =============================================
IF EXISTS ( SELECT  *
        FROM    master..sysdatabases
        WHERE   name  = N '_3g163EMail' )
     DROP  DATABASE  _3g163EMail
GO
 
CREATE  DATABASE  _3g163EMail
GO
 
USE _3g163EMail
GO
-- =============================================
-- ylb: 1.1邮箱帐户表
-- =============================================
create  table  MailUsers
(
mailUser varchar (100) primary  key --帐号名称[PK]
pwd varchar (100) not  null            --密码
)

 

/1, 3g163EMail/1, MailUsers.sql
View Code

 

3,数据库设计

2, 3g163Blog.sql

USE MASTER
go
-- =============================================
-- ylb: 3g版网易博客
-- url: http://3g.163.com/blog/
-- devloper:ylb,tech
-- author: YuanBo
-- date: 11:11 2012-07-05
-- =============================================
IF EXISTS ( SELECT  *
        FROM    master..sysdatabases
        WHERE   name  = N '_3g163Blog' )
     DROP  DATABASE  _3g163Blog
GO
 
CREATE  DATABASE  _3g163Blog
GO
 
USE _3g163Blog
GO
 
--ylb:1, 用户
GO
-- =============================================
-- ylb: 1.1,用户基本资料表
-- =============================================
create  table  Users
(
userId int  primary  key  identity(100,1), --编号【PK】
nickname varchar (200) not  null ,     --昵称
realname varchar (200) null ,     --真实姓名
sex char (1) check (sex in ( 'M' , 'F' , 'N' )) default ( 'N' ),    --性别M:男;F:女;N:未知
birthday datetime,          --生日
 
constellation int --星座
province varchar (100),      --现居住地-省
city varchar (100),      --现居住地-市
county varchar (100),        --现居住地-县
mailUser varchar (100) not  null       --用户账号[FP], 于网易登录系统MailUser表的mailUser列相关
)
 
GO
-- =============================================
-- ylb: 1.2,博客统计表
-- =============================================
create  table  BlogStatistics
(
blogStatisticsId int  primary  key  identity(100,1), --编号【PK】
todayAccessNo int  default (0),           --今日访问量
sunAccessNo int  default (0),         --总访问量
integral int  default (0),            --博客等级
userId int  references  Users(userId)     --积分【FK】
)
 
--ylb:2,日志
GO
-- =============================================
-- ylb: 2.1,日志分类表
-- =============================================
create  table  BlogClass
(
blogClassId int  primary  key  identity(100,1),    --编号【PK】
className varchar (100) not  null ,        --分类名称
userId int  references  Users(userId)     --用户编号【FK】
)
 
GO
-- =============================================
-- ylb: 2.2,日志表
-- =============================================
--drop table Article
create  table  Article
(
articleId int  primary  key  identity(1,1),    --编号【PK】
title varchar (200) not  null ,            --标题
content varchar (5000),                  --内容
blogClassId int  references  BlogClass(blogClassId),      --分类编号【FK】
pubdate datetime default (getdate()),            --分布日期
 
readCnt int  default (0),                 --阅读数量
replyCnt int  default (0),                --回复数量
allowView int  default (0),               --显示范围权限 -100:公开;100:好友;1000:私人
draftFlag int  default (0),                   --0:发送;1:保存草稿
userId int  references  Users(userId)     --用户编号[FK]
)
 
GO
-- =============================================
-- ylb: 2.3,日志评论表
-- =============================================
create  table  ArticleReply
(
articleReplyId int  primary  key  identity(100,1), --编号【PK】
content varchar (200) not  null ,          --内容
pubdate datetime default (getdate()),        --回复时间
userId int  references  Users(userId),        --回复人,用户编号【FK】
articleId int  references  Article(articleId) --文章编号[FK]
)
 
--ylb:3, 相册
GO
-- ylb: 3.1 相册类别表
-- =============================================
-- ylb: 3.1.1 相册类别表
-- =============================================
create  table  Album
(
albumId int  primary  key  identity(1,1),  --编号【PK】
albumName varchar (100) not  null ,        --相册名
pubdate datetime default (getdate()),        --创建时间
userId int  references  Users(userId),        --用户编号【PF】
albumUrl varchar (100)                       --封面图片
)
 
GO
-- =============================================
-- ylb: 3.1.2 相册类别评论表
-- =============================================
create  table  ReplyAlbum
(
replyAlbumId int  primary  key  identity(100,1), --编号
content varchar (200) not  null ,          --评论内容
pubdate datetime default (getdate()),        --评论时间
baseId int  default (0),              --评论级次 0:发表;其他:回复|跟贴
albumId int  references  Album(albumId),  --相册编号[FK]
userId int  references  Users(userId)     --用户编号[FK]
)
 
 
-- ylb: 3.2 相册表
GO
-- =============================================
-- ylb: 3.2.1 相册表
-- =============================================
create  table  Photo
(
photoId int  primary  key  identity(100,1),    --编号【PK】
imgUrl varchar (100),                --保存地址
imgDesc varchar (100),               --描述 [注:3g版不显示]
albumId int  references  Album(albumId),  --相册编号[FK]
userId int  references  Users(userId)     --用户编号[FK] 有争议
)
 
GO
-- =============================================
-- ylb: 3.2.2 相册评论表
-- =============================================
create  table  ReplyPhoto
(
replyPhotoId int  primary  key  identity(100,1), --编号
content varchar (200) not  null ,          --评论内容
pubdate datetime default (getdate()),        --评论时间
baseId int  default (0),              --评论级次 0:发表;其他:回复|跟贴
photoId int  references  Photo(photoId),  --照片编号[FK]
userId int  references  Users(userId)     --用户编号[FK]
)
 
 
GO
-- =============================================
-- ylb: 4,博友组表
-- =============================================
create  table  FriendsGroup
(
friendsGroupId int  primary  key  identity(100,1), --编号【PK】
friendsGroupName varchar (100),                  --组名
userId int  references  Users(userId)             --用户编号【FK】
)
 
GO
-- =============================================
-- ylb: 4,博友表
-- =============================================
create  table  Friend
(
friendId int  references  Users(userId),      --编号
userId int  references  Users(userId),        --用户编号
pubdate datetime default (getdate()),        --加添时间
friendsGroupId int  references  FriendsGroup(friendsGroupId)  --好友分组【FK】
)
 
 
-- ylb: 5,消息
GO
-- =============================================
-- ylb: 5, 消息表
-- =============================================
create  table  Msg
(
msgId int  primary  key  identity(100,1),      --编号【PK】
inUserId int  references  Users(userId),      --接受用户编号【FK】
sendUserId int  references  Users(userId),    --发送用户编号【FK】
content varchar (200),               --内容
pubdate datetime default (getdate())     --发送时间
)
 
GO
-- =============================================
-- ylb: 6, 留言表
-- =============================================
create  table  Note
(
noteId int  primary  key  identity(1,1),   --编号
content varchar (200),                   --内容
pubdate datetime default (getdate()),    --时间
inUserId int ,                           --主人编号
sendUserid int                       --发送人编号
)
 
GO
-- =============================================
-- ylb: 7, 通知表
-- =============================================
create  table  Notice
(
noticeId int  primary  key  identity(1,1), --编号
content varchar (200),                   --内容
pubdate datetime default (getdate()),    --时间
remark varchar (200),                    --备注
inUserId int                             --主人编号
)
 
 
GO
-- =============================================
-- ylb: 7, 最近访客
-- =============================================
create  table  RecentVisitor
(
recentVisitorId int  primary  key  identity(1,1),  --编号
hostId int ,     --主人编号
visitId int ,    --来访者编号
pubdate datetime default (getdate()) --时间
)
 
 
GO
-- =============================================
-- ylb: 7, 最近走访
-- =============================================
create  table  RecentVisited
(
recentVisitedId int  primary  key  identity(1,1),  --编号
hostId int ,     --主人编号
visitId int ,    --来访者编号
pubdate datetime default (getdate()) --时间
)
 
GO
-- =============================================
-- ylb: 7, 最近走访
-- =============================================
create  table  RecentVisit
(
recentVisitId int  primary  key  identity(1,1),    --编号
hostId int ,     --主人编号
visitId int ,    --来访者编号
pubdate datetime default (getdate()),    --时间
type varchar (100)           --类型
)
 
GO
-- =============================================
-- ylb: 8, 心情随笔
-- =============================================
create  table  Feeling
(
feelingId int  primary  key  identity(1,1),    --编号
content varchar (200),                       --内容
pubdate datetime default (getdate()),        --时间
baseId int ,                                 --baseId=0:首发;baseId=num:则恢复
userId int                                   --用户编号
)
 
GO
print '网易博客数据创建完成'

 /2, 3g163Blog/1, Users.sql

View Code

 /2, 3g163Blog/2, BlogClass.sql

View Code

 /2, 3g163Blog/3, Article.sql

View Code

 /2, 3g163Blog/4, ArticleReply.sql

View Code

 /2, 3g163Blog/5, Album.sql

View Code

 /2, 3g163Blog/5, Photo.sql

View Code

 /2, 3g163Blog/7, ReplyAlbum.sql

View Code

 /2, 3g163Blog/8, ReplyPhoto.sql

View Code

 /2, 3g163Blog/9, Note.sql

View Code

 /2, 3g163Blog/10,Notice.sql

View Code

 /2, 3g163Blog/11,Feeling.sql

View Code

 /2, 3g163Blog/12, RecentVisit.sql

View Code

 /2, 3g163Blog/13, FriendsGroup.sql

View Code

 /2, 3g163Blog/14,Friend.sql

View Code

 /2, 3g163Blog/

4.1,前台

5,代码分析

 解决方案属性图

6,示例|讲解案例下载

博客园讲解:  http://ylbtech.cnblogs.com/

百度文库开发文档: http://passport.baidu.com/?business&aid=6&un=ylbtech#7

谷歌开源代码下载: http://code.google.com/p/ylbtechopensource/downloads/list

请单击“搜索框设默认DropDown”


本文转自ylbtech博客园博客,原文链接:http://www.cnblogs.com/ylbtech/archive/2012/09/05/2672244.html,如需转载请自行联系原作者

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值