笔记信息, 历史记录, 提示, 附件优化

https://github.com/leanote/leanote/issues/224
This commit is contained in:
lealife
2015-10-10 16:10:54 +08:00
parent 274875c6c4
commit 320263eefa
58 changed files with 2078 additions and 5398 deletions

View File

@ -84,6 +84,13 @@ func (c BaseController) GetUserInfo() info.User {
return info.User{}
}
func (c BaseController) GetUserAndBlogUrl() info.UserAndBlogUrl {
if userId, ok := c.Session["UserId"]; ok && userId != "" {
return userService.GetUserAndBlogUrl(userId);
}
return info.UserAndBlogUrl{}
}
// 这里的session都是cookie中的, 与数据库session无关
func (c BaseController) GetSession(key string) string {
v, ok := c.Session[key]

View File

@ -24,8 +24,8 @@ type Note struct {
// 否则, 转向登录页面
func (c Note) Index(noteId, online string) revel.Result {
c.SetLocale()
userInfo := c.GetUserInfo()
userInfo := c.GetUserAndBlogUrl()
userId := userInfo.UserId.Hex()
// 没有登录
@ -138,13 +138,13 @@ func (c Note) Index(noteId, online string) revel.Result {
// 已登录, 得到用户基本信息(notebook, shareNotebook), 跳转到index.html中
// 否则, 转向登录页面
func (c Note) ListNotes(notebookId string) revel.Result {
_, notes := noteService.ListNotes(c.GetUserId(), notebookId, false, c.GetPage(), pageSize, defaultSortField, false, false);
_, notes := noteService.ListNotes(c.GetUserId(), notebookId, false, c.GetPage(), pageSize, defaultSortField, false, false)
return c.RenderJson(notes)
}
// 得到trash
func (c Note) ListTrashNotes() revel.Result {
_, notes := noteService.ListNotes(c.GetUserId(), "", true, c.GetPage(), pageSize, defaultSortField, false, false);
_, notes := noteService.ListNotes(c.GetUserId(), "", true, c.GetPage(), pageSize, defaultSortField, false, false)
return c.RenderJson(notes)
}