Documentation ¶
Overview ¶
解析 http://www.reddit.com/r/golang 最新 Go 信息
Index ¶
- Constants
- Variables
- func CanEdit(me *model.Me, curModel interface{}) bool
- func CanPublish(dauAuth, objtype int) bool
- func GenNodes() []map[string][]map[string]interface{}
- func GenSitemap()
- func GetCategoryName(catid int) string
- func GetChildrenNode(parentId, num int) []interface{}
- func GetCurIndexNav(tab string) *model.IndexNav
- func GetLogger(ctx context.Context) *logger.Logger
- func GetNidByEname(ename string) int
- func GetNode(nid int) map[string]interface{}
- func GetNodeByEname(ename string) map[string]interface{}
- func GetNodeName(nid int) string
- func GetNodesByNids(nids []int) map[int]*model.TopicNode
- func LoadAuthorities() error
- func LoadCategories() (err error)
- func LoadDefaultAvatar() error
- func LoadNodes() error
- func LoadRoleAuthorities() error
- func LoadRoles() error
- func LoadUserSetting() error
- func LoadWebsiteSetting() error
- func MaxOnlineNum() int
- func NeedCaptcha(user *model.Me) bool
- func RegisterCommentObject(objtype int, commenter Commenter)
- func RegisterLikeObject(objtype int, liker Liker)
- type AdLogic
- type ArticleComment
- type ArticleLike
- type ArticleLogic
- func (ArticleLogic) Count(ctx context.Context, querystring string, args ...interface{}) int64
- func (self ArticleLogic) FindAll(ctx context.Context, paginator *Paginator, orderBy string, querystring string, ...) []*model.Article
- func (ArticleLogic) FindArticleByPage(ctx context.Context, conds map[string]string, curPage, limit int) ([]*model.Article, int)
- func (ArticleLogic) FindArticleGCTT(ctx context.Context, article *model.Article) *model.ArticleGCTT
- func (self ArticleLogic) FindBy(ctx context.Context, limit int, lastIds ...int) []*model.Article
- func (ArticleLogic) FindById(ctx context.Context, id interface{}) (*model.Article, error)
- func (ArticleLogic) FindByIdAndPreNext(ctx context.Context, id int) (curArticle *model.Article, prevNext []*model.Article, err error)
- func (self ArticleLogic) FindByIds(ids []int) []*model.Article
- func (self ArticleLogic) FindByUser(ctx context.Context, username string, limit int) []*model.Article
- func (ArticleLogic) FindLastList(beginTime string, limit int) ([]*model.Article, error)
- func (self ArticleLogic) FindTaGCTTArticles(ctx context.Context, translator string) []*model.Article
- func (ArticleLogic) Modify(ctx context.Context, user *model.Me, form url.Values) (errMsg string, err error)
- func (self ArticleLogic) MoveToTopic(ctx context.Context, id interface{}, me *model.Me) error
- func (self ArticleLogic) ParseArticle(ctx context.Context, articleUrl string, auto bool) (*model.Article, error)
- func (self ArticleLogic) ParseArticleByAccuracy(articleUrl string, tmpArticle *model.Article, auto bool) (*model.Article, error)
- func (self ArticleLogic) ParseZhihuArticle(ctx context.Context, articleUrl string, rule *model.CrawlRule) (*model.Article, error)
- func (self ArticleLogic) Publish(ctx context.Context, me *model.Me, form url.Values) (int, error)
- func (self ArticleLogic) PublishFromAdmin(ctx context.Context, me *model.Me, form url.Values) error
- func (self ArticleLogic) SearchMyArticles(ctx context.Context, me *model.Me, sid int, kw string) []map[string]interface{}
- func (ArticleLogic) Total() int64
- type AuthorityLogic
- func (AuthorityLogic) Del(aid int) error
- func (AuthorityLogic) FindAuthoritiesByPage(ctx context.Context, conds map[string]string, curPage, limit int) ([]*model.Authority, int)
- func (AuthorityLogic) FindById(ctx context.Context, aid int) *model.Authority
- func (AuthorityLogic) GeneralAuthorities() map[int][]*model.Authority
- func (AuthorityLogic) GetMenus() ([]*model.Authority, map[string][][]string)
- func (self AuthorityLogic) GetUserMenu(ctx context.Context, user *model.Me, uri string) ([]*model.Authority, map[int][]*model.Authority, int)
- func (self AuthorityLogic) HasAuthority(user *model.Me, route string) bool
- func (AuthorityLogic) Save(ctx context.Context, form url.Values, opUser string) (errMsg string, err error)
- type AutoCrawlLogic
- type BookComment
- type BookLike
- type CommentLogic
- func (CommentLogic) Count(ctx context.Context, querystring string, args ...interface{}) int64
- func (self CommentLogic) FindAll(ctx context.Context, paginator *Paginator, orderBy string, querystring string, ...) []*model.Comment
- func (CommentLogic) FindById(cid int) (*model.Comment, error)
- func (self CommentLogic) FindComment(ctx context.Context, cid, objid, objtype int) (*model.Comment, []*model.Comment)
- func (self CommentLogic) FindObjComments(ctx context.Context, objid, objtype int, owner, lastCommentUid int) (comments []map[string]interface{}, ownerUser, lastReplyUser *model.User)
- func (self CommentLogic) FindObjectComments(ctx context.Context, objid, objtype, p int) (commentList []*model.Comment, replyComments []*model.Comment, pageNum int, ...)
- func (self CommentLogic) FindRecent(ctx context.Context, uid, objtype, limit int) []*model.Comment
- func (CommentLogic) Modify(ctx context.Context, cid int, content string) (errMsg string, err error)
- func (self CommentLogic) Publish(ctx context.Context, uid, objid int, form url.Values) (*model.Comment, error)
- func (CommentLogic) Total(objtypes ...int) int64
- type CommentObjecter
- type Commenter
- type ConcreteObservable
- type DownloadLogic
- type DynamicLogic
- type EmailLogic
- func (self EmailLogic) EmailNotice()
- func (EmailLogic) GenUnsubscribeToken(user *model.User) string
- func (self EmailLogic) SendActivateMail(email, uuid string, isHttps ...bool)
- func (e EmailLogic) SendAuthMail(subject, content string, tos []string) error
- func (e EmailLogic) SendMail(subject, content string, tos []string) (err error)
- func (self EmailLogic) SendResetpwdMail(email, uuid string, isHttps ...bool)
- type FavoriteLogic
- func (FavoriteLogic) Cancel(ctx context.Context, uid, objid, objtype int) error
- func (FavoriteLogic) FindUserFavorites(ctx context.Context, uid, objtype, start, rows int) ([]*model.Favorite, int64)
- func (FavoriteLogic) HadFavorite(ctx context.Context, uid, objid, objtype int) int
- func (FavoriteLogic) Save(ctx context.Context, uid, objid, objtype int) error
- type FeedLogic
- func (self FeedLogic) FindRecent(ctx context.Context, num int) []*model.Feed
- func (self FeedLogic) FindRecentWithPaginator(ctx context.Context, paginator *Paginator) []*model.Feed
- func (self FeedLogic) FindTop(ctx context.Context) []*model.Feed
- func (self FeedLogic) GetTotalCount(ctx context.Context) int64
- type FriendLinkLogic
- type GCTTLogic
- func (self GCTTLogic) BindUser(ctx context.Context, gcttUser *model.GCTTUser, uid int, ...) error
- func (self GCTTLogic) FindCoreUsers(ctx context.Context) []*model.GCTTUser
- func (self GCTTLogic) FindIssues(ctx context.Context, paginator *Paginator, querysring string, ...) []*model.GCTTIssue
- func (self GCTTLogic) FindNewestGit(ctx context.Context) []*model.GCTTGit
- func (self GCTTLogic) FindOne(ctx context.Context, username string) *model.GCTTUser
- func (self GCTTLogic) FindTimeLines(ctx context.Context) []*model.GCTTTimeLine
- func (self GCTTLogic) FindTranslator(ctx context.Context, me *model.Me) *model.GCTTUser
- func (self GCTTLogic) FindUnTranslateIssues(ctx context.Context, limit int) []*model.GCTTIssue
- func (self GCTTLogic) FindUsers(ctx context.Context) []*model.GCTTUser
- func (self GCTTLogic) IssueCount(ctx context.Context, querystring string, args ...interface{}) int64
- type GiftLogic
- func (self GiftLogic) Exchange(ctx context.Context, me *model.Me, giftId int) error
- func (self GiftLogic) FindAllOnline(ctx context.Context) []*model.Gift
- func (self GiftLogic) FindExchangeRecords(ctx context.Context, me *model.Me) []*model.UserExchangeRecord
- func (self GiftLogic) UserCanExchange(ctx context.Context, me *model.Me, gifts []*model.Gift)
- type GithubLogic
- func (self GithubLogic) IssueCommentEvent(ctx context.Context, body []byte) error
- func (self GithubLogic) IssueEvent(ctx context.Context, body []byte) error
- func (self GithubLogic) PullPR(repo string, isAll bool) error
- func (self GithubLogic) PullRequestEvent(ctx context.Context, body []byte) error
- func (self GithubLogic) RemindTranslator() error
- func (self GithubLogic) SyncIssues(repo string, isAll bool) error
- type GoBookLogic
- func (GoBookLogic) Count(ctx context.Context) int64
- func (GoBookLogic) FindAll(ctx context.Context, paginator *Paginator, orderBy string) []*model.Book
- func (GoBookLogic) FindBy(ctx context.Context, limit int, lastIds ...int) []*model.Book
- func (GoBookLogic) FindById(ctx context.Context, id interface{}) (*model.Book, error)
- func (GoBookLogic) FindByIds(ids []int) []*model.Book
- func (self GoBookLogic) Publish(ctx context.Context, user *model.Me, form url.Values) (err error)
- func (GoBookLogic) Total() int64
- type IndexLogic
- type InstallLogic
- type LearningMaterialLogic
- type LikeLogic
- type Liker
- type LoginUser
- type LoginUserSlice
- type Message
- type MessageLogic
- func (MessageLogic) DeleteMessage(ctx context.Context, id, msgtype string) bool
- func (MessageLogic) FindFromMsgsByUid(ctx context.Context, uid int, paginator *Paginator) []map[string]interface{}
- func (MessageLogic) FindMsgById(ctx context.Context, id string) *model.Message
- func (MessageLogic) FindNotReadMsgNum(ctx context.Context, uid int) int
- func (self MessageLogic) FindSysMsgsByUid(ctx context.Context, uid int, paginator *Paginator) []map[string]interface{}
- func (self MessageLogic) FindToMsgsByUid(ctx context.Context, uid int, paginator *Paginator) []map[string]interface{}
- func (MessageLogic) FromMsgCount(ctx context.Context, uid int) int64
- func (MessageLogic) MarkHasRead(ctx context.Context, ids []int, isSysMsg bool, uid int) bool
- func (MessageLogic) SendMessageTo(ctx context.Context, from, to int, content string) bool
- func (MessageLogic) SendSysMsgAtUids(ctx context.Context, uids string, ext map[string]interface{}, author int) bool
- func (MessageLogic) SendSysMsgAtUsernames(ctx context.Context, usernames string, ext map[string]interface{}, author int) bool
- func (MessageLogic) SendSystemMsgTo(ctx context.Context, to, msgtype int, ext map[string]interface{}) bool
- func (MessageLogic) SysMsgCount(ctx context.Context, uid int) int64
- func (MessageLogic) ToMsgCount(ctx context.Context, uid int) int64
- type MigratorLogic
- type MissionLogic
- func (MissionLogic) Complete(ctx context.Context, me *model.Me, id string) error
- func (MissionLogic) FindLoginMission(ctx context.Context, me *model.Me) *model.UserLoginMission
- func (self MissionLogic) HasLoginMission(ctx context.Context, me *model.Me) bool
- func (self MissionLogic) RedeemLoginAward(ctx context.Context, me *model.Me) error
- type Observable
- type Observer
- type Paginator
- func (this *Paginator) GetPageHtml(uri string, total ...int) string
- func (this *Paginator) GetTotal() int
- func (this *Paginator) HasMorePage() bool
- func (this *Paginator) Offset() (offset int)
- func (this *Paginator) PerPage() int
- func (this *Paginator) SetPerPage(perPage int)
- func (this *Paginator) SetTotal(total int64) *Paginator
- type ProjectComment
- type ProjectLike
- type ProjectLogic
- func (ProjectLogic) Count(ctx context.Context, querystring string, args ...interface{}) int64
- func (self ProjectLogic) FindAll(ctx context.Context, paginator *Paginator, orderBy string, querystring string, ...) []*model.OpenProject
- func (ProjectLogic) FindBy(ctx context.Context, limit int, lastIds ...int) []*model.OpenProject
- func (ProjectLogic) FindByIds(ids []int) []*model.OpenProject
- func (ProjectLogic) FindOne(ctx context.Context, val interface{}) *model.OpenProject
- func (ProjectLogic) FindRecent(ctx context.Context, username string) []*model.OpenProject
- func (ProjectLogic) ParseOneProject(projectUrl string) error
- func (self ProjectLogic) ParseProjectList(pUrl string) error
- func (self ProjectLogic) Publish(ctx context.Context, user *model.Me, form url.Values) (err error)
- func (ProjectLogic) Total() int64
- func (ProjectLogic) UriExists(ctx context.Context, uri string) bool
- type RankLogic
- func (self RankLogic) FindDAURank(ctx context.Context, num int, ymds ...string) []*model.User
- func (self RankLogic) FindDayRank(ctx context.Context, objtype int, ymd string, num int, needExt ...bool) (result interface{})
- func (self RankLogic) FindMonthRank(ctx context.Context, objtype, num int, needExt ...bool) (result interface{})
- func (self RankLogic) FindRichRank(ctx context.Context) []*model.User
- func (self RankLogic) FindWeekRank(ctx context.Context, objtype, num int, needExt ...bool) (result interface{})
- func (self RankLogic) GenDAURank(uid, weight int)
- func (self RankLogic) GenDayRank(objtype, objid, num int)
- func (self RankLogic) GenMonthRank(objtype int)
- func (self RankLogic) GenWeekRank(objtype int)
- func (self RankLogic) TotalDAUUser(ctx context.Context) int
- func (self RankLogic) UserDAURank(ctx context.Context, uid int) int
- type ReadingLogic
- func (ReadingLogic) FindBy(ctx context.Context, limit, rtype int, lastIds ...int) []*model.MorningReading
- func (ReadingLogic) FindById(ctx context.Context, id int) *model.MorningReading
- func (ReadingLogic) FindLastList(beginTime string) ([]*model.MorningReading, error)
- func (ReadingLogic) FindReadingByPage(ctx context.Context, conds map[string]string, curPage, limit int) ([]*model.MorningReading, int)
- func (ReadingLogic) IReading(ctx context.Context, id int) string
- func (ReadingLogic) SaveReading(ctx context.Context, form url.Values, username string) (errMsg string, err error)
- type RedditLogic
- type ResourceComment
- type ResourceLike
- type ResourceLogic
- func (ResourceLogic) Count(ctx context.Context, querystring string, args ...interface{}) int64
- func (self ResourceLogic) FindAll(ctx context.Context, paginator *Paginator, orderBy, querystring string, ...) (resources []map[string]interface{}, total int64)
- func (ResourceLogic) FindBy(ctx context.Context, limit int, lastIds ...int) []*model.Resource
- func (ResourceLogic) FindByCatid(ctx context.Context, paginator *Paginator, catid int) (resources []map[string]interface{}, total int64)
- func (ResourceLogic) FindById(ctx context.Context, id int) (resourceMap map[string]interface{}, comments []map[string]interface{})
- func (ResourceLogic) FindByIds(ids []int) []*model.Resource
- func (ResourceLogic) FindRecent(ctx context.Context, uid int) []*model.Resource
- func (ResourceLogic) FindResource(ctx context.Context, id int) *model.Resource
- func (ResourceLogic) Publish(ctx context.Context, me *model.Me, form url.Values) (err error)
- func (ResourceLogic) Total() int64
- type RiskLogic
- type RuleLogic
- func (RuleLogic) Delete(ctx context.Context, id string) error
- func (RuleLogic) FindBy(ctx context.Context, conds map[string]string, curPage, limit int) ([]*model.CrawlRule, int)
- func (RuleLogic) FindById(ctx context.Context, id string) *model.CrawlRule
- func (RuleLogic) Save(ctx context.Context, form url.Values, opUser string) (errMsg string, err error)
- type SearcherLogic
- func (this *SearcherLogic) DoSearch(q, field string, start, rows int) (*model.ResponseBody, error)
- func (this *SearcherLogic) FillNodeAndUser(ctx context.Context, respBody *model.ResponseBody) (map[int]*model.User, map[int]*model.TopicNode)
- func (this *SearcherLogic) FindAtomFeeds(rows int) (*model.ResponseBody, error)
- func (self SearcherLogic) Indexing(isAll bool)
- func (self SearcherLogic) IndexingArticle(isAll bool)
- func (self SearcherLogic) IndexingOpenProject(isAll bool)
- func (self SearcherLogic) IndexingResource(isAll bool)
- func (self SearcherLogic) IndexingTopic(isAll bool)
- func (this *SearcherLogic) SearchByField(field, value string, start, rows int, sorts ...string) (*model.ResponseBody, error)
- type SettingLogic
- type SolrClient
- type SubjectLogic
- func (self SubjectLogic) Contribute(ctx context.Context, me *model.Me, sid, articleId int) error
- func (self SubjectLogic) ExistByName(name string) bool
- func (self SubjectLogic) FindArticleSubjects(ctx context.Context, articleId int) []*model.Subject
- func (self SubjectLogic) FindArticleTotal(ctx context.Context, sid int) int64
- func (self SubjectLogic) FindArticles(ctx context.Context, sid int, paginator *Paginator, orderBy string) []*model.Article
- func (self SubjectLogic) FindBy(ctx context.Context, paginator *Paginator) []*model.Subject
- func (self SubjectLogic) FindFollowerTotal(ctx context.Context, sid int) int64
- func (self SubjectLogic) FindFollowers(ctx context.Context, sid int) []*model.SubjectFollower
- func (self SubjectLogic) FindMine(ctx context.Context, me *model.Me, articleId int, kw string) []map[string]interface{}
- func (self SubjectLogic) FindOne(ctx context.Context, sid int) *model.Subject
- func (self SubjectLogic) Follow(ctx context.Context, sid int, me *model.Me) (err error)
- func (self SubjectLogic) HadFollow(ctx context.Context, sid int, me *model.Me) bool
- func (SubjectLogic) Modify(ctx context.Context, user *model.Me, form url.Values) (errMsg string, err error)
- func (self SubjectLogic) Publish(ctx context.Context, me *model.Me, form url.Values) (sid int, err error)
- func (self SubjectLogic) RemoveContribute(ctx context.Context, sid, articleId int) error
- type ThirdUserLogic
- func (self ThirdUserLogic) BindGithub(ctx context.Context, code string, me *model.Me) error
- func (ThirdUserLogic) GithubAuthCodeUrl(ctx context.Context, redirectURL string) string
- func (self ThirdUserLogic) LoginFromGithub(ctx context.Context, code string) (*model.User, error)
- func (ThirdUserLogic) UnBindUser(ctx context.Context, bindId interface{}, me *model.Me) error
- type TodayActiveObserver
- type TopicComment
- type TopicLike
- type TopicLogic
- func (self TopicLogic) Append(ctx context.Context, uid, tid int, content string) error
- func (self TopicLogic) AutoUnsetTop() error
- func (TopicLogic) Count(ctx context.Context, querystring string, args ...interface{}) int64
- func (self TopicLogic) FindAll(ctx context.Context, paginator *Paginator, orderBy string, querystring string, ...) []map[string]interface{}
- func (TopicLogic) FindAppend(ctx context.Context, tid int) []*model.TopicAppend
- func (TopicLogic) FindByNid(ctx context.Context, nid, curTid string) []*model.Topic
- func (TopicLogic) FindByPage(ctx context.Context, conds map[string]string, curPage, limit int) ([]*model.Topic, int)
- func (self TopicLogic) FindByTid(ctx context.Context, tid int) (topicMap map[string]interface{}, replies []map[string]interface{}, err error)
- func (TopicLogic) FindByTids(tids []int) []*model.Topic
- func (self TopicLogic) FindFullinfoByTids(tids []int) []map[string]interface{}
- func (TopicLogic) FindHotNodes(ctx context.Context) []map[string]interface{}
- func (TopicLogic) FindLastList(beginTime string, limit int) ([]*model.Topic, error)
- func (self TopicLogic) FindRecent(limit int, uids ...int) []*model.Topic
- func (TopicLogic) JSEscape(topics []*model.Topic) []*model.Topic
- func (TopicLogic) Modify(ctx context.Context, user *model.Me, form url.Values) (errMsg string, err error)
- func (self TopicLogic) Publish(ctx context.Context, me *model.Me, form url.Values) (tid int, err error)
- func (self TopicLogic) SetTop(ctx context.Context, me *model.Me, tid int) error
- func (TopicLogic) Total() int64
- func (self TopicLogic) UnsetTop(ctx context.Context, tid int) error
- type TopicNodeLogic
- func (self TopicNodeLogic) FindAll(ctx context.Context) []*model.TopicNode
- func (self TopicNodeLogic) FindByEname(ename string) *model.TopicNode
- func (self TopicNodeLogic) FindByNids(nids []int) map[int]*model.TopicNode
- func (self TopicNodeLogic) FindByParent(pid, num int) []*model.TopicNode
- func (self TopicNodeLogic) FindOne(nid int) *model.TopicNode
- func (self TopicNodeLogic) FindParallelTree(ctx context.Context) []*model.TopicNode
- func (self TopicNodeLogic) Modify(ctx context.Context, form url.Values) error
- func (self TopicNodeLogic) ModifySeq(ctx context.Context, nid, seq int) error
- type UploaderLogic
- type UserData
- type UserLogic
- func (self UserLogic) Activate(ctx context.Context, email, uuid string, timestamp int64, sign string) (*model.User, error)
- func (self UserLogic) AdminUpdateUser(ctx context.Context, uid string, form url.Values)
- func (UserLogic) ChangeAvatar(ctx context.Context, uid int, avatar string) (err error)
- func (self UserLogic) CreateUser(ctx context.Context, form url.Values) (errMsg string, err error)
- func (UserLogic) DecrUserWeight(field string, value interface{}, divide int)
- func (UserLogic) EmailOrUsernameExists(ctx context.Context, email, username string) bool
- func (UserLogic) EmailSubscribe(ctx context.Context, uid, unsubscribe int)
- func (UserLogic) FindActiveUsers(ctx context.Context, limit int, offset ...int) []*model.UserActive
- func (UserLogic) FindBindUsers(ctx context.Context, uid int) []*model.BindUser
- func (self UserLogic) FindCurrentUser(ctx context.Context, username interface{}) *model.Me
- func (UserLogic) FindDAUUsers(ctx context.Context, uids []int) map[int]*model.User
- func (UserLogic) FindNewUsers(ctx context.Context, limit int, offset ...int) []*model.User
- func (UserLogic) FindNotLoginUsers(loginTime time.Time) (userList []*model.UserLogin, err error)
- func (self UserLogic) FindOne(ctx context.Context, field string, val interface{}) *model.User
- func (UserLogic) FindUserByPage(ctx context.Context, conds map[string]string, curPage, limit int) ([]*model.User, int)
- func (self UserLogic) FindUserInfos(ctx context.Context, uniq interface{}) map[int]*model.User
- func (UserLogic) GetUserMentions(term string, limit int, isHttps bool) []map[string]string
- func (UserLogic) HasPasswd(ctx context.Context, uid int) bool
- func (UserLogic) IncrUserWeight(field string, value interface{}, weight int)
- func (self UserLogic) Login(ctx context.Context, username, passwd string) (*model.UserLogin, error)
- func (UserLogic) RecordLogin(username string, ipinter interface{}) error
- func (self UserLogic) ResetPasswd(ctx context.Context, email, passwd string) (string, error)
- func (UserLogic) Total() int64
- func (self UserLogic) Update(ctx context.Context, me *model.Me, form url.Values) (errMsg string, err error)
- func (self UserLogic) UpdatePasswd(ctx context.Context, username, curPasswd, newPasswd string) (string, error)
- func (UserLogic) UpdateUserStatus(ctx context.Context, uid, status int) error
- func (UserLogic) UserExists(ctx context.Context, field, val string) bool
- type UserRichLogic
- func (self UserRichLogic) AwardCooper()
- func (UserRichLogic) FindBalanceDetail(ctx context.Context, me *model.Me, types ...int) []*model.UserBalanceDetail
- func (self UserRichLogic) FindRecharge(ctx context.Context, me *model.Me) int
- func (self UserRichLogic) IncrUserRich(user *model.User, typ, award int, desc string)
- func (self UserRichLogic) Recharge(ctx context.Context, uid string, form url.Values)
- func (UserRichLogic) Total(ctx context.Context, uid int) int64
- type UserRichObserver
- type UserWeightObserver
- type ViewRecordLogic
- type ViewSourceLogic
- type WechatLogic
- func (self WechatLogic) AutoReply(ctx context.Context, reqData []byte) (*model.WechatReply, error)
- func (self WechatLogic) Bind(ctx context.Context, id, uid int, userInfo string) (*model.WechatUser, error)
- func (self WechatLogic) CheckSession(ctx context.Context, code string) (*model.WechatUser, error)
- type WikiLogic
- func (WikiLogic) Create(ctx context.Context, me *model.Me, form url.Values) error
- func (WikiLogic) FindBy(ctx context.Context, limit int, lastIds ...int) []*model.Wiki
- func (WikiLogic) FindById(ctx context.Context, id int) *model.Wiki
- func (WikiLogic) FindByIds(ids []int) []*model.Wiki
- func (WikiLogic) FindOne(ctx context.Context, uri string) *model.Wiki
- func (self WikiLogic) Modify(ctx context.Context, me *model.Me, form url.Values) error
Constants ¶
const ( WsMsgNotify = iota // 通知消息 WsMsgOnline // 发送在线用户数(和需要时也发历史最高) )
const CommentPerNum = 50
const GithubAPIBaseUrl = "https://api.github.com"
const (
MaxImageSize = 5 << 20 // 5M
)
const MessageQueueLen = 3
const OsChinaDomain = "http://www.oschina.net"
const PerPage = 50
每页显示多少条
const ProjectLogoPrefix = "plogo"
ProjectLogoPrefix 开源项目 logo 前缀
Variables ¶
var ( NotModifyAuthorityErr = errors.New("没有修改权限") NotFoundErr = errors.New("Not Found") )
var ( Authorities []*model.Authority RoleAuthorities map[int][]int Roles []*model.Role // 相应的 roleid-1 为索引 // 节点信息 AllNode []map[string]interface{} // 推荐节点 AllRecommendNodes []map[string][]map[string]interface{} // 资源分类 AllCategory []*model.ResourceCat WebsiteSetting = model.WebsiteSetting DefaultAvatars []string UserSetting map[string]int )
var ( ErrUsername = errors.New("用户名不存在") ErrPasswd = errors.New("密码错误") )
TODO: 多机器部署,广播、在线注册用户信息没有同步
var DefaultAd = AdLogic{}
var DefaultArticle = ArticleLogic{}
var DefaultAuthority = AuthorityLogic{}
var DefaultAutoCrawl = AutoCrawlLogic{}
var DefaultComment = CommentLogic{}
var DefaultDownload = DownloadLogic{}
var DefaultDynamic = DynamicLogic{}
var DefaultEmail = EmailLogic{}
var DefaultFavorite = FavoriteLogic{}
var DefaultFeed = FeedLogic{}
var DefaultFriendLink = FriendLinkLogic{}
var DefaultGCTT = GCTTLogic{}
var DefaultGift = GiftLogic{}
var DefaultGithub = GithubLogic{}
var DefaultGoBook = GoBookLogic{}
var DefaultIndex = IndexLogic{}
var DefaultInstall = InstallLogic{}
var DefaultLearningMaterial = LearningMaterialLogic{}
var DefaultLike = LikeLogic{}
var DefaultMessage = MessageLogic{}
var DefaultMigrator = MigratorLogic{}
var DefaultMission = MissionLogic{}
var DefaultNode = TopicNodeLogic{}
var DefaultProject = ProjectLogic{}
var DefaultRank = RankLogic{}
var DefaultReading = ReadingLogic{}
var DefaultReddit = newRedditLogic()
var DefaultResource = ResourceLogic{}
var DefaultRisk = RiskLogic{}
var DefaultRule = RuleLogic{}
var DefaultSearcher = SearcherLogic{/* contains filtered or unexported fields */}
var DefaultSetting = SettingLogic{}
var DefaultSubject = SubjectLogic{}
var DefaultThirdUser = ThirdUserLogic{}
var DefaultTopic = TopicLogic{}
var DefaultUploader = &UploaderLogic{}
var DefaultUser = UserLogic{}
var DefaultUserRich = UserRichLogic{}
var DefaultViewRecord = ViewRecordLogic{}
var DefaultViewSource = ViewSourceLogic{}
var DefaultWechat = WechatLogic{}
var DefaultWiki = WikiLogic{}
var PresetUids = config.ConfigFile.MustValueArray("crawl", "preset_uids", ",")
var PresetUsernames = config.ConfigFile.MustValueArray("crawl", "preset_users", ",")
var Views = newViews()
Functions ¶
func CanPublish ¶
func GenSitemap ¶
func GenSitemap()
func GetChildrenNode ¶
func GetChildrenNode(parentId, num int) []interface{}
GetChildrenNode 获取某个父节点下最多 num 个子节点
func GetCurIndexNav ¶
func LoadDefaultAvatar ¶
func LoadDefaultAvatar() error
func LoadUserSetting ¶
func LoadUserSetting() error
func LoadWebsiteSetting ¶
func LoadWebsiteSetting() error
func RegisterCommentObject ¶
注册评论对象,使得某种类型(主题、博客等)被评论了可以回调
func RegisterLikeObject ¶
注册喜欢对象,使得某种类型(主题、博文等)被喜欢了可以回调
Types ¶
type ArticleComment ¶
type ArticleComment struct{}
博文评论
func (ArticleComment) SetObjinfo ¶
func (self ArticleComment) SetObjinfo(ids []int, commentMap map[int][]*model.Comment)
SetObjinfo 实现 CommentObjecter 接口
func (ArticleComment) String ¶
func (self ArticleComment) String() string
func (ArticleComment) UpdateComment ¶
func (self ArticleComment) UpdateComment(cid, objid, uid int, cmttime time.Time)
UpdateComment 更新该文章的评论信息 cid:评论id;objid:被评论对象id;uid:评论者;cmttime:评论时间
type ArticleLike ¶
type ArticleLike struct{}
博文喜欢
func (ArticleLike) String ¶
func (self ArticleLike) String() string
func (ArticleLike) UpdateLike ¶
func (self ArticleLike) UpdateLike(objid, num int)
更新该文章的喜欢数 objid:被喜欢对象id;num: 喜欢数(负数表示取消喜欢)
type ArticleLogic ¶
type ArticleLogic struct{}
func (ArticleLogic) Count ¶
func (ArticleLogic) Count(ctx context.Context, querystring string, args ...interface{}) int64
func (ArticleLogic) FindAll ¶
func (self ArticleLogic) FindAll(ctx context.Context, paginator *Paginator, orderBy string, querystring string, args ...interface{}) []*model.Article
FindAll 支持多页翻看
func (ArticleLogic) FindArticleByPage ¶
func (ArticleLogic) FindArticleByPage(ctx context.Context, conds map[string]string, curPage, limit int) ([]*model.Article, int)
获取抓取的文章列表(分页):后台用
func (ArticleLogic) FindArticleGCTT ¶
func (ArticleLogic) FindArticleGCTT(ctx context.Context, article *model.Article) *model.ArticleGCTT
func (ArticleLogic) FindByIdAndPreNext ¶
func (ArticleLogic) FindByIdAndPreNext(ctx context.Context, id int) (curArticle *model.Article, prevNext []*model.Article, err error)
FindByIdAndPreNext 获取当前(id)博文以及前后博文
func (ArticleLogic) FindByIds ¶
func (self ArticleLogic) FindByIds(ids []int) []*model.Article
FindByIds 获取多个文章详细信息
func (ArticleLogic) FindByUser ¶
func (ArticleLogic) FindLastList ¶
func (ArticleLogic) FindTaGCTTArticles ¶
func (ArticleLogic) Modify ¶
func (ArticleLogic) Modify(ctx context.Context, user *model.Me, form url.Values) (errMsg string, err error)
Modify 修改文章信息
func (ArticleLogic) MoveToTopic ¶
MoveToTopic 将该文章移到主题中 有些用户总是将问题放在文章中发布
func (ArticleLogic) ParseArticle ¶
func (self ArticleLogic) ParseArticle(ctx context.Context, articleUrl string, auto bool) (*model.Article, error)
ParseArticle 获取 url 对应的文章并根据规则进行解析
func (ArticleLogic) ParseArticleByAccuracy ¶
func (ArticleLogic) ParseZhihuArticle ¶
func (ArticleLogic) PublishFromAdmin ¶
func (ArticleLogic) SearchMyArticles ¶
type AuthorityLogic ¶
type AuthorityLogic struct{}
func (AuthorityLogic) Del ¶
func (AuthorityLogic) Del(aid int) error
func (AuthorityLogic) FindAuthoritiesByPage ¶
func (AuthorityLogic) GeneralAuthorities ¶
func (AuthorityLogic) GeneralAuthorities() map[int][]*model.Authority
除了一级、二级菜单之外的权限(路由)
func (AuthorityLogic) GetMenus ¶
func (AuthorityLogic) GetMenus() ([]*model.Authority, map[string][][]string)
获取整个菜单
func (AuthorityLogic) GetUserMenu ¶
func (self AuthorityLogic) GetUserMenu(ctx context.Context, user *model.Me, uri string) ([]*model.Authority, map[int][]*model.Authority, int)
GetUserMenu 获取用户菜单
func (AuthorityLogic) HasAuthority ¶
func (self AuthorityLogic) HasAuthority(user *model.Me, route string) bool
判断用户是否有某个权限
type AutoCrawlLogic ¶
type AutoCrawlLogic struct{}
func (AutoCrawlLogic) CrawlWebsite ¶
func (self AutoCrawlLogic) CrawlWebsite(website string, isAll bool) error
通过网站标识抓取
func (AutoCrawlLogic) DoCrawl ¶
func (self AutoCrawlLogic) DoCrawl(isAll bool) error
type BookComment ¶
type BookComment struct{}
图书评论
func (BookComment) SetObjinfo ¶
func (self BookComment) SetObjinfo(ids []int, commentMap map[int][]*model.Comment)
SetObjinfo 实现 CommentObjecter 接口
func (BookComment) String ¶
func (self BookComment) String() string
func (BookComment) UpdateComment ¶
func (self BookComment) UpdateComment(cid, objid, uid int, cmttime time.Time)
UpdateComment 更新该图书的评论信息 cid:评论id;objid:被评论对象id;uid:评论者;cmttime:评论时间
type BookLike ¶
type BookLike struct{}
图书推荐
func (BookLike) UpdateLike ¶
更新该图书的推荐数 objid:被喜欢对象id;num: 喜欢数(负数表示取消喜欢)
type CommentLogic ¶
type CommentLogic struct{}
func (CommentLogic) Count ¶
func (CommentLogic) Count(ctx context.Context, querystring string, args ...interface{}) int64
Count 获取用户全部评论数
func (CommentLogic) FindAll ¶
func (self CommentLogic) FindAll(ctx context.Context, paginator *Paginator, orderBy string, querystring string, args ...interface{}) []*model.Comment
FindAll 支持多页翻看
func (CommentLogic) FindComment ¶
func (self CommentLogic) FindComment(ctx context.Context, cid, objid, objtype int) (*model.Comment, []*model.Comment)
FindComment 获得评论和额外两个评论
func (CommentLogic) FindObjComments ¶
func (self CommentLogic) FindObjComments(ctx context.Context, objid, objtype int, owner, lastCommentUid int) (comments []map[string]interface{}, ownerUser, lastReplyUser *model.User)
FindObjComments 获得某个对象的所有评论 owner: 被评论对象属主 TODO:分页暂不做
func (CommentLogic) FindObjectComments ¶
func (self CommentLogic) FindObjectComments(ctx context.Context, objid, objtype, p int) (commentList []*model.Comment, replyComments []*model.Comment, pageNum int, err error)
FindObjectComments 获得某个对象的所有评论(新版)
func (CommentLogic) FindRecent ¶
FindRecent 获得最近的评论 如果 uid!=0,表示获取某人的评论; 如果 objtype!=-1,表示获取某类型的评论;
func (CommentLogic) Publish ¶
func (self CommentLogic) Publish(ctx context.Context, uid, objid int, form url.Values) (*model.Comment, error)
Publish 发表评论(或回复)。 objid 注册的评论对象 uid 评论人
func (CommentLogic) Total ¶
func (CommentLogic) Total(objtypes ...int) int64
Total 评论总数(objtypes[0] 取某一类型的评论总数)
type CommentObjecter ¶
type CommentObjecter interface { // ids 是属主的主键 slice (comment 中的 objid) // commentMap 中的 key 是属主 id SetObjinfo(ids []int, commentMap map[int][]*model.Comment) }
填充 Comment 对象的 Objinfo 成员接口 评论属主应该实现该接口(以便填充 Objinfo 成员)
type Commenter ¶
type Commenter interface { fmt.Stringer // 评论回调接口,用于更新对象自身需要更新的数据 UpdateComment(int, int, int, time.Time) }
Commenter 评论接口
type ConcreteObservable ¶
type ConcreteObservable struct {
// contains filtered or unexported fields
}
func NewConcreteObservable ¶
func NewConcreteObservable(action string) *ConcreteObservable
func (*ConcreteObservable) AddObserver ¶
func (this *ConcreteObservable) AddObserver(o Observer)
func (*ConcreteObservable) NotifyObservers ¶
func (this *ConcreteObservable) NotifyObservers(uid, objtype, objid int)
func (*ConcreteObservable) RemoveObserver ¶
func (this *ConcreteObservable) RemoveObserver(o Observer)
type DownloadLogic ¶
type DownloadLogic struct{}
func (DownloadLogic) AddNewDownload ¶
func (DownloadLogic) AddNewDownload(ctx context.Context, version, selector string) error
func (DownloadLogic) RecordDLTimes ¶
func (DownloadLogic) RecordDLTimes(ctx context.Context, filename string) error
type DynamicLogic ¶
type DynamicLogic struct{}
type EmailLogic ¶
type EmailLogic struct{}
func (EmailLogic) GenUnsubscribeToken ¶
func (EmailLogic) GenUnsubscribeToken(user *model.User) string
生成 退订 邮件的 token
func (EmailLogic) SendActivateMail ¶
func (self EmailLogic) SendActivateMail(email, uuid string, isHttps ...bool)
SendActivateMail 发送激活邮件
func (EmailLogic) SendAuthMail ¶
func (e EmailLogic) SendAuthMail(subject, content string, tos []string) error
SendAuthMail 发送验证电子邮件
func (EmailLogic) SendMail ¶
func (e EmailLogic) SendMail(subject, content string, tos []string) (err error)
SendMail 发送普通(通知)电子邮件
func (EmailLogic) SendResetpwdMail ¶
func (self EmailLogic) SendResetpwdMail(email, uuid string, isHttps ...bool)
SendResetpwdMail 发重置密码邮件
type FavoriteLogic ¶
type FavoriteLogic struct{}
func (FavoriteLogic) Cancel ¶
func (FavoriteLogic) Cancel(ctx context.Context, uid, objid, objtype int) error
func (FavoriteLogic) FindUserFavorites ¶
func (FavoriteLogic) HadFavorite ¶
func (FavoriteLogic) HadFavorite(ctx context.Context, uid, objid, objtype int) int
HadFavorite 某个用户是否已经收藏某个对象
type FeedLogic ¶
type FeedLogic struct{}
func (FeedLogic) FindRecent ¶
func (FeedLogic) FindRecentWithPaginator ¶
type FriendLinkLogic ¶
type FriendLinkLogic struct{}
func (FriendLinkLogic) FindAll ¶
func (FriendLinkLogic) FindAll(ctx context.Context, limits ...int) []*model.FriendLink
type GCTTLogic ¶
type GCTTLogic struct{}
func (GCTTLogic) FindCoreUsers ¶
func (GCTTLogic) FindIssues ¶
func (GCTTLogic) FindNewestGit ¶
func (GCTTLogic) FindTimeLines ¶
func (self GCTTLogic) FindTimeLines(ctx context.Context) []*model.GCTTTimeLine
func (GCTTLogic) FindTranslator ¶
func (GCTTLogic) FindUnTranslateIssues ¶
type GiftLogic ¶
type GiftLogic struct{}
func (GiftLogic) FindAllOnline ¶
func (GiftLogic) FindExchangeRecords ¶
type GithubLogic ¶
type GithubLogic struct{}
func (GithubLogic) IssueCommentEvent ¶
func (self GithubLogic) IssueCommentEvent(ctx context.Context, body []byte) error
IssueCommentEvent 处理 issue Comment 的 GitHub 事件
func (GithubLogic) IssueEvent ¶
func (self GithubLogic) IssueEvent(ctx context.Context, body []byte) error
IssueEvent 处理 issue 的 GitHub 事件
func (GithubLogic) PullRequestEvent ¶
func (self GithubLogic) PullRequestEvent(ctx context.Context, body []byte) error
func (GithubLogic) RemindTranslator ¶
func (self GithubLogic) RemindTranslator() error
RemindTranslator 提醒译者注认领任的翻译进度,避免认领了长时间不翻译
func (GithubLogic) SyncIssues ¶
func (self GithubLogic) SyncIssues(repo string, isAll bool) error
type GoBookLogic ¶
type GoBookLogic struct{}
func (GoBookLogic) FindByIds ¶
func (GoBookLogic) FindByIds(ids []int) []*model.Book
FindByIds 获取多个图书详细信息
type IndexLogic ¶
type IndexLogic struct{}
type InstallLogic ¶
type InstallLogic struct{}
func (InstallLogic) CreateTable ¶
func (InstallLogic) CreateTable(ctx context.Context) error
func (InstallLogic) HadRootUser ¶
func (InstallLogic) HadRootUser(ctx context.Context) bool
HadRootUser 是否已经创建了超级用户
func (InstallLogic) InitTable ¶
func (InstallLogic) InitTable(ctx context.Context) error
InitTable 初始化数据表
func (InstallLogic) IsTableExist ¶
func (InstallLogic) IsTableExist(ctx context.Context) bool
type LearningMaterialLogic ¶
type LearningMaterialLogic struct{}
func (LearningMaterialLogic) FindAll ¶
func (LearningMaterialLogic) FindAll(ctx context.Context) []*model.LearningMaterial
type LikeLogic ¶
type LikeLogic struct{}
func (LikeLogic) FindUserLikeObjects ¶
func (LikeLogic) FindUserLikeObjects(ctx context.Context, uid, objtype int, objids ...int) (map[int]int, error)
FindUserLikeObjects 获取用户对一批对象是否喜欢的状态 objids 两个值
type LoginUser ¶
type LoginUser struct { Uid int `json:"uid"` LastAccessTime string `json:"last_access_time"` OnlineDuartion string `json:"online_duration"` }
用于 expvar 统计信息
type LoginUserSlice ¶
type LoginUserSlice []*LoginUser
func (LoginUserSlice) String ¶
func (self LoginUserSlice) String() string
type Message ¶
type Message struct { Type int `json:"type"` Body interface{} `json:"body"` }
func NewMessage ¶
type MessageLogic ¶
type MessageLogic struct{}
func (MessageLogic) DeleteMessage ¶
func (MessageLogic) DeleteMessage(ctx context.Context, id, msgtype string) bool
DeleteMessage 删除消息 msgtype -> system(系统消息)/inbox(outbox)(短消息)
func (MessageLogic) FindFromMsgsByUid ¶
func (MessageLogic) FindFromMsgsByUid(ctx context.Context, uid int, paginator *Paginator) []map[string]interface{}
获取某人发送的消息
func (MessageLogic) FindMsgById ¶
func (MessageLogic) FindNotReadMsgNum ¶
func (MessageLogic) FindNotReadMsgNum(ctx context.Context, uid int) int
FindNotReadMsgNum 获得某个用户未读消息数(系统消息和短消息)
func (MessageLogic) FindSysMsgsByUid ¶
func (self MessageLogic) FindSysMsgsByUid(ctx context.Context, uid int, paginator *Paginator) []map[string]interface{}
FindSysMsgsByUid 获得某人的系统消息 系统消息类型不同,在ext中存放的字段也不一样,如下:
model.MsgtypeTopicReply/MsgtypeResourceComment/MsgtypeWikiComment存放都为: {"uid":xxx,"objid":xxx} model.MsgtypeAtMe 为:{"uid":xxx,"cid":xxx,"objid":xxx,"objtype":xxx} model.MsgtypePulishAtMe 为:{"uid":xxx,"objid":xxx,"objtype":xxx}
func (MessageLogic) FindToMsgsByUid ¶
func (self MessageLogic) FindToMsgsByUid(ctx context.Context, uid int, paginator *Paginator) []map[string]interface{}
获得发给某人的短消息(收件箱)
func (MessageLogic) FromMsgCount ¶
func (MessageLogic) FromMsgCount(ctx context.Context, uid int) int64
func (MessageLogic) MarkHasRead ¶
MarkHasRead 标记消息已读
func (MessageLogic) SendMessageTo ¶
SendMessageTo from给to发短信息
func (MessageLogic) SendSysMsgAtUids ¶
func (MessageLogic) SendSysMsgAtUids(ctx context.Context, uids string, ext map[string]interface{}, author int) bool
SendSysMsgAtUids 给被@的用户发系统消息 authors 是被评论对象的作者
func (MessageLogic) SendSysMsgAtUsernames ¶
func (MessageLogic) SendSysMsgAtUsernames(ctx context.Context, usernames string, ext map[string]interface{}, author int) bool
SendSysMsgAtUsernames 给被@的用户发系统消息 ext 中可以指定 msgtype,没有指定,默认为 MsgtypeAtMe
func (MessageLogic) SendSystemMsgTo ¶
func (MessageLogic) SendSystemMsgTo(ctx context.Context, to, msgtype int, ext map[string]interface{}) bool
SendSystemMsgTo 给某人发系统消息
func (MessageLogic) SysMsgCount ¶
func (MessageLogic) SysMsgCount(ctx context.Context, uid int) int64
func (MessageLogic) ToMsgCount ¶
func (MessageLogic) ToMsgCount(ctx context.Context, uid int) int64
type MigratorLogic ¶
type MigratorLogic struct{}
func (MigratorLogic) Migrator ¶
func (MigratorLogic) Migrator(changeVersion string)
type MissionLogic ¶
type MissionLogic struct{}
func (MissionLogic) FindLoginMission ¶
func (MissionLogic) FindLoginMission(ctx context.Context, me *model.Me) *model.UserLoginMission
func (MissionLogic) HasLoginMission ¶
HasLoginMission 是否有今日登录奖励
func (MissionLogic) RedeemLoginAward ¶
RedeemLoginAward 领取登录奖励
type Observable ¶
type Observable interface { // AddObserver 登记一个新的观察者 AddObserver(o Observer) // Detach 删除一个已经登记过的观察者 RemoveObserver(o Observer) // NotifyObservers 通知所有登记过的观察者 NotifyObservers(uid, objtype, objid int) }
var (
ViewObservable Observable
)
type Paginator ¶
type Paginator struct {
// contains filtered or unexported fields
}
Paginator 分页器
func NewPaginator ¶
func NewPaginatorWithPerPage ¶
func (*Paginator) GetPageHtml ¶
GetPageHtml 构造分页html, uri 当前uri, total 记录总数
func (*Paginator) HasMorePage ¶
func (*Paginator) SetPerPage ¶
type ProjectComment ¶
type ProjectComment struct{}
项目评论
func (ProjectComment) SetObjinfo ¶
func (self ProjectComment) SetObjinfo(ids []int, commentMap map[int][]*model.Comment)
实现 CommentObjecter 接口
func (ProjectComment) String ¶
func (self ProjectComment) String() string
func (ProjectComment) UpdateComment ¶
func (self ProjectComment) UpdateComment(cid, objid, uid int, cmttime time.Time)
更新该项目的评论信息 cid:评论id;objid:被评论对象id;uid:评论者;cmttime:评论时间
type ProjectLike ¶
type ProjectLike struct{}
项目喜欢
func (ProjectLike) String ¶
func (self ProjectLike) String() string
func (ProjectLike) UpdateLike ¶
func (self ProjectLike) UpdateLike(objid, num int)
更新该项目的喜欢数 objid:被喜欢对象id;num: 喜欢数(负数表示取消喜欢)
type ProjectLogic ¶
type ProjectLogic struct{}
func (ProjectLogic) Count ¶
func (ProjectLogic) Count(ctx context.Context, querystring string, args ...interface{}) int64
func (ProjectLogic) FindAll ¶
func (self ProjectLogic) FindAll(ctx context.Context, paginator *Paginator, orderBy string, querystring string, args ...interface{}) []*model.OpenProject
FindAll 支持多页翻看
func (ProjectLogic) FindBy ¶
func (ProjectLogic) FindBy(ctx context.Context, limit int, lastIds ...int) []*model.OpenProject
FindBy 获取开源项目列表(分页)
func (ProjectLogic) FindByIds ¶
func (ProjectLogic) FindByIds(ids []int) []*model.OpenProject
FindByIds 获取多个项目详细信息
func (ProjectLogic) FindOne ¶
func (ProjectLogic) FindOne(ctx context.Context, val interface{}) *model.OpenProject
FindOne 获取单个项目
func (ProjectLogic) FindRecent ¶
func (ProjectLogic) FindRecent(ctx context.Context, username string) []*model.OpenProject
FindRecent 获得某个用户最近发布的开源项目
func (ProjectLogic) ParseOneProject ¶
func (ProjectLogic) ParseOneProject(projectUrl string) error
ParseOneProject 处理单个 project
func (ProjectLogic) ParseProjectList ¶
func (self ProjectLogic) ParseProjectList(pUrl string) error
ParseProjectList 解析其他网站的开源项目
type RankLogic ¶
type RankLogic struct{}
func (RankLogic) FindDAURank ¶
FindDAURank DAU 排名,默认获取当天的
func (RankLogic) FindDayRank ¶
func (self RankLogic) FindDayRank(ctx context.Context, objtype int, ymd string, num int, needExt ...bool) (result interface{})
FindDayRank needExt 是否需要扩展数据
func (RankLogic) FindMonthRank ¶
func (RankLogic) FindRichRank ¶
FindRichRank 社区财富排行榜
func (RankLogic) FindWeekRank ¶
func (RankLogic) GenDAURank ¶
GenDAURank 生成日活跃用户排行
func (RankLogic) GenDayRank ¶
func (RankLogic) GenMonthRank ¶
GenMonthRank 过去 30 天排行榜
func (RankLogic) TotalDAUUser ¶
TotalDAUUser 今日活跃用户数
type ReadingLogic ¶
type ReadingLogic struct{}
func (ReadingLogic) FindBy ¶
func (ReadingLogic) FindBy(ctx context.Context, limit, rtype int, lastIds ...int) []*model.MorningReading
获取晨读列表(分页)
func (ReadingLogic) FindById ¶
func (ReadingLogic) FindById(ctx context.Context, id int) *model.MorningReading
FindById 获取单条晨读
func (ReadingLogic) FindLastList ¶
func (ReadingLogic) FindLastList(beginTime string) ([]*model.MorningReading, error)
func (ReadingLogic) FindReadingByPage ¶
func (ReadingLogic) FindReadingByPage(ctx context.Context, conds map[string]string, curPage, limit int) ([]*model.MorningReading, int)
FindReadingByPage 获取晨读列表(分页)
func (ReadingLogic) IReading ¶
func (ReadingLogic) IReading(ctx context.Context, id int) string
【我要晨读】
func (ReadingLogic) SaveReading ¶
func (ReadingLogic) SaveReading(ctx context.Context, form url.Values, username string) (errMsg string, err error)
SaveReading 保存晨读
type RedditLogic ¶
type RedditLogic struct {
// contains filtered or unexported fields
}
func (*RedditLogic) Parse ¶
func (this *RedditLogic) Parse(redditUrl string) error
Parse 获取url对应的资源并根据规则进行解析
type ResourceComment ¶
type ResourceComment struct{}
资源评论
func (ResourceComment) SetObjinfo ¶
func (self ResourceComment) SetObjinfo(ids []int, commentMap map[int][]*model.Comment)
实现 CommentObjecter 接口
func (ResourceComment) String ¶
func (self ResourceComment) String() string
func (ResourceComment) UpdateComment ¶
func (self ResourceComment) UpdateComment(cid, objid, uid int, cmttime time.Time)
更新该资源的评论信息 cid:评论id;objid:被评论对象id;uid:评论者;cmttime:评论时间
type ResourceLike ¶
type ResourceLike struct{}
资源喜欢
func (ResourceLike) String ¶
func (self ResourceLike) String() string
func (ResourceLike) UpdateLike ¶
func (self ResourceLike) UpdateLike(objid, num int)
更新该主题的喜欢数 objid:被喜欢对象id;num: 喜欢数(负数表示取消喜欢)
type ResourceLogic ¶
type ResourceLogic struct{}
func (ResourceLogic) Count ¶
func (ResourceLogic) Count(ctx context.Context, querystring string, args ...interface{}) int64
func (ResourceLogic) FindAll ¶
func (self ResourceLogic) FindAll(ctx context.Context, paginator *Paginator, orderBy, querystring string, args ...interface{}) (resources []map[string]interface{}, total int64)
FindAll 获得资源列表(完整信息),分页
func (ResourceLogic) FindByCatid ¶
func (ResourceLogic) FindByCatid(ctx context.Context, paginator *Paginator, catid int) (resources []map[string]interface{}, total int64)
FindByCatid 获得某个分类的资源列表,分页
func (ResourceLogic) FindById ¶
func (ResourceLogic) FindById(ctx context.Context, id int) (resourceMap map[string]interface{}, comments []map[string]interface{})
获得资源详细信息
func (ResourceLogic) FindByIds ¶
func (ResourceLogic) FindByIds(ids []int) []*model.Resource
FindByIds 获取多个资源详细信息
func (ResourceLogic) FindRecent ¶
获得某个用户最近的资源
func (ResourceLogic) FindResource ¶
获取单个 Resource 信息(用于编辑)
type RiskLogic ¶
type RiskLogic struct{}
func (RiskLogic) AddBlackIPByUID ¶
AddBlackIPByUID 通过用户 UID 将最后一次登录 IP 加入黑名单
type RuleLogic ¶
type RuleLogic struct{}
func (RuleLogic) FindBy ¶
func (RuleLogic) FindBy(ctx context.Context, conds map[string]string, curPage, limit int) ([]*model.CrawlRule, int)
获取抓取规则列表(分页)
type SearcherLogic ¶
type SearcherLogic struct {
// contains filtered or unexported fields
}
func (*SearcherLogic) DoSearch ¶
func (this *SearcherLogic) DoSearch(q, field string, start, rows int) (*model.ResponseBody, error)
DoSearch 搜索
func (*SearcherLogic) FillNodeAndUser ¶
func (*SearcherLogic) FindAtomFeeds ¶
func (this *SearcherLogic) FindAtomFeeds(rows int) (*model.ResponseBody, error)
func (SearcherLogic) Indexing ¶
func (self SearcherLogic) Indexing(isAll bool)
准备索引数据,post 给 solr isAll: 是否全量
func (SearcherLogic) IndexingArticle ¶
func (self SearcherLogic) IndexingArticle(isAll bool)
IndexingArticle 索引博文
func (SearcherLogic) IndexingOpenProject ¶
func (self SearcherLogic) IndexingOpenProject(isAll bool)
IndexingOpenProject 索引博文
func (*SearcherLogic) SearchByField ¶
func (this *SearcherLogic) SearchByField(field, value string, start, rows int, sorts ...string) (*model.ResponseBody, error)
DoSearch 搜索
type SolrClient ¶
type SolrClient struct {
// contains filtered or unexported fields
}
func NewSolrClient ¶
func NewSolrClient() *SolrClient
func (*SolrClient) Post ¶
func (this *SolrClient) Post() error
func (*SolrClient) PushAdd ¶
func (this *SolrClient) PushAdd(addCommand *model.AddCommand)
func (*SolrClient) PushDel ¶
func (this *SolrClient) PushDel(delCommand *model.DelCommand)
type SubjectLogic ¶
type SubjectLogic struct{}
func (SubjectLogic) Contribute ¶
Contribute 投稿
func (SubjectLogic) ExistByName ¶
func (self SubjectLogic) ExistByName(name string) bool
func (SubjectLogic) FindArticleSubjects ¶
func (SubjectLogic) FindArticleTotal ¶
func (self SubjectLogic) FindArticleTotal(ctx context.Context, sid int) int64
FindArticleTotal 专栏收录的文章数
func (SubjectLogic) FindArticles ¶
func (SubjectLogic) FindFollowerTotal ¶
func (self SubjectLogic) FindFollowerTotal(ctx context.Context, sid int) int64
FindFollowerTotal 专栏关注的用户数
func (SubjectLogic) FindFollowers ¶
func (self SubjectLogic) FindFollowers(ctx context.Context, sid int) []*model.SubjectFollower
FindFollowers 专栏关注的用户
func (SubjectLogic) FindMine ¶
func (self SubjectLogic) FindMine(ctx context.Context, me *model.Me, articleId int, kw string) []map[string]interface{}
FindMine 获取我管理的专栏列表
func (SubjectLogic) Modify ¶
func (SubjectLogic) Modify(ctx context.Context, user *model.Me, form url.Values) (errMsg string, err error)
Modify 修改专栏
func (SubjectLogic) Publish ¶
func (self SubjectLogic) Publish(ctx context.Context, me *model.Me, form url.Values) (sid int, err error)
Publish 发布专栏。
func (SubjectLogic) RemoveContribute ¶
func (self SubjectLogic) RemoveContribute(ctx context.Context, sid, articleId int) error
RemoveContribute 删除投稿
type ThirdUserLogic ¶
type ThirdUserLogic struct{}
func (ThirdUserLogic) BindGithub ¶
func (ThirdUserLogic) GithubAuthCodeUrl ¶
func (ThirdUserLogic) GithubAuthCodeUrl(ctx context.Context, redirectURL string) string
func (ThirdUserLogic) LoginFromGithub ¶
func (ThirdUserLogic) UnBindUser ¶
type TodayActiveObserver ¶
type TodayActiveObserver struct{}
func (*TodayActiveObserver) Update ¶
func (*TodayActiveObserver) Update(action string, uid, objtype, objid int)
type TopicComment ¶
type TopicComment struct{}
话题回复(评论)
func (TopicComment) SetObjinfo ¶
func (self TopicComment) SetObjinfo(ids []int, commentMap map[int][]*model.Comment)
实现 CommentObjecter 接口
func (TopicComment) String ¶
func (self TopicComment) String() string
func (TopicComment) UpdateComment ¶
func (self TopicComment) UpdateComment(cid, objid, uid int, cmttime time.Time)
UpdateComment 更新该主题的回复信息 cid:评论id;objid:被评论对象id;uid:评论者;cmttime:评论时间
type TopicLike ¶
type TopicLike struct{}
主题喜欢
func (TopicLike) UpdateLike ¶
更新该主题的喜欢数 objid:被喜欢对象id;num: 喜欢数(负数表示取消喜欢)
type TopicLogic ¶
type TopicLogic struct{}
func (TopicLogic) Count ¶
func (TopicLogic) Count(ctx context.Context, querystring string, args ...interface{}) int64
func (TopicLogic) FindAll ¶
func (self TopicLogic) FindAll(ctx context.Context, paginator *Paginator, orderBy string, querystring string, args ...interface{}) []map[string]interface{}
FindAll 支持多页翻看
func (TopicLogic) FindAppend ¶
func (TopicLogic) FindAppend(ctx context.Context, tid int) []*model.TopicAppend
func (TopicLogic) FindByPage ¶
func (TopicLogic) FindByPage(ctx context.Context, conds map[string]string, curPage, limit int) ([]*model.Topic, int)
获取列表(分页):后台用
func (TopicLogic) FindByTid ¶
func (self TopicLogic) FindByTid(ctx context.Context, tid int) (topicMap map[string]interface{}, replies []map[string]interface{}, err error)
FindByTid 获得主题详细信息(包括详细回复)
func (TopicLogic) FindByTids ¶
func (TopicLogic) FindByTids(tids []int) []*model.Topic
FindByTids 获取多个主题详细信息
func (TopicLogic) FindFullinfoByTids ¶
func (self TopicLogic) FindFullinfoByTids(tids []int) []map[string]interface{}
func (TopicLogic) FindHotNodes ¶
func (TopicLogic) FindHotNodes(ctx context.Context) []map[string]interface{}
FindHotNodes 获得热门节点
func (TopicLogic) FindLastList ¶
func (TopicLogic) FindRecent ¶
func (self TopicLogic) FindRecent(limit int, uids ...int) []*model.Topic
FindRecent 获得最近的主题(uids[0],则获取某个用户最近的主题)
func (TopicLogic) JSEscape ¶
func (TopicLogic) JSEscape(topics []*model.Topic) []*model.Topic
JSEscape 安全过滤
func (TopicLogic) Modify ¶
func (TopicLogic) Modify(ctx context.Context, user *model.Me, form url.Values) (errMsg string, err error)
Modify 修改主题 user 修改人的(有可能是作者或管理员)
func (TopicLogic) Publish ¶
func (self TopicLogic) Publish(ctx context.Context, me *model.Me, form url.Values) (tid int, err error)
Publish 发布主题。入topics和topics_ex库
type TopicNodeLogic ¶
type TopicNodeLogic struct{}
func (TopicNodeLogic) FindAll ¶
func (self TopicNodeLogic) FindAll(ctx context.Context) []*model.TopicNode
func (TopicNodeLogic) FindByEname ¶
func (self TopicNodeLogic) FindByEname(ename string) *model.TopicNode
func (TopicNodeLogic) FindByNids ¶
func (self TopicNodeLogic) FindByNids(nids []int) map[int]*model.TopicNode
func (TopicNodeLogic) FindByParent ¶
func (self TopicNodeLogic) FindByParent(pid, num int) []*model.TopicNode
func (TopicNodeLogic) FindParallelTree ¶
func (self TopicNodeLogic) FindParallelTree(ctx context.Context) []*model.TopicNode
type UploaderLogic ¶
type UploaderLogic struct {
// contains filtered or unexported fields
}
http://developer.qiniu.com/code/v6/sdk/go-sdk-6.html
func (*UploaderLogic) InitQiniu ¶
func (this *UploaderLogic) InitQiniu()
func (*UploaderLogic) TransferUrl ¶
func (this *UploaderLogic) TransferUrl(ctx context.Context, origUrl string, prefixs ...string) (string, error)
TransferUrl 将外站图片URL转为本站,如果失败,返回原图
type UserData ¶
type UserData struct {
// contains filtered or unexported fields
}
func (*UserData) InitMessageQueue ¶
func (*UserData) MessageQueue ¶
func (*UserData) SendMessage ¶
type UserLogic ¶
type UserLogic struct{}
func (UserLogic) Activate ¶
func (self UserLogic) Activate(ctx context.Context, email, uuid string, timestamp int64, sign string) (*model.User, error)
Activate 用户激活
func (UserLogic) AdminUpdateUser ¶
func (UserLogic) ChangeAvatar ¶
ChangeAvatar 更换头像
func (UserLogic) CreateUser ¶
CreateUser 创建用户
func (UserLogic) DecrUserWeight ¶
func (UserLogic) EmailOrUsernameExists ¶
EmailOrUsernameExists 判断指定的邮箱(email)或用户名是否存在
func (UserLogic) EmailSubscribe ¶
邮件订阅或取消订阅
func (UserLogic) FindActiveUsers ¶
FindActiveUsers 获得活跃用户
func (UserLogic) FindBindUsers ¶
func (UserLogic) FindCurrentUser ¶
获取当前登录用户信息(常用信息)
func (UserLogic) FindDAUUsers ¶
func (UserLogic) FindNewUsers ¶
FindNewUsers 最新加入会员
func (UserLogic) FindNotLoginUsers ¶
获取 loginTime 之前没有登录的用户
func (UserLogic) FindUserByPage ¶
func (UserLogic) FindUserByPage(ctx context.Context, conds map[string]string, curPage, limit int) ([]*model.User, int)
获取用户列表(分页):后台用
func (UserLogic) FindUserInfos ¶
FindUserInfos 获得用户信息,uniq 可能是 uid slice 或 username slice
func (UserLogic) GetUserMentions ¶
GetUserMentions 获取 @ 的 suggest 列表
func (UserLogic) IncrUserWeight ¶
增加或减少用户活跃度
func (UserLogic) RecordLogin ¶
RecordLogin 记录用户最后登录时间和 IP
func (UserLogic) ResetPasswd ¶
func (UserLogic) Update ¶
func (self UserLogic) Update(ctx context.Context, me *model.Me, form url.Values) (errMsg string, err error)
Update 更新用户信息
func (UserLogic) UpdatePasswd ¶
func (self UserLogic) UpdatePasswd(ctx context.Context, username, curPasswd, newPasswd string) (string, error)
UpdatePasswd 更新用户密码
func (UserLogic) UpdateUserStatus ¶
UpdateUserStatus 更新用户状态
type UserRichLogic ¶
type UserRichLogic struct{}
func (UserRichLogic) AwardCooper ¶
func (self UserRichLogic) AwardCooper()
func (UserRichLogic) FindBalanceDetail ¶
func (UserRichLogic) FindBalanceDetail(ctx context.Context, me *model.Me, types ...int) []*model.UserBalanceDetail
func (UserRichLogic) FindRecharge ¶
func (UserRichLogic) IncrUserRich ¶
func (self UserRichLogic) IncrUserRich(user *model.User, typ, award int, desc string)
IncrUserRich 增加或减少用户财富
type UserRichObserver ¶
type UserRichObserver struct{}
func (UserRichObserver) Update ¶
func (UserRichObserver) Update(action string, uid, objtype, objid int)
Update 如果是回复,则 objid 是 cid
type UserWeightObserver ¶
type UserWeightObserver struct{}
func (*UserWeightObserver) Update ¶
func (this *UserWeightObserver) Update(action string, uid, objtype, objid int)
type ViewRecordLogic ¶
type ViewRecordLogic struct{}
func (ViewRecordLogic) FindUserNum ¶
func (ViewRecordLogic) FindUserNum(ctx context.Context, objid, objtype int) int64
func (ViewRecordLogic) Record ¶
func (ViewRecordLogic) Record(objid, objtype, uid int)
type ViewSourceLogic ¶
type ViewSourceLogic struct{}
func (ViewSourceLogic) FindOne ¶
func (ViewSourceLogic) FindOne(ctx context.Context, objid, objtype int) *model.ViewSource
FindOne 获得浏览来源
type WechatLogic ¶
type WechatLogic struct{}
func (WechatLogic) AutoReply ¶
func (self WechatLogic) AutoReply(ctx context.Context, reqData []byte) (*model.WechatReply, error)
func (WechatLogic) Bind ¶
func (self WechatLogic) Bind(ctx context.Context, id, uid int, userInfo string) (*model.WechatUser, error)
func (WechatLogic) CheckSession ¶
func (self WechatLogic) CheckSession(ctx context.Context, code string) (*model.WechatUser, error)
CheckSession 微信小程序登录凭证校验
Source Files ¶
- ad.go
- article.go
- authority.go
- auto_crawl.go
- book.go
- comment.go
- commenter.go
- common.go
- data.go
- download.go
- dynamic.go
- email.go
- favorite.go
- feed.go
- friend_link.go
- gctt.go
- gift.go
- github.go
- gobook.go
- html2article.go
- index.go
- install.go
- learning_material.go
- like.go
- message.go
- migrator.go
- mission.go
- observer.go
- page.go
- project.go
- rank.go
- reading.go
- reddit.go
- resource.go
- risk.go
- rule.go
- searcher.go
- setting.go
- sitemap.go
- subject.go
- third_user.go
- topic.go
- topic_node.go
- uploader.go
- user.go
- user_rich.go
- view.go
- view_record.go
- view_source.go
- wechat.go
- wiki.go