This commit is contained in:
life
2014-11-12 17:32:03 +08:00
parent d979a0c3e2
commit 1f45666ec4
119 changed files with 2463 additions and 675 deletions

View File

@ -23,6 +23,8 @@ type BlogInfoCustom struct {
type Post struct {
NoteId string
Title string
UrlTitle string
ImgSrc string
CreatedTime time.Time
UpdatedTime time.Time
PublicTime time.Time

View File

@ -74,9 +74,10 @@ type BlogStat struct {
// 单页
type BlogSingle struct {
SingleId bson.ObjectId `bson:"_id"`
SingleId bson.ObjectId `bson:"_id,omitempty"`
UserId bson.ObjectId `UserId`
Title string `Title`
UrlTitle string `UrlTitle` // 2014/11/11
Content string `Content`
UpdatedTime time.Time `UpdatedTime`
CreatedTime time.Time `CreatedTime`
@ -87,7 +88,7 @@ type BlogSingle struct {
// 点赞记录
type BlogLike struct {
LikeId bson.ObjectId `bson:"_id"`
LikeId bson.ObjectId `bson:"_id,omitempty"`
NoteId bson.ObjectId `NoteId`
UserId bson.ObjectId `UserId`
CreatedTime time.Time `CreatedTime`
@ -95,7 +96,7 @@ type BlogLike struct {
// 评论
type BlogComment struct {
CommentId bson.ObjectId `bson:"_id"`
CommentId bson.ObjectId `bson:"_id,omitempty"`
NoteId bson.ObjectId `NoteId`
UserId bson.ObjectId `UserId` // UserId回复ToUserId
@ -114,3 +115,14 @@ type BlogCommentPublic struct {
BlogComment
IsILikeIt bool
}
type BlogUrls struct {
IndexUrl string
CateUrl string
SearchUrl string
SingleUrl string
PostUrl string
ArchiveUrl string
TagsUrl string
TagPostsUrl string
}

25
app/info/GroupInfo.go Normal file
View File

@ -0,0 +1,25 @@
package info
import (
"gopkg.in/mgo.v2/bson"
"time"
)
// 分组
type Group struct {
GroupId bson.ObjectId `bson:"_id"` // 谁的
UserId bson.ObjectId `UserId` // 所有者Id
Title string `Title` // 标题
UserCount int `UserCount` // 用户数
CreatedTime time.Time `CreatedTime`
Users []User `Users,omitempty` // 分组下的用户, 不保存, 仅查看
}
// 分组好友
type GroupUser struct {
GroupUserId bson.ObjectId `bson:"_id"` // 谁的
GroupId bson.ObjectId `GroupId` // 分组
UserId bson.ObjectId `UserId` // 用户
CreatedTime time.Time `CreatedTime`
}

View File

@ -20,9 +20,11 @@ type Note struct {
IsTrash bool `IsTrash` // 是否是trash, 默认是false
IsBlog bool `IsBlog,omitempty` // 是否设置成了blog 2013/12/29 新加
IsRecommend bool `IsRecommend,omitempty` // 是否为推荐博客 2014/9/24新加
IsTop bool `IsTop,omitempty` // blog是否置顶
IsBlog bool `IsBlog,omitempty` // 是否设置成了blog 2013/12/29 新加
UrlTitle string `UrlTitle,omitempty` // 博客的url标题, 为了更友好的url, 在UserId, UrlName下唯一
IsRecommend bool `IsRecommend,omitempty` // 是否为推荐博客 2014/9/24新加
IsTop bool `IsTop,omitempty` // blog是否置顶
HasSelfDefined bool `HasSelfDefined` // 是否已经自定义博客图片, desc, abstract
// 2014/9/28 添加评论社交功能
ReadNum int `ReadNum,omitempty` // 阅读次数 2014/9/28
@ -35,9 +37,9 @@ type Note struct {
CreatedTime time.Time `CreatedTime`
UpdatedTime time.Time `UpdatedTime`
RecommendTime time.Time `RecommendTime,omitempty` // 推荐时间
PublicTime time.Time `PublicTime,omitempty` // 发表时间, 公开为博客则设置
UpdatedUserId bson.ObjectId `bson:"UpdatedUserId"` // 如果共享了, 并可写, 那么可能是其它他修改了
RecommendTime time.Time `RecommendTime,omitempty` // 推荐时间
PublicTime time.Time `PublicTime,omitempty` // 发表时间, 公开为博客则设置
UpdatedUserId bson.ObjectId `bson:"UpdatedUserId"` // 如果共享了, 并可写, 那么可能是其它他修改了
}
// 内容

View File

@ -13,6 +13,7 @@ type Notebook struct {
ParentNotebookId bson.ObjectId `bson:"ParentNotebookId,omitempty"` // 上级
Seq int `Seq` // 排序
Title string `Title` // 标题
UrlTitle string `UrlTitle` // Url标题 2014/11.11加
NumberNotes int `NumberNotes` // 笔记数
IsTrash bool `IsTrash,omitempty` // 是否是trash, 默认是false
IsBlog bool `IsBlog,omitempty` // 是否是Blog 2013/12/29 新加

View File

@ -76,7 +76,9 @@ type SharingNotebookAndNotes struct {
type ShareNotebook struct {
ShareNotebookId bson.ObjectId `bson:"_id,omitempty"` // 必须要设置bson:"_id" 不然mgo不会认为是主键
UserId bson.ObjectId `bson:"UserId"`
ToUserId bson.ObjectId `bson:"ToUserId"`
ToUserId bson.ObjectId `bson:"ToUserId,omitempty"`
ToGroupId bson.ObjectId `bson:"ToGroupId,omitempty"` // 分享给的用户组
ToGroup Group `ToGroup,omitempty` // 仅仅为了显示, 不存储, 分组信息
NotebookId bson.ObjectId `bson:"NotebookId"`
Seq int `bson:"Seq"` // 排序
Perm int `bson:"Perm"` // 权限, 其下所有notes 0只读, 1可修改
@ -134,7 +136,9 @@ type ShareNotebooksByUser struct {
type ShareNote struct {
ShareNoteId bson.ObjectId `bson:"_id,omitempty"` // 必须要设置bson:"_id" 不然mgo不会认为是主键
UserId bson.ObjectId `bson:"UserId"`
ToUserId bson.ObjectId `bson:"ToUserId"`
ToUserId bson.ObjectId `bson:"ToUserId,omitempty"`
ToGroupId bson.ObjectId `bson:"ToGroupId,omitempty"` // 分享给的用户组
ToGroup Group `ToGroup,omitempty` // 仅仅为了显示, 不存储, 分组信息
NoteId bson.ObjectId `bson:"NoteId"`
Perm int `bson:"Perm"` // 权限, 0只读, 1可修改
CreatedTime time.Time `CreatedTime`

View File

@ -74,5 +74,7 @@ type UserAndBlog struct {
Logo string `Logo`
BlogTitle string `BlogTitle` // 博客标题
BlogLogo string `BlogLogo` // 博客Logo
BlogUrl string `BlogUrl` // 博客链接
BlogUrl string `BlogUrl` // 博客链接, 主页
BlogUrls // 各个页面
}

View File

@ -9,6 +9,7 @@ import (
type Page struct {
CurPage int // 当前页码
TotalPage int // 总页
PerPageSize int
Count int // 总记录数
List interface{}
}
@ -18,5 +19,5 @@ func NewPage(page, perPageSize, count int, list interface{}) Page {
if count > 0 {
totalPage = int(math.Ceil(float64(count) / float64(perPageSize)))
}
return Page{page, totalPage, count, list}
}
return Page{page, totalPage, perPageSize, count, list}
}