Documentation ¶
Index ¶
- Constants
- func GetUrTitle(userId string, title string, types string) string
- func InitEmailFromDb()
- func InitService()
- func ParseAndSortNotebooks(userNotebooks []info.Notebook, noParentDelete, needSort bool) info.SubNotebooks
- type AlbumService
- type AttachService
- func (this *AttachService) AddAttach(attach info.Attach, fromApi bool) (ok bool, msg string)
- func (this *AttachService) CopyAttachs(noteId, toNoteId, toUserId string) bool
- func (this *AttachService) DeleteAllAttachs(noteId, userId string) bool
- func (this *AttachService) DeleteAttach(attachId, userId string) (bool, string)
- func (this *AttachService) GetAttach(attachId, userId string) (attach info.Attach)
- func (this *AttachService) ListAttachs(noteId, userId string) []info.Attach
- func (this *AttachService) UpdateImageTitle(userId, fileId, title string) bool
- func (this *AttachService) UpdateOrDeleteAttachApi(noteId, userId string, files []info.NoteFile) bool
- type AuthService
- type BlogService
- func (this *BlogService) AddOrUpdateSingle(userId, singleId, title, content string) (ok bool)
- func (this *BlogService) Comment(noteId, toCommentId, userId, content string) (bool, info.BlogComment)
- func (this *BlogService) DeleteComment(noteId, commentId, userId string) bool
- func (this *BlogService) DeleteSingle(userId, singleId string) (ok bool)
- func (this *BlogService) FixBlog(blog info.BlogItem) info.Post
- func (this *BlogService) FixBlogs(blogs []info.BlogItem) []info.Post
- func (this *BlogService) FixNote(note info.Note) info.Post
- func (this *BlogService) GetBlog(noteId string) (blog info.BlogItem)
- func (this *BlogService) GetBlogByIdAndUrlTitle(userId string, noteIdOrUrlTitle string) (blog info.BlogItem)
- func (this *BlogService) GetBlogItem(note info.Note) (blog info.BlogItem)
- func (this *BlogService) GetBlogStat(noteId string) (stat info.BlogStat)
- func (this *BlogService) GetBlogTags(userId string) []info.TagCount
- func (this *BlogService) GetBlogUrls(userBlog *info.UserBlog, userInfo *info.User) info.BlogUrls
- func (this *BlogService) GetSingle(singleId string) info.BlogSingle
- func (this *BlogService) GetSingleByUserIdAndUrlTitle(userId, singleIdOrUrlTitle string) info.BlogSingle
- func (this *BlogService) GetSingles(userId string) []map[string]string
- func (this *BlogService) GetUserBlog(userId string) info.UserBlog
- func (this *BlogService) GetUserBlogByDomain(domain string) info.UserBlog
- func (this *BlogService) GetUserBlogBySubDomain(subDomain string) info.UserBlog
- func (this *BlogService) GetUserBlogUrl(userBlog *info.UserBlog, username string) string
- func (this *BlogService) IncReadNum(noteId string) bool
- func (this *BlogService) IsILikeIt(noteId, userId string) bool
- func (this *BlogService) LikeBlog(noteId, userId string) (ok bool, isLike bool)
- func (this *BlogService) LikeComment(commentId, userId string) (ok bool, isILike bool, num int)
- func (this *BlogService) ListAllBlogs(userId, tag string, keywords string, isRecommend bool, page, pageSize int, ...) (info.Page, []info.BlogItem)
- func (this *BlogService) ListBlogNotebooks(userId string) []info.Notebook
- func (this *BlogService) ListBlogs(notebookId string, page, pageSize int, sortField string, isAsc bool) (info.Page, []info.BlogItem)
- func (this *BlogService) ListBlogsArchive(userId, notebookId string, year, month int, sortField string, isAsc bool) []info.Archive
- func (this *BlogService) ListComments(userId, noteId string, page, pageSize int) (info.Page, []info.BlogCommentPublic, map[string]info.UserAndBlog)
- func (this *BlogService) ListLikedUsers(noteId string, isAll bool) ([]info.UserAndBlog, bool)
- func (this *BlogService) ListUserBlogs(userId, notebookId string, page, pageSize int, sortField string, isAsc bool) (info.Page, []info.BlogItem)
- func (this *BlogService) PreNextBlog(userId string, sorterField string, isAsc bool, noteId string, ...) (info.Post, info.Post)
- func (this *BlogService) ReCountBlogTags(userId string) bool
- func (this *BlogService) Report(noteId, commentId, reason, userId string) bool
- func (this *BlogService) SearchBlog(key, userId string, page, pageSize int, sortField string, isAsc bool) (info.Page, []info.BlogItem)
- func (this *BlogService) SearchBlogByTags(tags []string, userId string, pageNumber, pageSize int, sortField string, ...) (pageInfo info.Page, blogs []info.BlogItem)
- func (this *BlogService) SetRecommend(noteId string, isRecommend bool) bool
- func (this *BlogService) SortSingles(userId string, singleIds []string) (ok bool)
- func (this *BlogService) UpateBlogAbstract(userId string, noteId, imgSrc, desc, abstract string) (ok bool)
- func (this *BlogService) UpateBlogUrlTitle(userId string, noteId, urlTitle string) (ok bool, url string)
- func (this *BlogService) UpateCateIds(userId string, cateIds []string) bool
- func (this *BlogService) UpateCateUrlTitle(userId string, cateId, urlTitle string) (ok bool, url string)
- func (this *BlogService) UpdateSingleUrlTitle(userId, singleId, urlTitle string) (ok bool, url string)
- func (this *BlogService) UpdateUserBlog(userBlog info.UserBlog) bool
- func (this *BlogService) UpdateUserBlogBase(userId string, userBlog info.UserBlogBase) bool
- func (this *BlogService) UpdateUserBlogComment(userId string, userBlog info.UserBlogComment) bool
- func (this *BlogService) UpdateUserBlogPaging(userId string, perPageSize int, sortField string, isAsc bool) (ok bool, msg string)
- func (this *BlogService) UpdateUserBlogStyle(userId string, userBlog info.UserBlogStyle) bool
- type ConfigService
- func (this *ConfigService) AddBackup(path, remark string) bool
- func (this *ConfigService) AllowCustomDomain() bool
- func (this *ConfigService) Backup(remark string) (ok bool, msg string)
- func (this *ConfigService) DeleteBackup(createdTime string) (bool, string)
- func (this *ConfigService) GetAdminUserId() string
- func (this *ConfigService) GetAdminUsername() string
- func (this *ConfigService) GetBackup(createdTime string) (map[string]string, bool)
- func (this *ConfigService) GetBlogDomain() string
- func (this *ConfigService) GetBlogUrl() string
- func (this *ConfigService) GetDefaultDomain() string
- func (this *ConfigService) GetDefaultUrl() string
- func (this *ConfigService) GetGlobalArrMapConfig(key string) []map[string]string
- func (this *ConfigService) GetGlobalArrayConfig(key string) []string
- func (this *ConfigService) GetGlobalConfigForUser() map[string]interface{}
- func (this *ConfigService) GetGlobalMapConfig(key string) map[string]string
- func (this *ConfigService) GetGlobalStringConfig(key string) string
- func (this *ConfigService) GetLeaDomain() string
- func (this *ConfigService) GetLeaUrl() string
- func (this *ConfigService) GetNoteDomain() string
- func (this *ConfigService) GetNoteUrl() string
- func (this *ConfigService) GetSchema() string
- func (this *ConfigService) GetSiteUrl() string
- func (this *ConfigService) GetUploadSize(key string) float64
- func (this *ConfigService) GetUploadSizeLimit() map[string]float64
- func (this *ConfigService) GetUserSubUrl(subDomain string) string
- func (this *ConfigService) GetUserUrl(domain string) string
- func (this *ConfigService) GetVersion() string
- func (this *ConfigService) HomePageIsAdminsBlog() bool
- func (this *ConfigService) InitGlobalConfigs() bool
- func (this *ConfigService) IsGoodCustomDomain(domain string) bool
- func (this *ConfigService) IsGoodSubDomain(domain string) bool
- func (this *ConfigService) IsOpenRegister() bool
- func (this *ConfigService) Restore(createdTime string) (ok bool, msg string)
- func (this *ConfigService) UpdateBackupRemark(createdTime, remark string) (bool, string)
- func (this *ConfigService) UpdateGlobalArrMapConfig(userId, key string, value []map[string]string) bool
- func (this *ConfigService) UpdateGlobalArrayConfig(userId, key string, value []string) bool
- func (this *ConfigService) UpdateGlobalMapConfig(userId, key string, value map[string]string) bool
- func (this *ConfigService) UpdateGlobalStringConfig(userId, key string, value string) bool
- func (this *ConfigService) UpdateShareNoteConfig(registerSharedUserId string, ...) (ok bool, msg string)
- type EmailService
- func (this *EmailService) AddEmailLog(email, subject, body string, ok bool, msg string)
- func (this *EmailService) DeleteEmails(ids []string) bool
- func (this *EmailService) FindPwdSendEmail(token, email string) (ok bool, msg string)
- func (this *EmailService) ListEmailLogs(pageNumber, pageSize int, sortField string, isAsc bool, email string) (page info.Page, emailLogs []info.EmailLog)
- func (this *EmailService) RegisterSendActiveEmail(userInfo info.User, email string) bool
- func (this *EmailService) SendCommentEmail(note info.Note, comment info.BlogComment, userId, content string) bool
- func (this *EmailService) SendEmail(to, subject, body string) (ok bool, e string)
- func (this *EmailService) SendEmailToEmails(emails []string, subject, body string) (ok bool, msg string)
- func (this *EmailService) SendEmailToUsers(users []info.User, subject, body string) (ok bool, msg string)
- func (this *EmailService) SendInviteEmail(userInfo info.User, email, content string) bool
- func (this *EmailService) UpdateEmailSendActiveEmail(userInfo info.User, email string) (ok bool, msg string)
- func (this *EmailService) ValidTpl(str string) (ok bool, msg string)
- type FileService
- func (this *FileService) AddImage(image info.File, albumId, userId string, needCheckSize bool) (ok bool, msg string)
- func (this *FileService) CopyImage(userId, fileId, toUserId string) (bool, string)
- func (this *FileService) DeleteImage(userId, fileId string) (bool, string)
- func (this *FileService) GetAllImageNamesMap(userId string) (m map[string]bool)
- func (this *FileService) GetFile(userId, fileId string) string
- func (this *FileService) IsMyFile(userId, fileId string) bool
- func (this *FileService) ListImagesWithPage(userId, albumId, key string, pageNumber, pageSize int) info.Page
- func (this *FileService) UpdateImage(userId, fileId, title string) bool
- func (this *FileService) UpdateImageTitle(userId, fileId, title string) bool
- type GroupService
- func (this *GroupService) AddGroup(userId, title string) (bool, info.Group)
- func (this *GroupService) AddUser(ownUserId, groupId, userId string) (ok bool, msg string)
- func (this *GroupService) DeleteGroup(userId, groupId string) (ok bool, msg string)
- func (this *GroupService) DeleteUser(ownUserId, groupId, userId string) (ok bool, msg string)
- func (this *GroupService) GetBelongToGroupIds(userId string) []bson.ObjectId
- func (this *GroupService) GetGroup(userId, groupId string) info.Group
- func (this *GroupService) GetGroups(userId string) []info.Group
- func (this *GroupService) GetGroupsAndUsers(userId string) []info.Group
- func (this *GroupService) GetGroupsContainOf(userId string) []info.Group
- func (this *GroupService) GetMineAndBelongToGroupIds(userId string) []bson.ObjectId
- func (this *GroupService) GetUsers(groupId string) []info.User
- func (this *GroupService) IsExistsGroupUser(userId, groupId string) (ok bool)
- func (this *GroupService) UpdateGroupTitle(userId, groupId, title string) (ok bool)
- type NoteContentHistoryService
- type NoteImageService
- type NoteService
- func (this *NoteService) AddNote(note info.Note, fromApi bool) info.Note
- func (this *NoteService) AddNoteAndContent(note info.Note, noteContent info.Note, myUserId bson.ObjectId) info.Note
- func (this *NoteService) AddNoteAndContentApi(note info.Note, noteContent info.Note, myUserId bson.ObjectId) info.Note
- func (this *NoteService) AddNoteAndContentForController(note info.Note, noteContent info.Note, updatedUserId string) info.Note
- func (this *NoteService) AddNoteContent(noteContent info.Note) info.Note
- func (this *NoteService) AddSharedNote(note info.Note, myUserId bson.ObjectId) info.Note
- func (this *NoteService) CopyNote(noteId, notebookId, userId string) info.Note
- func (this *NoteService) CopySharedNote(noteId, notebookId, fromUserId, myUserId string) info.Note
- func (this *NoteService) CountBlog(userId string) int
- func (this *NoteService) CountNote(userId string) int
- func (this *NoteService) CountNoteByTag(userId string, tag string) int
- func (this *NoteService) GetBlogNote(noteId string) (note info.Note)
- func (this *NoteService) GetNote(noteId, userId string) (note info.Note)
- func (this *NoteService) GetNoteById(noteId string) (note info.Note)
- func (this *NoteService) GetNoteContent(noteId, userId string) (noteContent info.Note)
- func (this *NoteService) GetNotebookId(noteId string) bson.ObjectId
- func (this *NoteService) GetSyncNotes(userId string, afterUsn, maxEntry int) []info.ApiNote
- func (this *NoteService) IncrNoteUsn(noteId, userId string) int
- func (this *NoteService) IsBlog(noteId string) bool
- func (this *NoteService) ListNoteAbstractsByNoteIds(noteIds []bson.ObjectId) (notes []info.Note)
- func (this *NoteService) ListNoteContentByNoteIds(noteIds []bson.ObjectId) (notes []info.Note)
- func (this *NoteService) ListNoteContentsByNoteIds(noteIds []bson.ObjectId) (notes []info.Note)
- func (this *NoteService) ListNotes(notebookId string, isTrash bool, pageNumber, pageSize int, sortField string, ...) (count int, notes []info.Note)
- func (this *NoteService) ListNotesByNoteIds(noteIds []bson.ObjectId) (notes []info.Note)
- func (this *NoteService) ListNotesByNoteIdsWithPageSort(noteIds []bson.ObjectId, userId string, pageNumber, pageSize int, ...) (notes []info.Note)
- func (this *NoteService) ListUserNotes(userId, notebookId string, isTrash bool, pageNumber, pageSize int, ...) (count int, notes []info.Note)
- func (this *NoteService) MoveNote(noteId, notebookId, userId string) info.Note
- func (this *NoteService) SearchNote(key, userId string, pageNumber, pageSize int, sortField string, ...) (count int, notes []info.Note)
- func (this *NoteService) SearchNoteByTags(tags []string, userId string, pageNumber, pageSize int, sortField string, ...) (count int, notes []info.Note)
- func (this *NoteService) ToApiNote(note *info.Note, files []info.NoteFile) info.ApiNote
- func (this *NoteService) ToApiNotes(notes []info.Note) []info.ApiNote
- func (this *NoteService) ToBlog(userId, noteId string, isBlog, isTop bool) bool
- func (this *NoteService) UpdateNote(updatedUserId, noteId string, needUpdate bson.M, usn int) (bool, string, int)
- func (this *NoteService) UpdateNoteContent(updatedUserId, noteId, content, abstract string, hasBeforeUpdateNote bool, ...) (bool, string, int)
- func (this *NoteService) UpdateNoteTitle(userId, updatedUserId, noteId, title string) bool
- func (this *NoteService) UpdateNoteToDeleteTag(userId string, targetTag string) map[string]int
- func (this *NoteService) UpdateTags(noteId string, userId string, tags []string) bool
- type NotebookService
- func (this *NotebookService) AddNotebook(notebook info.Notebook) (bool, info.Notebook)
- func (this *NotebookService) DeleteNotebook(userId, notebookId string) (bool, string)
- func (this *NotebookService) DeleteNotebookForce(userId, notebookId string, usn int) (bool, string)
- func (this *NotebookService) DragNotebooks(userId string, curNotebookId string, parentNotebookId string, ...) bool
- func (this *NotebookService) GeSyncNotebooks(userId string, afterUsn, maxEntry int) []info.Notebook
- func (this *NotebookService) GetNotebook(notebookId, userId string) info.Notebook
- func (this *NotebookService) GetNotebookById(notebookId string) info.Notebook
- func (this *NotebookService) GetNotebookByUserIdAndUrlTitle(userId, notebookIdOrUrlTitle string) info.Notebook
- func (this *NotebookService) GetNotebooks(userId string) info.SubNotebooks
- func (this *NotebookService) GetNotebooksByNotebookIds(notebookIds []bson.ObjectId) info.SubNotebooks
- func (this *NotebookService) IsBlog(notebookId string) bool
- func (this *NotebookService) IsMyNotebook(notebookId, userId string) bool
- func (this *NotebookService) ReCountAll()
- func (this *NotebookService) ReCountNotebookNumberNotes(notebookId string) bool
- func (this *NotebookService) SortNotebooks(userId string, notebookId2Seqs map[string]int) bool
- func (this *NotebookService) ToBlog(userId, notebookId string, isBlog bool) bool
- func (this *NotebookService) UpdateNotebook(userId, notebookId string, needUpdate bson.M) bool
- func (this *NotebookService) UpdateNotebookApi(userId, notebookId, title, parentNotebookId string, seq, usn int) (bool, string, info.Notebook)
- func (this *NotebookService) UpdateNotebookTitle(notebookId, userId, title string) bool
- type PwdService
- type SessionService
- func (this *SessionService) Clear(sessionId string) bool
- func (this *SessionService) ClearLoginTimes(sessionId string) bool
- func (this *SessionService) Get(sessionId string) info.Session
- func (this *SessionService) GetCaptcha(sessionId string) string
- func (this *SessionService) GetUserId(sessionId string) string
- func (this *SessionService) IncrLoginTimes(sessionId string) bool
- func (this *SessionService) LoginTimesIsOver(sessionId string) bool
- func (this *SessionService) SetCaptcha(sessionId, captcha string) bool
- func (this *SessionService) SetUserId(sessionId, userId string) bool
- func (this *SessionService) Update(sessionId, key string, value interface{}) bool
- type ShareService
- func (this *ShareService) AddHasShareNote(userId, toUserId string) bool
- func (this *ShareService) AddShareNote(noteId string, perm int, userId, email string) (bool, string, string)
- func (this *ShareService) AddShareNoteGroup(userId, noteId, groupId string, perm int) bool
- func (this *ShareService) AddShareNoteToUserId(noteId string, perm int, userId, toUserId string) (bool, string, string)
- func (this *ShareService) AddShareNotebook(notebookId string, perm int, userId, email string) (bool, string, string)
- func (this *ShareService) AddShareNotebook1(shareNotebook info.ShareNotebook) bool
- func (this *ShareService) AddShareNotebookGroup(userId, notebookId, groupId string, perm int) bool
- func (this *ShareService) AddShareNotebookToUserId(notebookId string, perm int, userId, toUserId string) (bool, string, string)
- func (this *ShareService) DeleteAllShareNoteGroup(groupId string) bool
- func (this *ShareService) DeleteAllShareNotebookGroup(groupId string) bool
- func (this *ShareService) DeleteShareNote(noteId string, userId, toUserId string) bool
- func (this *ShareService) DeleteShareNoteAll(noteId string, userId string) bool
- func (this *ShareService) DeleteShareNoteGroup(userId, noteId, groupId string) bool
- func (this *ShareService) DeleteShareNoteGroupWhenDeleteGroupUser(userId, groupId string) bool
- func (this *ShareService) DeleteShareNotebook(notebookId string, userId, toUserId string) bool
- func (this *ShareService) DeleteShareNotebookGroup(userId, notebookId, groupId string) bool
- func (this *ShareService) DeleteShareNotebookGroupWhenDeleteGroupUser(userId, groupId string) bool
- func (this *ShareService) DeleteUserShareNoteAndNotebook(userId, toUserId string) bool
- func (this *ShareService) GetNoteShareGroups(noteId, userId string) []info.ShareNote
- func (this *ShareService) GetNotebookShareGroups(notebookId, userId string) []info.ShareNotebook
- func (this *ShareService) GetShareNoteContent(noteId, myUserId, sharedUserId string) (noteContent info.Note)
- func (this *ShareService) GetShareNotebooks(userId string) (info.ShareNotebooksByUser, []info.User)
- func (this *ShareService) HasReadNotePerm(noteId, userId string) bool
- func (this *ShareService) HasReadPerm(userId, updatedUserId, noteId string) bool
- func (this *ShareService) HasSharedNote(noteId, myUserId string) bool
- func (this *ShareService) HasSharedNotebook(noteId, myUserId, sharedUserId string) bool
- func (this *ShareService) HasUpdateNotePerm(noteId, userId string) bool
- func (this *ShareService) HasUpdateNotebookPerm(userId, updatedUserId, notebookId string) bool
- func (this *ShareService) HasUpdatePerm(userId, updatedUserId, noteId string) bool
- func (this *ShareService) ListNoteShareUserInfo(noteId, userId string) []info.ShareUserInfo
- func (this *ShareService) ListNotebookShareUserInfo(notebookId, userId string) []info.ShareUserInfo
- func (this *ShareService) ListShareNotes(myUserId, sharedUserId string, pageNumber, pageSize int, sortField string, ...) []info.ShareNoteWithPerm
- func (this *ShareService) ListShareNotesByNotebookId(notebookId, myUserId, sharedUserId string, page, pageSize int, ...) []info.ShareNoteWithPerm
- func (this *ShareService) UpdateShareNotePerm(noteId string, perm int, userId, toUserId string) bool
- func (this *ShareService) UpdateShareNotebookPerm(notebookId string, perm int, userId, toUserId string) bool
- type SuggestionService
- type TagService
- func (this *TagService) AddOrUpdateTag(userId string, tag string) info.NoteTag
- func (this *TagService) AddTags(userId string, tags []string) bool
- func (this *TagService) AddTagsI(userId string, tags interface{}) bool
- func (this *TagService) DeleteTag(userId string, tag string) map[string]int
- func (this *TagService) DeleteTagApi(userId string, tag string, usn int) (ok bool, msg string, toUsn int)
- func (this *TagService) GeSyncTags(userId string, afterUsn, maxEntry int) []info.NoteTag
- func (this *TagService) GetTags(userId string) []info.NoteTag
- type ThemeService
- func (this *ThemeService) ActiveTheme(userId, themeId string) (ok bool)
- func (this *ThemeService) CopyDefaultTheme(userBlog info.UserBlog) (ok bool, themeId string)
- func (this *ThemeService) DeleteTheme(userId, themeId string) (ok bool)
- func (this *ThemeService) DeleteTpl(userId, themeId, filename string) (ok bool)
- func (this *ThemeService) ExportTheme(userId, themeId string) (ok bool, path string)
- func (this *ThemeService) GetDefaultThemePath(style string) string
- func (this *ThemeService) GetDefaultThemes() (themes []info.Theme)
- func (this *ThemeService) GetTheme(userId, themeId string) info.Theme
- func (this *ThemeService) GetThemeAbsolutePath(userId, themeId string) string
- func (this *ThemeService) GetThemeById(themeId string) info.Theme
- func (this *ThemeService) GetThemeInfo(themeId, style string) map[string]interface{}
- func (this *ThemeService) GetThemePath(userId, themeId string) string
- func (this *ThemeService) GetTplContent(userId, themeId, filename string) string
- func (this *ThemeService) GetUserThemes(userId string) (theme info.Theme, themes []info.Theme)
- func (this *ThemeService) ImportTheme(userId, path string) (ok bool, msg string)
- func (this *ThemeService) InstallTheme(userId, themeId string) (ok bool)
- func (this *ThemeService) NewTheme(userId string) (ok bool, themeId string)
- func (this *ThemeService) NewThemeForFirst(userBlog info.UserBlog) (ok bool, themeId string)
- func (this *ThemeService) PublicTheme(userId, themeId string) (ok bool)
- func (this *ThemeService) UpdateTplContent(userId, themeId, filename, content string) (ok bool, msg string)
- func (this *ThemeService) UpgradeThemeBeta2() (ok bool)
- func (this *ThemeService) ValidateTheme(path string, filename, newContent string) (ok bool, msg string)
- type TokenService
- func (this *TokenService) DeleteToken(userId string, tokenType int) bool
- func (this *TokenService) GetOverHours(tokenType int) float64
- func (this *TokenService) NewToken(userId string, email string, tokenType int) string
- func (this *TokenService) VerifyToken(token string, tokenType int) (ok bool, msg string, tokenInfo info.Token)
- type TrashService
- func (this *TrashService) DeleteNote(noteId, userId string) bool
- func (this *TrashService) DeleteSharedNote(noteId, userId, myUserId string) bool
- func (this *TrashService) DeleteTrash(noteId, userId string) bool
- func (this *TrashService) DeleteTrashApi(noteId, userId string, usn int) (bool, string, int)
- func (this *TrashService) ListNotes(userId string, pageNumber, pageSize int, sortField string, isAsc bool) (notes []info.Note)
- type UpgradeService
- type UserService
- func (this *UserService) ActiveEmail(token string) (ok bool, msg, email string)
- func (this *UserService) AddUser(user info.User) bool
- func (this *UserService) CountUser() int
- func (this *UserService) GetAllUserByFilter(userFilterEmail, userFilterWhiteList, userFilterBlackList string, ...) []info.User
- func (this *UserService) GetUserAndBlog(userId string) info.UserAndBlog
- func (this *UserService) GetUserId(email string) string
- func (this *UserService) GetUserInfo(userId string) info.User
- func (this *UserService) GetUserInfoByAny(idEmailUsername string) info.User
- func (this *UserService) GetUserInfoByEmail(email string) info.User
- func (this *UserService) GetUserInfoByName(emailOrUsername string) info.User
- func (this *UserService) GetUserInfoByThirdUserId(thirdUserId string) info.User
- func (this *UserService) GetUserInfoByUsername(username string) info.User
- func (this *UserService) GetUserInfosOrderBySeq(userIds []bson.ObjectId) []info.User
- func (this *UserService) GetUsername(userId string) string
- func (this *UserService) GetUsn(userId string) int
- func (this *UserService) IncrUsn(userId string) int
- func (this *UserService) IsExistsUser(email string) bool
- func (this *UserService) IsExistsUserByUsername(username string) bool
- func (this *UserService) ListUserInfosByEmails(emails []string) []info.User
- func (this *UserService) ListUserInfosByUserIds(userIds []bson.ObjectId) []info.User
- func (this *UserService) ListUsers(pageNumber, pageSize int, sortField string, isAsc bool, email string) (page info.Page, users []info.User)
- func (this *UserService) MapUserAndBlogByUserIds(userIds []bson.ObjectId) map[string]info.UserAndBlog
- func (this *UserService) MapUserInfoAndBlogInfosByUserIds(userIds []bson.ObjectId) map[bson.ObjectId]info.User
- func (this *UserService) MapUserInfoByUserIds(userIds []bson.ObjectId) map[bson.ObjectId]info.User
- func (this *UserService) ResetPwd(adminUserId, userId, pwd string) (ok bool, msg string)
- func (this *UserService) ThirdAddUser(userId, email, pwd string) (ok bool, msg string)
- func (this *UserService) UpdateAccount(userId, accountType string, accountStartTime, accountEndTime time.Time, ...) bool
- func (this *UserService) UpdateAvatar(userId, avatarPath string) bool
- func (this *UserService) UpdateColumnWidth(userId string, notebookWidth, noteListWidth, mdEditorWidth int) bool
- func (this *UserService) UpdateEmail(token string) (ok bool, msg, email string)
- func (this *UserService) UpdateLeftIsMin(userId string, leftIsMin bool) bool
- func (this *UserService) UpdatePwd(userId, oldPwd, pwd string) (bool, string)
- func (this *UserService) UpdateTheme(userId, theme string) bool
- func (this *UserService) UpdateUsername(userId, username string) (bool, string)
Constants ¶
const DEFAULT_ALBUM_ID = "52d3e8ac99c37b7f0d000001"
const IMAGE_TYPE = 0
Variables ¶
This section is empty.
Functions ¶
func GetUrTitle ¶
types == note,notebook,single
func InitEmailFromDb ¶
func InitEmailFromDb()
func ParseAndSortNotebooks ¶
func ParseAndSortNotebooks(userNotebooks []info.Notebook, noParentDelete, needSort bool) info.SubNotebooks
整理(成有关系)并排序 GetNotebooks()调用 ShareService调用
Types ¶
type AlbumService ¶
type AlbumService struct { }
var AlbumS *AlbumService
func (*AlbumService) DeleteAlbum ¶
func (this *AlbumService) DeleteAlbum(userId, albumId string) (bool, string)
delete album presupposition: has no images under this ablum
func (*AlbumService) GetAlbums ¶
func (this *AlbumService) GetAlbums(userId string) []info.Album
get albums
func (*AlbumService) UpdateAlbum ¶
func (this *AlbumService) UpdateAlbum(albumId, userId, name string) bool
update album name
type AttachService ¶
type AttachService struct { }
var AttachS *AttachService
func (*AttachService) AddAttach ¶
add attach api调用时, 添加attach之前是没有note的 fromApi表示是api添加的, updateNote传过来的, 此时不要incNote's usn, 因为updateNote会inc的
func (*AttachService) CopyAttachs ¶
func (this *AttachService) CopyAttachs(noteId, toNoteId, toUserId string) bool
复制笔记时需要复制附件 noteService调用, 权限已判断
func (*AttachService) DeleteAllAttachs ¶
func (this *AttachService) DeleteAllAttachs(noteId, userId string) bool
Delete note to delete attas firstly
func (*AttachService) DeleteAttach ¶
func (this *AttachService) DeleteAttach(attachId, userId string) (bool, string)
delete attach
func (*AttachService) GetAttach ¶
func (this *AttachService) GetAttach(attachId, userId string) (attach info.Attach)
获取文件路径 要判断是否具有权限 userId是否具有attach的访问权限
func (*AttachService) ListAttachs ¶
func (this *AttachService) ListAttachs(noteId, userId string) []info.Attach
list attachs
func (*AttachService) UpdateImageTitle ¶
func (this *AttachService) UpdateImageTitle(userId, fileId, title string) bool
func (*AttachService) UpdateOrDeleteAttachApi ¶
func (this *AttachService) UpdateOrDeleteAttachApi(noteId, userId string, files []info.NoteFile) bool
只留下files的数据, 其它的都删除
type AuthService ¶
type AuthService struct { }
var AuthS *AuthService
func (*AuthService) Login ¶
func (this *AuthService) Login(emailOrUsername, pwd string) (info.User, error)
Use bcrypt
func (*AuthService) Register ¶
func (this *AuthService) Register(email, pwd, fromUserId string) (bool, string)
注册
注册 leanote@leanote.com userId = "5368c1aa99c37b029d000001" 添加 在博客上添加一篇欢迎note, note1 5368c1b919807a6f95000000
将nk1(只读), nk2(可写) 分享给该用户 将note1 复制到用户的生活nk上
1. 添加用户 2. 将leanote共享给我 [ok]
func (*AuthService) ThirdRegister ¶
func (this *AuthService) ThirdRegister(thirdType, thirdUserId, thirdUsername string) (exists bool, userInfo info.User)
type BlogService ¶
type BlogService struct { }
blog
note, notebook都可设为blog 关键是, 怎么得到blog列表? 还要分页
??? 不用新建, 直接使用notes表, 添加IsBlog字段. 新建表 blogs {NoteId, UserId, CreatedTime, IsTop(置顶)}, NoteId, UserId 为unique!!
// 设置一个note为blog 添加到blogs中
// 设置/取消notebook为blog 创建一个note时, 如果其notebookId已设为blog, 那么添加该note到blog中. 设置一个notebook为blog时, 将其下所有的note添加到blogs里 -> 更新其IsBlog为true 取消一个notebook不为blog时, 删除其下的所有note -> 更新其IsBlog为false
var BlogS *BlogService
func (*BlogService) AddOrUpdateSingle ¶
func (this *BlogService) AddOrUpdateSingle(userId, singleId, title, content string) (ok bool)
更新或添加
func (*BlogService) Comment ¶
func (this *BlogService) Comment(noteId, toCommentId, userId, content string) (bool, info.BlogComment)
评论 在noteId博客下userId 给toUserId评论content commentId可为空(针对某条评论评论)
func (*BlogService) DeleteComment ¶
func (this *BlogService) DeleteComment(noteId, commentId, userId string) bool
作者(或管理员)可以删除所有评论 自己可以删除评论
func (*BlogService) DeleteSingle ¶
func (this *BlogService) DeleteSingle(userId, singleId string) (ok bool)
删除页面
func (*BlogService) FixBlogs ¶
func (this *BlogService) FixBlogs(blogs []info.BlogItem) []info.Post
转成post
func (*BlogService) GetBlog ¶
func (this *BlogService) GetBlog(noteId string) (blog info.BlogItem)
得到某博客具体信息
func (*BlogService) GetBlogByIdAndUrlTitle ¶
func (this *BlogService) GetBlogByIdAndUrlTitle(userId string, noteIdOrUrlTitle string) (blog info.BlogItem)
通过id或urlTitle得到博客
func (*BlogService) GetBlogItem ¶
func (this *BlogService) GetBlogItem(note info.Note) (blog info.BlogItem)
func (*BlogService) GetBlogStat ¶
func (this *BlogService) GetBlogStat(noteId string) (stat info.BlogStat)
得到博客统计信息 ReadNum, LikeNum, CommentNum
func (*BlogService) GetBlogTags ¶
func (this *BlogService) GetBlogTags(userId string) []info.TagCount
得到博客的标签, 那得先得到所有博客, 比较慢
[
{Tag:xxx, Count: 32}
]
func (*BlogService) GetBlogUrls ¶
得到所有url
func (*BlogService) GetSingle ¶
func (this *BlogService) GetSingle(singleId string) info.BlogSingle
func (*BlogService) GetSingleByUserIdAndUrlTitle ¶
func (this *BlogService) GetSingleByUserIdAndUrlTitle(userId, singleIdOrUrlTitle string) info.BlogSingle
func (*BlogService) GetSingles ¶
func (this *BlogService) GetSingles(userId string) []map[string]string
单页
func (*BlogService) GetUserBlog ¶
func (this *BlogService) GetUserBlog(userId string) info.UserBlog
func (*BlogService) GetUserBlogByDomain ¶
func (this *BlogService) GetUserBlogByDomain(domain string) info.UserBlog
func (*BlogService) GetUserBlogBySubDomain ¶
func (this *BlogService) GetUserBlogBySubDomain(subDomain string) info.UserBlog
func (*BlogService) GetUserBlogUrl ¶
func (this *BlogService) GetUserBlogUrl(userBlog *info.UserBlog, username string) string
得到用户的博客url
func (*BlogService) IsILikeIt ¶
func (this *BlogService) IsILikeIt(noteId, userId string) bool
func (*BlogService) LikeBlog ¶
func (this *BlogService) LikeBlog(noteId, userId string) (ok bool, isLike bool)
点赞 retun ok , isLike
func (*BlogService) LikeComment ¶
func (this *BlogService) LikeComment(commentId, userId string) (ok bool, isILike bool, num int)
点赞/取消赞
func (*BlogService) ListAllBlogs ¶
func (this *BlogService) ListAllBlogs(userId, tag string, keywords string, isRecommend bool, page, pageSize int, sorterField string, isAsc bool) (info.Page, []info.BlogItem)
------- p 平台 lea+ 博客列表
func (*BlogService) ListBlogNotebooks ¶
func (this *BlogService) ListBlogNotebooks(userId string) []info.Notebook
得到用户共享的notebooks 3/19 博客不是deleted
func (*BlogService) ListBlogs ¶
func (this *BlogService) ListBlogs(notebookId string, page, pageSize int, sortField string, isAsc bool) (info.Page, []info.BlogItem)
所有博客列表
func (*BlogService) ListBlogsArchive ¶
func (this *BlogService) ListBlogsArchive(userId, notebookId string, year, month int, sortField string, isAsc bool) []info.Archive
归档博客
数据: 按年汇总 [ archive1, archive2, ] archive的数据类型是 { Year: 2014 Posts: [] }
func (*BlogService) ListComments ¶
func (this *BlogService) ListComments(userId, noteId string, page, pageSize int) (info.Page, []info.BlogCommentPublic, map[string]info.UserAndBlog)
评论列表 userId主要是显示userId是否点过某评论的赞 还要获取用户信息
func (*BlogService) ListLikedUsers ¶
func (this *BlogService) ListLikedUsers(noteId string, isAll bool) ([]info.UserAndBlog, bool)
返回所有liked用户, bool是否还有
func (*BlogService) ListUserBlogs ¶
func (this *BlogService) ListUserBlogs(userId, notebookId string, page, pageSize int, sortField string, isAsc bool) (info.Page, []info.BlogItem)
用户博客列表 userId 表示谁的blog
func (*BlogService) PreNextBlog ¶
func (this *BlogService) PreNextBlog(userId string, sorterField string, isAsc bool, noteId string, baseTime interface{}) (info.Post, info.Post)
上一篇文章, 下一篇文章 sorterField, baseTime是基准, sorterField=PublicTime, title isAsc是用户自定义的排序方式
func (*BlogService) ReCountBlogTags ¶
func (this *BlogService) ReCountBlogTags(userId string) bool
重新计算博客的标签 在设置设置/取消为博客时调用
func (*BlogService) Report ¶
func (this *BlogService) Report(noteId, commentId, reason, userId string) bool
举报
func (*BlogService) SearchBlog ¶
func (*BlogService) SearchBlogByTags ¶
func (this *BlogService) SearchBlogByTags(tags []string, userId string, pageNumber, pageSize int, sortField string, isAsc bool) (pageInfo info.Page, blogs []info.BlogItem)
根据tag搜索博客
func (*BlogService) SetRecommend ¶
func (this *BlogService) SetRecommend(noteId string, isRecommend bool) bool
推荐博客
func (*BlogService) SortSingles ¶
func (this *BlogService) SortSingles(userId string, singleIds []string) (ok bool)
重新排序
func (*BlogService) UpateBlogAbstract ¶
func (this *BlogService) UpateBlogAbstract(userId string, noteId, imgSrc, desc, abstract string) (ok bool)
修改博客的图片, 描述, 摘要
func (*BlogService) UpateBlogUrlTitle ¶
func (this *BlogService) UpateBlogUrlTitle(userId string, noteId, urlTitle string) (ok bool, url string)
修改笔记urlTitle
func (*BlogService) UpateCateIds ¶
func (this *BlogService) UpateCateIds(userId string, cateIds []string) bool
CateIds
func (*BlogService) UpateCateUrlTitle ¶
func (this *BlogService) UpateCateUrlTitle(userId string, cateId, urlTitle string) (ok bool, url string)
修改笔记本urlTitle
func (*BlogService) UpdateSingleUrlTitle ¶
func (this *BlogService) UpdateSingleUrlTitle(userId, singleId, urlTitle string) (ok bool, url string)
修改urlTitle
func (*BlogService) UpdateUserBlog ¶
func (this *BlogService) UpdateUserBlog(userBlog info.UserBlog) bool
修改之
func (*BlogService) UpdateUserBlogBase ¶
func (this *BlogService) UpdateUserBlogBase(userId string, userBlog info.UserBlogBase) bool
修改之UserBlogBase
func (*BlogService) UpdateUserBlogComment ¶
func (this *BlogService) UpdateUserBlogComment(userId string, userBlog info.UserBlogComment) bool
func (*BlogService) UpdateUserBlogPaging ¶
func (this *BlogService) UpdateUserBlogPaging(userId string, perPageSize int, sortField string, isAsc bool) (ok bool, msg string)
分页与排序
func (*BlogService) UpdateUserBlogStyle ¶
func (this *BlogService) UpdateUserBlogStyle(userId string, userBlog info.UserBlogStyle) bool
type ConfigService ¶
type ConfigService struct { // 全局的 GlobalAllConfigs map[string]interface{} GlobalStringConfigs map[string]string GlobalArrayConfigs map[string][]string GlobalMapConfigs map[string]map[string]string GlobalArrMapConfigs map[string][]map[string]string // contains filtered or unexported fields }
配置服务 只是全局的, 用户的配置没有
var ConfigS *ConfigService
func (*ConfigService) AddBackup ¶
func (this *ConfigService) AddBackup(path, remark string) bool
添加备份
func (*ConfigService) AllowCustomDomain ¶
func (this *ConfigService) AllowCustomDomain() bool
是否允许自定义域名
func (*ConfigService) Backup ¶
func (this *ConfigService) Backup(remark string) (ok bool, msg string)
func (*ConfigService) DeleteBackup ¶
func (this *ConfigService) DeleteBackup(createdTime string) (bool, string)
func (*ConfigService) GetAdminUserId ¶
func (this *ConfigService) GetAdminUserId() string
func (*ConfigService) GetAdminUsername ¶
func (this *ConfigService) GetAdminUsername() string
func (*ConfigService) GetBackup ¶
func (this *ConfigService) GetBackup(createdTime string) (map[string]string, bool)
得到备份
func (*ConfigService) GetBlogUrl ¶
func (this *ConfigService) GetBlogUrl() string
func (*ConfigService) GetGlobalArrMapConfig ¶
func (this *ConfigService) GetGlobalArrMapConfig(key string) []map[string]string
func (*ConfigService) GetGlobalArrayConfig ¶
func (this *ConfigService) GetGlobalArrayConfig(key string) []string
func (*ConfigService) GetGlobalConfigForUser ¶
func (this *ConfigService) GetGlobalConfigForUser() map[string]interface{}
为用户得到全局的配置 NoteController调用
func (*ConfigService) GetGlobalMapConfig ¶
func (this *ConfigService) GetGlobalMapConfig(key string) map[string]string
func (*ConfigService) GetGlobalStringConfig ¶
func (this *ConfigService) GetGlobalStringConfig(key string) string
获取全局配置, 博客平台使用
func (*ConfigService) GetLeaUrl ¶
func (this *ConfigService) GetLeaUrl() string
func (*ConfigService) GetNoteUrl ¶
func (this *ConfigService) GetNoteUrl() string
func (*ConfigService) GetSchema ¶
func (this *ConfigService) GetSchema() string
func (*ConfigService) GetSiteUrl ¶
func (this *ConfigService) GetSiteUrl() string
func (*ConfigService) GetUploadSize ¶
func (this *ConfigService) GetUploadSize(key string) float64
上传大小
func (*ConfigService) GetUploadSizeLimit ¶
func (this *ConfigService) GetUploadSizeLimit() map[string]float64
func (*ConfigService) GetUserSubUrl ¶
func (this *ConfigService) GetUserSubUrl(subDomain string) string
func (*ConfigService) GetUserUrl ¶
func (this *ConfigService) GetUserUrl(domain string) string
func (*ConfigService) GetVersion ¶
func (this *ConfigService) GetVersion() string
func (*ConfigService) HomePageIsAdminsBlog ¶
func (this *ConfigService) HomePageIsAdminsBlog() bool
主页是否是管理员的博客页
func (*ConfigService) InitGlobalConfigs ¶
func (this *ConfigService) InitGlobalConfigs() bool
appStart时 将全局的配置从数据库中得到作为全局
func (*ConfigService) IsGoodCustomDomain ¶
func (this *ConfigService) IsGoodCustomDomain(domain string) bool
是否是好的自定义域名
func (*ConfigService) IsGoodSubDomain ¶
func (this *ConfigService) IsGoodSubDomain(domain string) bool
func (*ConfigService) IsOpenRegister ¶
func (this *ConfigService) IsOpenRegister() bool
func (*ConfigService) Restore ¶
func (this *ConfigService) Restore(createdTime string) (ok bool, msg string)
还原
func (*ConfigService) UpdateBackupRemark ¶
func (this *ConfigService) UpdateBackupRemark(createdTime, remark string) (bool, string)
func (*ConfigService) UpdateGlobalArrMapConfig ¶
func (this *ConfigService) UpdateGlobalArrMapConfig(userId, key string, value []map[string]string) bool
func (*ConfigService) UpdateGlobalArrayConfig ¶
func (this *ConfigService) UpdateGlobalArrayConfig(userId, key string, value []string) bool
func (*ConfigService) UpdateGlobalMapConfig ¶
func (this *ConfigService) UpdateGlobalMapConfig(userId, key string, value map[string]string) bool
func (*ConfigService) UpdateGlobalStringConfig ¶
func (this *ConfigService) UpdateGlobalStringConfig(userId, key string, value string) bool
更新用户配置
func (*ConfigService) UpdateShareNoteConfig ¶
func (this *ConfigService) UpdateShareNoteConfig(registerSharedUserId string, registerSharedNotebookPerms, registerSharedNotePerms []int, registerSharedNotebookIds, registerSharedNoteIds, registerCopyNoteIds []string) (ok bool, msg string)
------- 修改共享笔记的配置
type EmailService ¶
type EmailService struct {
// contains filtered or unexported fields
}
var EmailS *EmailService
func NewEmailService ¶
func NewEmailService() *EmailService
func (*EmailService) AddEmailLog ¶
func (this *EmailService) AddEmailLog(email, subject, body string, ok bool, msg string)
添加邮件日志
func (*EmailService) DeleteEmails ¶
func (this *EmailService) DeleteEmails(ids []string) bool
func (*EmailService) FindPwdSendEmail ¶
func (this *EmailService) FindPwdSendEmail(token, email string) (ok bool, msg string)
func (*EmailService) ListEmailLogs ¶
func (*EmailService) RegisterSendActiveEmail ¶
func (this *EmailService) RegisterSendActiveEmail(userInfo info.User, email string) bool
AddUser调用 可以使用一个goroutine
func (*EmailService) SendCommentEmail ¶
func (this *EmailService) SendCommentEmail(note info.Note, comment info.BlogComment, userId, content string) bool
发送评论
func (*EmailService) SendEmail ¶
func (this *EmailService) SendEmail(to, subject, body string) (ok bool, e string)
func (*EmailService) SendEmailToEmails ¶
func (this *EmailService) SendEmailToEmails(emails []string, subject, body string) (ok bool, msg string)
func (*EmailService) SendEmailToUsers ¶
func (this *EmailService) SendEmailToUsers(users []info.User, subject, body string) (ok bool, msg string)
发送email给用户 需要记录
func (*EmailService) SendInviteEmail ¶
func (this *EmailService) SendInviteEmail(userInfo info.User, email, content string) bool
发送邀请链接
func (*EmailService) UpdateEmailSendActiveEmail ¶
func (this *EmailService) UpdateEmailSendActiveEmail(userInfo info.User, email string) (ok bool, msg string)
修改邮箱
type FileService ¶
type FileService struct { }
var FileS *FileService
func (*FileService) AddImage ¶
func (this *FileService) AddImage(image info.File, albumId, userId string, needCheckSize bool) (ok bool, msg string)
add Image
func (*FileService) CopyImage ¶
func (this *FileService) CopyImage(userId, fileId, toUserId string) (bool, string)
复制图片
func (*FileService) DeleteImage ¶
func (this *FileService) DeleteImage(userId, fileId string) (bool, string)
delete image
func (*FileService) GetAllImageNamesMap ¶
func (this *FileService) GetAllImageNamesMap(userId string) (m map[string]bool)
get all images names for upgrade
func (*FileService) GetFile ¶
func (this *FileService) GetFile(userId, fileId string) string
获取文件路径 要判断是否具有权限 userId是否具有fileId的访问权限
func (*FileService) IsMyFile ¶
func (this *FileService) IsMyFile(userId, fileId string) bool
是否是我的文件
func (*FileService) ListImagesWithPage ¶
func (this *FileService) ListImagesWithPage(userId, albumId, key string, pageNumber, pageSize int) info.Page
list images if albumId == "" get default album images
func (*FileService) UpdateImage ¶
func (this *FileService) UpdateImage(userId, fileId, title string) bool
update image title
func (*FileService) UpdateImageTitle ¶
func (this *FileService) UpdateImageTitle(userId, fileId, title string) bool
type GroupService ¶
type GroupService struct { }
var GroupS *GroupService
func (*GroupService) AddGroup ¶
func (this *GroupService) AddGroup(userId, title string) (bool, info.Group)
添加分组
func (*GroupService) AddUser ¶
func (this *GroupService) AddUser(ownUserId, groupId, userId string) (ok bool, msg string)
为group添加用户 用户是否已存在?
func (*GroupService) DeleteGroup ¶
func (this *GroupService) DeleteGroup(userId, groupId string) (ok bool, msg string)
删除分组 判断是否有好友
func (*GroupService) DeleteUser ¶
func (this *GroupService) DeleteUser(ownUserId, groupId, userId string) (ok bool, msg string)
删除用户
func (*GroupService) GetBelongToGroupIds ¶
func (this *GroupService) GetBelongToGroupIds(userId string) []bson.ObjectId
得到我所属的所有分组ids
func (*GroupService) GetGroup ¶
func (this *GroupService) GetGroup(userId, groupId string) info.Group
得到分组, shareService用
func (*GroupService) GetGroups ¶
func (this *GroupService) GetGroups(userId string) []info.Group
仅仅得到所有分组
func (*GroupService) GetGroupsAndUsers ¶
func (this *GroupService) GetGroupsAndUsers(userId string) []info.Group
得到用户的所有分组(包括下的所有用户)
func (*GroupService) GetGroupsContainOf ¶
func (this *GroupService) GetGroupsContainOf(userId string) []info.Group
获取包含此用户的组对象数组 获取该用户所属组, 和我的组
func (*GroupService) GetMineAndBelongToGroupIds ¶
func (this *GroupService) GetMineAndBelongToGroupIds(userId string) []bson.ObjectId
得到我的和我所属组的ids
func (*GroupService) GetUsers ¶
func (this *GroupService) GetUsers(groupId string) []info.User
得到某分组下的用户
func (*GroupService) IsExistsGroupUser ¶
func (this *GroupService) IsExistsGroupUser(userId, groupId string) (ok bool)
判断组中是否包含指定用户
func (*GroupService) UpdateGroupTitle ¶
func (this *GroupService) UpdateGroupTitle(userId, groupId, title string) (ok bool)
修改group标题
type NoteContentHistoryService ¶
type NoteContentHistoryService struct { }
历史记录
var NoteContentHistoryS *NoteContentHistoryService
func (*NoteContentHistoryService) AddHistory ¶
func (this *NoteContentHistoryService) AddHistory(noteId, userId string, eachHistory info.EachHistory)
新建一个note, 不需要添加历史记录 添加历史
func (*NoteContentHistoryService) ListHistories ¶
func (this *NoteContentHistoryService) ListHistories(noteId, userId string) []info.EachHistory
列表展示
type NoteImageService ¶
type NoteImageService struct { }
var NoteImageS *NoteImageService
func (*NoteImageService) CopyNoteImages ¶
func (this *NoteImageService) CopyNoteImages(fromNoteId, fromUserId, newNoteId, content, toUserId string) string
复制图片, 把note的图片都copy给我, 且修改noteContent图片路径
func (*NoteImageService) GetNoteIds ¶
func (this *NoteImageService) GetNoteIds(imageId string) []bson.ObjectId
通过id, userId得到noteIds
func (*NoteImageService) UpdateNoteImages ¶
func (this *NoteImageService) UpdateNoteImages(userId, noteId, imgSrc, content string) bool
TODO 这个web可以用, 但api会传来, 不用用了 解析内容中的图片, 建立图片与note的关系 <img src="/file/outputImage?fileId=12323232" /> 图片必须是我的, 不然不添加 imgSrc 防止博客修改了, 但内容删除了
type NoteService ¶
type NoteService struct { }
var NoteS *NoteService
func (*NoteService) AddNoteAndContent ¶
func (*NoteService) AddNoteAndContentApi ¶
func (*NoteService) AddNoteAndContentForController ¶
func (this *NoteService) AddNoteAndContentForController(note info.Note, noteContent info.Note, updatedUserId string) info.Note
添加笔记和内容 这里使用 info.NoteAndContent 接收?
func (*NoteService) AddNoteContent ¶
func (this *NoteService) AddNoteContent(noteContent info.Note) info.Note
添加笔记本内容 [ok]
func (*NoteService) AddSharedNote ¶
添加共享d笔记
func (*NoteService) CopyNote ¶
func (this *NoteService) CopyNote(noteId, notebookId, userId string) info.Note
复制note 正常的可以用 先查, 再新建 要检查下notebookId是否是自己的
func (*NoteService) CopySharedNote ¶
func (this *NoteService) CopySharedNote(noteId, notebookId, fromUserId, myUserId string) info.Note
复制别人的共享笔记给我 将别人可用的图片转为我的图片, 复制图片
func (*NoteService) CountBlog ¶
func (this *NoteService) CountBlog(userId string) int
func (*NoteService) CountNote ¶
func (this *NoteService) CountNote(userId string) int
------------ 统计
func (*NoteService) CountNoteByTag ¶
func (this *NoteService) CountNoteByTag(userId string, tag string) int
通过标签来查询
func (*NoteService) GetBlogNote ¶
func (this *NoteService) GetBlogNote(noteId string) (note info.Note)
得到blog, blogService用 不要传userId, 因为是公开的
func (*NoteService) GetNote ¶
func (this *NoteService) GetNote(noteId, userId string) (note info.Note)
通过id, userId得到note
func (*NoteService) GetNoteById ¶
func (this *NoteService) GetNoteById(noteId string) (note info.Note)
fileService调用 不能是已经删除了的, life bug, 客户端删除后, 竟然还能在web上打开
func (*NoteService) GetNoteContent ¶
func (this *NoteService) GetNoteContent(noteId, userId string) (noteContent info.Note)
通过id, userId得到noteContent
func (*NoteService) GetNotebookId ¶
func (this *NoteService) GetNotebookId(noteId string) bson.ObjectId
通过noteId得到notebookId shareService call [ok]
func (*NoteService) GetSyncNotes ¶
func (this *NoteService) GetSyncNotes(userId string, afterUsn, maxEntry int) []info.ApiNote
获取同步的笔记 > afterUsn的笔记
func (*NoteService) IncrNoteUsn ¶
func (this *NoteService) IncrNoteUsn(noteId, userId string) int
附件修改, 增加noteIncr
func (*NoteService) ListNoteAbstractsByNoteIds ¶
func (this *NoteService) ListNoteAbstractsByNoteIds(noteIds []bson.ObjectId) (notes []info.Note)
只得到abstract, 不需要content
func (*NoteService) ListNoteContentByNoteIds ¶
func (this *NoteService) ListNoteContentByNoteIds(noteIds []bson.ObjectId) (notes []info.Note)
func (*NoteService) ListNoteContentsByNoteIds ¶
func (this *NoteService) ListNoteContentsByNoteIds(noteIds []bson.ObjectId) (notes []info.Note)
blog需要
func (*NoteService) ListNotes ¶
func (this *NoteService) ListNotes(notebookId string, isTrash bool, pageNumber, pageSize int, sortField string, isAsc bool, isBlog bool) (count int, notes []info.Note)
列出所有notes, 排序规则, 还有分页 CreatedTime, UpdatedTime, title 来排序
func (*NoteService) ListNotesByNoteIds ¶
func (this *NoteService) ListNotesByNoteIds(noteIds []bson.ObjectId) (notes []info.Note)
shareService调用
func (*NoteService) ListNotesByNoteIdsWithPageSort ¶
func (this *NoteService) ListNotesByNoteIdsWithPageSort(noteIds []bson.ObjectId, userId string, pageNumber, pageSize int, sortField string, isAsc bool, isBlog bool) (notes []info.Note)
通过noteIds来查询 ShareService调用
func (*NoteService) ListUserNotes ¶
func (this *NoteService) ListUserNotes(userId, notebookId string, isTrash bool, pageNumber, pageSize int, sortField string, isAsc bool, isBlog bool) (count int, notes []info.Note)
列出用户notes, 排序规则, 还有分页 CreatedTime, UpdatedTime, title 来排序
func (*NoteService) MoveNote ¶
func (this *NoteService) MoveNote(noteId, notebookId, userId string) info.Note
移动note trash, 正常的都可以用 1. 要检查下notebookId是否是自己的 2. 要判断之前是否是blog, 如果不是, 那么notebook是否是blog?
func (*NoteService) SearchNote ¶
func (this *NoteService) SearchNote(key, userId string, pageNumber, pageSize int, sortField string, isAsc, isBlog bool) (count int, notes []info.Note)
------------------ 搜索Note, 博客使用了
func (*NoteService) SearchNoteByTags ¶
func (this *NoteService) SearchNoteByTags(tags []string, userId string, pageNumber, pageSize int, sortField string, isAsc bool) (count int, notes []info.Note)
---------------- tag搜索
func (*NoteService) ToApiNotes ¶
func (this *NoteService) ToApiNotes(notes []info.Note) []info.ApiNote
note与apiNote的转换
func (*NoteService) ToBlog ¶
func (this *NoteService) ToBlog(userId, noteId string, isBlog, isTop bool) bool
func (*NoteService) UpdateNote ¶
func (this *NoteService) UpdateNote(updatedUserId, noteId string, needUpdate bson.M, usn int) (bool, string, int)
修改笔记 这里没有判断usn
func (*NoteService) UpdateNoteContent ¶
func (this *NoteService) UpdateNoteContent(updatedUserId, noteId, content, abstract string, hasBeforeUpdateNote bool, usn int) (bool, string, int)
修改笔记本内容 [ok] TODO perm未测 hasBeforeUpdateNote 之前是否更新过note其它信息, 如果有更新, usn不用更新 TODO abstract这里生成
func (*NoteService) UpdateNoteTitle ¶
func (this *NoteService) UpdateNoteTitle(userId, updatedUserId, noteId, title string) bool
这里要判断权限, 如果userId != updatedUserId, 那么需要判断权限 [ok] TODO perm还没测 [del]
func (*NoteService) UpdateNoteToDeleteTag ¶
func (this *NoteService) UpdateNoteToDeleteTag(userId string, targetTag string) map[string]int
删除tag 返回所有note的Usn
func (*NoteService) UpdateTags ¶
func (this *NoteService) UpdateTags(noteId string, userId string, tags []string) bool
更新tags [ok] [del]
type NotebookService ¶
type NotebookService struct { }
var NotebookS *NotebookService
func (*NotebookService) AddNotebook ¶
添加 [ok]
func (*NotebookService) DeleteNotebook ¶
func (this *NotebookService) DeleteNotebook(userId, notebookId string) (bool, string)
查看是否有子notebook 先查看该notebookId下是否有notes, 没有则删除
func (*NotebookService) DeleteNotebookForce ¶
func (this *NotebookService) DeleteNotebookForce(userId, notebookId string, usn int) (bool, string)
API调用, 删除笔记本, 不作笔记控制
func (*NotebookService) DragNotebooks ¶
func (this *NotebookService) DragNotebooks(userId string, curNotebookId string, parentNotebookId string, siblings []string) bool
排序和设置父
func (*NotebookService) GeSyncNotebooks ¶
func (this *NotebookService) GeSyncNotebooks(userId string, afterUsn, maxEntry int) []info.Notebook
同步的方法
func (*NotebookService) GetNotebook ¶
func (this *NotebookService) GetNotebook(notebookId, userId string) info.Notebook
得到某notebook
func (*NotebookService) GetNotebookById ¶
func (this *NotebookService) GetNotebookById(notebookId string) info.Notebook
func (*NotebookService) GetNotebookByUserIdAndUrlTitle ¶
func (this *NotebookService) GetNotebookByUserIdAndUrlTitle(userId, notebookIdOrUrlTitle string) info.Notebook
func (*NotebookService) GetNotebooks ¶
func (this *NotebookService) GetNotebooks(userId string) info.SubNotebooks
得到用户下所有的notebook 排序好之后返回 [ok]
func (*NotebookService) GetNotebooksByNotebookIds ¶
func (this *NotebookService) GetNotebooksByNotebookIds(notebookIds []bson.ObjectId) info.SubNotebooks
share调用, 不需要删除没有父的notebook 不需要排序, 因为会重新排序 通过notebookIds得到notebooks, 并转成层次有序
func (*NotebookService) IsBlog ¶
func (this *NotebookService) IsBlog(notebookId string) bool
判断是否是blog
func (*NotebookService) IsMyNotebook ¶
func (this *NotebookService) IsMyNotebook(notebookId, userId string) bool
判断是否是我的notebook
func (*NotebookService) ReCountAll ¶
func (this *NotebookService) ReCountAll()
func (*NotebookService) ReCountNotebookNumberNotes ¶
func (this *NotebookService) ReCountNotebookNumberNotes(notebookId string) bool
重新统计笔记本下的笔记数目 noteSevice: AddNote, CopyNote, CopySharedNote, MoveNote trashService: DeleteNote (recove不用, 都统一在MoveNote里了)
func (*NotebookService) SortNotebooks ¶
func (this *NotebookService) SortNotebooks(userId string, notebookId2Seqs map[string]int) bool
排序 传入 notebookId => Seq 为什么要传入userId, 防止修改其它用户的信息 (恶意) [ok]
func (*NotebookService) ToBlog ¶
func (this *NotebookService) ToBlog(userId, notebookId string, isBlog bool) bool
ToBlog or Not
func (*NotebookService) UpdateNotebook ¶
func (this *NotebookService) UpdateNotebook(userId, notebookId string, needUpdate bson.M) bool
更新notebook
func (*NotebookService) UpdateNotebookApi ¶
func (this *NotebookService) UpdateNotebookApi(userId, notebookId, title, parentNotebookId string, seq, usn int) (bool, string, info.Notebook)
更新笔记, api
func (*NotebookService) UpdateNotebookTitle ¶
func (this *NotebookService) UpdateNotebookTitle(notebookId, userId, title string) bool
更新笔记本标题 [ok]
type PwdService ¶
type PwdService struct { }
var PwdS *PwdService
type SessionService ¶
type SessionService struct { }
Session存储到mongodb中
var SessionS *SessionService
func (*SessionService) Clear ¶
func (this *SessionService) Clear(sessionId string) bool
注销时清空session
func (*SessionService) ClearLoginTimes ¶
func (this *SessionService) ClearLoginTimes(sessionId string) bool
登录成功后清空错误次数
func (*SessionService) GetCaptcha ¶
func (this *SessionService) GetCaptcha(sessionId string) string
---------- 验证码
func (*SessionService) GetUserId ¶
func (this *SessionService) GetUserId(sessionId string) string
----------- API
func (*SessionService) IncrLoginTimes ¶
func (this *SessionService) IncrLoginTimes(sessionId string) bool
增加错误次数
func (*SessionService) LoginTimesIsOver ¶
func (this *SessionService) LoginTimesIsOver(sessionId string) bool
登录错误时间是否已超过了
func (*SessionService) SetCaptcha ¶
func (this *SessionService) SetCaptcha(sessionId, captcha string) bool
func (*SessionService) SetUserId ¶
func (this *SessionService) SetUserId(sessionId, userId string) bool
登录成功后设置userId
func (*SessionService) Update ¶
func (this *SessionService) Update(sessionId, key string, value interface{}) bool
type ShareService ¶
type ShareService struct { }
共享Notebook, Note服务
func (*ShareService) AddHasShareNote ¶
func (this *ShareService) AddHasShareNote(userId, toUserId string) bool
共享note, notebook时使用
func (*ShareService) AddShareNote ¶
func (this *ShareService) AddShareNote(noteId string, perm int, userId, email string) (bool, string, string)
添加一个note共享 [ok]
func (this *ShareService) AddShareNote(shareNote info.ShareNote) bool { shareNote.CreatedTime = time.Now() return db.Insert(db.ShareNotes, shareNote) }
func (*ShareService) AddShareNoteGroup ¶
func (this *ShareService) AddShareNoteGroup(userId, noteId, groupId string, perm int) bool
共享笔记给分组
func (*ShareService) AddShareNoteToUserId ¶
func (this *ShareService) AddShareNoteToUserId(noteId string, perm int, userId, toUserId string) (bool, string, string)
第三方测试没有userId
func (*ShareService) AddShareNotebook ¶
func (this *ShareService) AddShareNotebook(notebookId string, perm int, userId, email string) (bool, string, string)
添加共享笔记本
func (*ShareService) AddShareNotebook1 ¶
func (this *ShareService) AddShareNotebook1(shareNotebook info.ShareNotebook) bool
添加一个notebook共享 [ok]
func (*ShareService) AddShareNotebookGroup ¶
func (this *ShareService) AddShareNotebookGroup(userId, notebookId, groupId string, perm int) bool
共享笔记给分组
func (*ShareService) AddShareNotebookToUserId ¶
func (this *ShareService) AddShareNotebookToUserId(notebookId string, perm int, userId, toUserId string) (bool, string, string)
第三方注册时没有email
func (*ShareService) DeleteAllShareNoteGroup ¶
func (this *ShareService) DeleteAllShareNoteGroup(groupId string) bool
func (*ShareService) DeleteAllShareNotebookGroup ¶
func (this *ShareService) DeleteAllShareNotebookGroup(groupId string) bool
func (*ShareService) DeleteShareNote ¶
func (this *ShareService) DeleteShareNote(noteId string, userId, toUserId string) bool
--------------- 删除share note
func (*ShareService) DeleteShareNoteAll ¶
func (this *ShareService) DeleteShareNoteAll(noteId string, userId string) bool
删除笔记时要删除该noteId的所有...
func (*ShareService) DeleteShareNoteGroup ¶
func (this *ShareService) DeleteShareNoteGroup(userId, noteId, groupId string) bool
删除
func (*ShareService) DeleteShareNoteGroupWhenDeleteGroupUser ¶
func (this *ShareService) DeleteShareNoteGroupWhenDeleteGroupUser(userId, groupId string) bool
func (*ShareService) DeleteShareNotebook ¶
func (this *ShareService) DeleteShareNotebook(notebookId string, userId, toUserId string) bool
删除share notebook
func (*ShareService) DeleteShareNotebookGroup ¶
func (this *ShareService) DeleteShareNotebookGroup(userId, notebookId, groupId string) bool
删除
func (*ShareService) DeleteShareNotebookGroupWhenDeleteGroupUser ¶
func (this *ShareService) DeleteShareNotebookGroupWhenDeleteGroupUser(userId, groupId string) bool
func (*ShareService) DeleteUserShareNoteAndNotebook ¶
func (this *ShareService) DeleteUserShareNoteAndNotebook(userId, toUserId string) bool
删除userId分享给toUserId的所有
func (*ShareService) GetNoteShareGroups ¶
func (this *ShareService) GetNoteShareGroups(noteId, userId string) []info.ShareNote
得到笔记分享给的groups
func (*ShareService) GetNotebookShareGroups ¶
func (this *ShareService) GetNotebookShareGroups(notebookId, userId string) []info.ShareNotebook
得到笔记本分享给的groups
func (*ShareService) GetShareNoteContent ¶
func (this *ShareService) GetShareNoteContent(noteId, myUserId, sharedUserId string) (noteContent info.Note)
得到共享的笔记内容 并返回笔记的权限!!!
func (*ShareService) GetShareNotebooks ¶
func (this *ShareService) GetShareNotebooks(userId string) (info.ShareNotebooksByUser, []info.User)
得到共享给我的笔记本和用户(谁共享给了我)
func (*ShareService) HasReadNotePerm ¶
func (this *ShareService) HasReadNotePerm(noteId, userId string) bool
用户userId是否有查看noteId的权限
func (*ShareService) HasReadPerm ¶
func (this *ShareService) HasReadPerm(userId, updatedUserId, noteId string) bool
updatedUserId是否有查看userId noteId的权限? userId是所有者
func (*ShareService) HasSharedNote ¶
func (this *ShareService) HasSharedNote(noteId, myUserId string) bool
userId是否被共享了noteId
func (*ShareService) HasSharedNotebook ¶
func (this *ShareService) HasSharedNotebook(noteId, myUserId, sharedUserId string) bool
noteId的notebook是否共享了给我
func (*ShareService) HasUpdateNotePerm ¶
func (this *ShareService) HasUpdateNotePerm(noteId, userId string) bool
用户userId是否有修改noteId的权限
func (*ShareService) HasUpdateNotebookPerm ¶
func (this *ShareService) HasUpdateNotebookPerm(userId, updatedUserId, notebookId string) bool
updatedUserId是否有修改userId notebookId的权限?
func (*ShareService) HasUpdatePerm ¶
func (this *ShareService) HasUpdatePerm(userId, updatedUserId, noteId string) bool
updatedUserId是否有修改userId noteId的权限?
func (*ShareService) ListNoteShareUserInfo ¶
func (this *ShareService) ListNoteShareUserInfo(noteId, userId string) []info.ShareUserInfo
查看note的分享信息 分享给了哪些用户和权限 ShareNotes表 userId = me, noteId = ... 还要查看该note的notebookId分享的信息
func (*ShareService) ListNotebookShareUserInfo ¶
func (this *ShareService) ListNotebookShareUserInfo(notebookId, userId string) []info.ShareUserInfo
得到notebook的share信息 TODO 这里必须要分页, 最多取100个用户; 限制
func (*ShareService) ListShareNotes ¶
func (this *ShareService) ListShareNotes(myUserId, sharedUserId string, pageNumber, pageSize int, sortField string, isAsc bool) []info.ShareNoteWithPerm
得到默认的单个的notes 共享集 如果真要支持排序, 这里得到所有共享的notes, 到noteService方再sort和limit 可以这样! 到时将零散的共享noteId放在用户基本数据中 这里不好排序
func (*ShareService) ListShareNotesByNotebookId ¶
func (this *ShareService) ListShareNotesByNotebookId(notebookId, myUserId, sharedUserId string, page, pageSize int, sortField string, isAsc bool) []info.ShareNoteWithPerm
得到共享笔记本下的notes
func (*ShareService) UpdateShareNotePerm ¶
func (this *ShareService) UpdateShareNotePerm(noteId string, perm int, userId, toUserId string) bool
---------------- 改变note share权限
func (*ShareService) UpdateShareNotebookPerm ¶
func (this *ShareService) UpdateShareNotebookPerm(notebookId string, perm int, userId, toUserId string) bool
type SuggestionService ¶
type SuggestionService struct { }
var SuggestionS *SuggestionService
func (*SuggestionService) AddSuggestion ¶
func (this *SuggestionService) AddSuggestion(suggestion info.Suggestion) bool
得到某博客具体信息
type TagService ¶
type TagService struct { }
每添加,更新note时, 都将tag添加到tags表中
var TagS *TagService
func (*TagService) AddOrUpdateTag ¶
func (this *TagService) AddOrUpdateTag(userId string, tag string) info.NoteTag
添加或更新标签, 先查下是否存在, 不存在则添加, 存在则更新 都要统计下tag的note数 什么时候调用? 笔记添加Tag, 删除Tag时 删除note时, 都可以调用 万能
func (*TagService) AddTagsI ¶
func (this *TagService) AddTagsI(userId string, tags interface{}) bool
func (*TagService) DeleteTag ¶
func (this *TagService) DeleteTag(userId string, tag string) map[string]int
删除标签 也删除所有的笔记含该标签的 返回noteId => usn
func (*TagService) DeleteTagApi ¶
func (this *TagService) DeleteTagApi(userId string, tag string, usn int) (ok bool, msg string, toUsn int)
删除标签, 供API调用
func (*TagService) GeSyncTags ¶
func (this *TagService) GeSyncTags(userId string, afterUsn, maxEntry int) []info.NoteTag
同步用
type ThemeService ¶
type ThemeService struct { }
主题
var ThemeS *ThemeService
func (*ThemeService) ActiveTheme ¶
func (this *ThemeService) ActiveTheme(userId, themeId string) (ok bool)
使用主题
func (*ThemeService) CopyDefaultTheme ¶
func (this *ThemeService) CopyDefaultTheme(userBlog info.UserBlog) (ok bool, themeId string)
新建主题 复制默认主题到文件夹下
func (*ThemeService) DeleteTheme ¶
func (this *ThemeService) DeleteTheme(userId, themeId string) (ok bool)
删除主题
func (*ThemeService) DeleteTpl ¶
func (this *ThemeService) DeleteTpl(userId, themeId, filename string) (ok bool)
func (*ThemeService) ExportTheme ¶
func (this *ThemeService) ExportTheme(userId, themeId string) (ok bool, path string)
导出主题
func (*ThemeService) GetDefaultThemePath ¶
func (this *ThemeService) GetDefaultThemePath(style string) string
blogService用
func (*ThemeService) GetDefaultThemes ¶
func (this *ThemeService) GetDefaultThemes() (themes []info.Theme)
得到默认主题供选择
func (*ThemeService) GetTheme ¶
func (this *ThemeService) GetTheme(userId, themeId string) info.Theme
func (*ThemeService) GetThemeAbsolutePath ¶
func (this *ThemeService) GetThemeAbsolutePath(userId, themeId string) string
得到主题的绝对路径
func (*ThemeService) GetThemeById ¶
func (this *ThemeService) GetThemeById(themeId string) info.Theme
func (*ThemeService) GetThemeInfo ¶
func (this *ThemeService) GetThemeInfo(themeId, style string) map[string]interface{}
得到主题信息, 为了给博客用
func (*ThemeService) GetThemePath ¶
func (this *ThemeService) GetThemePath(userId, themeId string) string
func (*ThemeService) GetTplContent ¶
func (this *ThemeService) GetTplContent(userId, themeId, filename string) string
得到模板内容
func (*ThemeService) GetUserThemes ¶
得到用户的主题 若用户没有主题, 则至少有一个默认主题 第一个返回值是当前active
func (*ThemeService) ImportTheme ¶
func (this *ThemeService) ImportTheme(userId, path string) (ok bool, msg string)
导入主题 path == /llllllll/..../public/upload/.../aa.zip, 绝对路径
func (*ThemeService) InstallTheme ¶
func (this *ThemeService) InstallTheme(userId, themeId string) (ok bool)
安装主题 得到该主题路径
func (*ThemeService) NewTheme ¶
func (this *ThemeService) NewTheme(userId string) (ok bool, themeId string)
新建主题, 判断是否有主题了
func (*ThemeService) NewThemeForFirst ¶
func (this *ThemeService) NewThemeForFirst(userBlog info.UserBlog) (ok bool, themeId string)
第一次新建主题 设为active true
func (*ThemeService) PublicTheme ¶
func (this *ThemeService) PublicTheme(userId, themeId string) (ok bool)
公开主题, 只有管理员才有权限, 之前没公开的变成公开
func (*ThemeService) UpdateTplContent ¶
func (this *ThemeService) UpdateTplContent(userId, themeId, filename, content string) (ok bool, msg string)
更新模板内容
func (*ThemeService) UpgradeThemeBeta2 ¶
func (this *ThemeService) UpgradeThemeBeta2() (ok bool)
func (*ThemeService) ValidateTheme ¶
func (this *ThemeService) ValidateTheme(path string, filename, newContent string) (ok bool, msg string)
验证主题是否全法, 存在循环引用? filename, newContent 表示在修改模板时要判断模板修改时是否有错误
type TokenService ¶
type TokenService struct { }
var TokenS *TokenService
func (*TokenService) DeleteToken ¶
func (this *TokenService) DeleteToken(userId string, tokenType int) bool
删除token
func (*TokenService) GetOverHours ¶
func (this *TokenService) GetOverHours(tokenType int) float64
func (*TokenService) NewToken ¶
func (this *TokenService) NewToken(userId string, email string, tokenType int) string
生成token
func (*TokenService) VerifyToken ¶
func (this *TokenService) VerifyToken(token string, tokenType int) (ok bool, msg string, tokenInfo info.Token)
验证token, 是否存在, 过时?
type TrashService ¶
type TrashService struct { }
var TrashS *TrashService
func (*TrashService) DeleteNote ¶
func (this *TrashService) DeleteNote(noteId, userId string) bool
删除note 应该放在回收站里 有trashService
func (*TrashService) DeleteSharedNote ¶
func (this *TrashService) DeleteSharedNote(noteId, userId, myUserId string) bool
删除别人共享给我的笔记 先判断我是否有权限, 笔记是否是我创建的
func (*TrashService) DeleteTrash ¶
func (this *TrashService) DeleteTrash(noteId, userId string) bool
删除trash
func (*TrashService) DeleteTrashApi ¶
type UpgradeService ¶
type UpgradeService struct { }
var UpgradeS *UpgradeService
func (*UpgradeService) Api ¶
func (this *UpgradeService) Api(userId string) (ok bool, msg string)
升级为Api, beta.4
func (*UpgradeService) UpgradeBetaToBeta2 ¶
func (this *UpgradeService) UpgradeBetaToBeta2(userId string) (ok bool, msg string)
11-5自定义博客升级, 将aboutMe移至pages
<li>Migrate "About me" to single(a single post)</li> <li>Add some default themes to administrator</li> <li>Generate "UrlTitle" for all notes. "UrlTitle" is a friendly url for post</li> <li>Generate "UrlTitle" for all notebooks</li> <li>Generate "UrlTitle" for all singles</li>
func (*UpgradeService) UpgradeBlog ¶
func (this *UpgradeService) UpgradeBlog() bool
添加了PublicTime, RecommendTime
type UserService ¶
type UserService struct { }
var UserS *UserService
func (*UserService) ActiveEmail ¶
func (this *UserService) ActiveEmail(token string) (ok bool, msg, email string)
注册后验证邮箱
func (*UserService) GetAllUserByFilter ¶
func (this *UserService) GetAllUserByFilter(userFilterEmail, userFilterWhiteList, userFilterBlackList string, verified bool) []info.User
func (*UserService) GetUserAndBlog ¶
func (this *UserService) GetUserAndBlog(userId string) info.UserAndBlog
得到userAndBlog公开信息
func (*UserService) GetUserId ¶
func (this *UserService) GetUserId(email string) string
通过email得到userId
func (*UserService) GetUserInfo ¶
func (this *UserService) GetUserInfo(userId string) info.User
得到用户信息 userId
func (*UserService) GetUserInfoByAny ¶
func (this *UserService) GetUserInfoByAny(idEmailUsername string) info.User
得到用户信息, userId, username, email
func (*UserService) GetUserInfoByEmail ¶
func (this *UserService) GetUserInfoByEmail(email string) info.User
得到用户信息 email
func (*UserService) GetUserInfoByName ¶
func (this *UserService) GetUserInfoByName(emailOrUsername string) info.User
使用email(username), 得到用户信息
func (*UserService) GetUserInfoByThirdUserId ¶
func (this *UserService) GetUserInfoByThirdUserId(thirdUserId string) info.User
func (*UserService) GetUserInfoByUsername ¶
func (this *UserService) GetUserInfoByUsername(username string) info.User
得到用户信息 username
func (*UserService) GetUserInfosOrderBySeq ¶
func (this *UserService) GetUserInfosOrderBySeq(userIds []bson.ObjectId) []info.User
通过ids得到users, 按id的顺序组织users
func (*UserService) GetUsn ¶
func (this *UserService) GetUsn(userId string) int
func (*UserService) IncrUsn ¶
func (this *UserService) IncrUsn(userId string) int
自增Usn 每次notebook,note添加, 修改, 删除, 都要修改
func (*UserService) IsExistsUser ¶
func (this *UserService) IsExistsUser(email string) bool
是否存在该用户 email
func (*UserService) IsExistsUserByUsername ¶
func (this *UserService) IsExistsUserByUsername(username string) bool
是否存在该用户 username
func (*UserService) ListUserInfosByEmails ¶
func (this *UserService) ListUserInfosByEmails(emails []string) []info.User
func (*UserService) ListUserInfosByUserIds ¶
func (this *UserService) ListUserInfosByUserIds(userIds []bson.ObjectId) []info.User
func (*UserService) ListUsers ¶
func (this *UserService) ListUsers(pageNumber, pageSize int, sortField string, isAsc bool, email string) (page info.Page, users []info.User)
------------- user admin
func (*UserService) MapUserAndBlogByUserIds ¶
func (this *UserService) MapUserAndBlogByUserIds(userIds []bson.ObjectId) map[string]info.UserAndBlog
返回info.UserAndBlog
func (*UserService) MapUserInfoAndBlogInfosByUserIds ¶
func (this *UserService) MapUserInfoAndBlogInfosByUserIds(userIds []bson.ObjectId) map[bson.ObjectId]info.User
用户信息和博客设置信息
func (*UserService) MapUserInfoByUserIds ¶
用户信息即可
func (*UserService) ResetPwd ¶
func (this *UserService) ResetPwd(adminUserId, userId, pwd string) (ok bool, msg string)
管理员重置密码
func (*UserService) ThirdAddUser ¶
func (this *UserService) ThirdAddUser(userId, email, pwd string) (ok bool, msg string)
--------- 第三方添加账号
func (*UserService) UpdateAccount ¶
func (this *UserService) UpdateAccount(userId, accountType string, accountStartTime, accountEndTime time.Time, maxImageNum, maxImageSize, maxAttachNum, maxAttachSize, maxPerAttachSize int) bool
帐户类型设置
func (*UserService) UpdateAvatar ¶
func (this *UserService) UpdateAvatar(userId, avatarPath string) bool
修改头像
func (*UserService) UpdateColumnWidth ¶
func (this *UserService) UpdateColumnWidth(userId string, notebookWidth, noteListWidth, mdEditorWidth int) bool
宽度
func (*UserService) UpdateEmail ¶
func (this *UserService) UpdateEmail(token string) (ok bool, msg, email string)
修改邮箱 在此之前, 验证token是否过期 验证email是否有人注册了
func (*UserService) UpdateLeftIsMin ¶
func (this *UserService) UpdateLeftIsMin(userId string, leftIsMin bool) bool
左侧是否隐藏
func (*UserService) UpdatePwd ¶
func (this *UserService) UpdatePwd(userId, oldPwd, pwd string) (bool, string)
---------------------- 已经登录了的用户修改密码
func (*UserService) UpdateTheme ¶
func (this *UserService) UpdateTheme(userId, theme string) bool
修改主题
func (*UserService) UpdateUsername ¶
func (this *UserService) UpdateUsername(userId, username string) (bool, string)
更新username
Source Files ¶
- AlbumService.go
- AttachService.go
- AuthService.go
- BlogService.go
- ConfigService.go
- EmailService.go
- FileService.go
- GroupService.go
- NoteContentHistoryService.go
- NoteImageService.go
- NoteService.go
- NotebookService.go
- PwdService.go
- SessionService.go
- ShareService.go
- SuggestionService.go
- TagService.go
- ThemeService.go
- TokenService.go
- TrashService.go
- UpgradeService.go
- UserService.go
- common.go
- init.go