// 得到用户信息 func (c BaseController) GetUserInfo() info.User { if userId, ok := c.Session["UserId"]; ok && userId != "" { notebookWidth, _ := strconv.Atoi(c.Session["NotebookWidth"]) noteListWidth, _ := strconv.Atoi(c.Session["NoteListWidth"]) user := info.User{UserId: bson.ObjectIdHex(userId), Email: c.Session["Email"], Username: c.Session["Username"], UsernameRaw: c.Session["UsernameRaw"], Theme: c.Session["Theme"], NotebookWidth: notebookWidth, NoteListWidth: noteListWidth, } if c.Session["Verified"] == "1" { user.Verified = true } if c.Session["LeftIsMin"] == "1" { user.LeftIsMin = true } return user } return info.User{} }