本文整理匯總了Golang中github.com/urandom/readeef/content.User.TagById方法的典型用法代碼示例。如果您正苦於以下問題:Golang User.TagById方法的具體用法?Golang User.TagById怎麽用?Golang User.TagById使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/urandom/readeef/content.User
的用法示例。
在下文中一共展示了User.TagById方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Handler
//.........這裏部分代碼省略.........
login := user.Data().Login
for id, sess := range ttRssSessions {
if sess.login == login {
sessId = id
}
}
if sessId == "" {
sessId = strings.Replace(util.UUID(), "-", "", -1)
ttRssSessions[sessId] = ttRssSession{login: login, lastVisit: time.Now()}
}
con = ttRssGenericContent{
ApiLevel: TTRSS_API_LEVEL,
SessionId: sessId,
}
case "logout":
delete(ttRssSessions, req.Sid)
con = ttRssGenericContent{Status: "OK"}
case "isLoggedIn":
if _, ok := ttRssSessions[req.Sid]; ok {
con = ttRssGenericContent{Status: true}
} else {
con = ttRssGenericContent{Status: false}
}
case "getUnread":
var ar content.ArticleRepo
o := data.ArticleCountOptions{UnreadOnly: true}
if req.IsCat {
tagId := data.TagId(req.FeedId)
if tagId > 0 {
ar = user.TagById(tagId)
} else if tagId == TTRSS_CAT_UNCATEGORIZED {
ar = user
o.UntaggedOnly = true
} else if tagId == TTRSS_CAT_SPECIAL {
ar = user
o.FavoriteOnly = true
}
} else {
switch req.FeedId {
case TTRSS_FAVORITE_ID:
ar = user
o.FavoriteOnly = true
case TTRSS_FRESH_ID:
ar = user
o.AfterDate = time.Now().Add(TTRSS_FRESH_DURATION)
case TTRSS_ALL_ID, 0:
ar = user
default:
if req.FeedId > 0 {
feed := user.FeedById(req.FeedId)
if feed.HasErr() {
err = feed.Err()
break
}
ar = feed
}
}
}