コード例 #1
0
ファイル: Note.go プロジェクト: xfdingustc/NeverNote
func (c Note) Index(noteId, online string) revel.Result {
	c.SetLocale()

	//userInfo := c.GetUserAndBlogUrl()
	user := c.GetUser()
	utils.LogJson(user)
	//userId := userInfo
	userId := user.UserId.Hex()
	if userId == "" {
		return c.Redirect("/login")
	}

	notebooks := NotebookS.GetNotebooks(userId)

	c.RenderArgs["notebooks"] = notebooks

	return c.RenderTemplate("note/note.html")
}
コード例 #2
0
func (this *NotebookService) AddNotebook(notebook Notebook) (bool, Notebook) {
	if notebook.NotebookId == "" {
		notebook.NotebookId = bson.NewObjectId()
	}

	now := time.Now()
	notebook.CreatedTime = now
	notebook.UpdatedTime = now
	notebook.IsDeleted = false

	utils.LogJson(notebook)

	err := database.Notebooks.Insert(notebook)
	if err != nil {
		utils.Log(err)
		return false, notebook
	}
	return true, notebook
}