service

package
v0.0.0-...-83adff0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 6, 2020 License: GPL-3.0 Imports: 51 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseImageURLs

func ParseImageURLs(imageURLs, originImageURLs string) (imgs, oimgs []string, err error)

ParseImageURLs parse img urls to []string.

Types

type Service

type Service struct {
	Categories       artmdl.Categories
	RecommendsMap    map[int64][][]*artmdl.Recommend
	RecommendsGroups map[int64]map[int64]bool

	CheatInfoc *anticheat.AntiCheat
	// contains filtered or unexported fields
}

Service service

func New

func New(c *conf.Config) *Service

New new

func (*Service) AIViewInfoc

func (s *Service) AIViewInfoc(mid int64, plat int8, build int, itemType, from, buvid string, itemID int64, now time.Time, ua string)

AIViewInfoc .

func (*Service) ActInfo

func (s *Service) ActInfo(c context.Context, plat int8) (res *model.ActInfo, err error)

ActInfo .

func (*Service) AddArtContentCache

func (s *Service) AddArtContentCache(c context.Context, aid int64, content string) (err error)

AddArtContentCache add article content cache

func (*Service) AddArtDraft

func (s *Service) AddArtDraft(c context.Context, a *artmdl.Draft) (id int64, err error)

AddArtDraft add article draft .

func (*Service) AddArticle

func (s *Service) AddArticle(c context.Context, a *model.Article, actID, listID int64, ip string) (id int64, err error)

AddArticle adds article.

func (*Service) AddArticleCache

func (s *Service) AddArticleCache(c context.Context, aid int64) (err error)

AddArticleCache adds artmdl.

func (*Service) AddAuthor

func (s *Service) AddAuthor(c context.Context, mid int64) (err error)

AddAuthor add author to db

func (*Service) AddCacheHotspotArt

func (s *Service) AddCacheHotspotArt(c context.Context, art *model.SearchArt) (err error)

AddCacheHotspotArt check article in hotspots list and add cache

func (*Service) AddCheatFilter

func (s *Service) AddCheatFilter(c context.Context, aid int64, lv int) (err error)

AddCheatFilter .

func (*Service) AddComplaint

func (s *Service) AddComplaint(c context.Context, aid, mid, ctype int64, reason, imageUrls, ip string) (err error)

AddComplaint add complaint.

func (*Service) AddFavorite

func (s *Service) AddFavorite(c context.Context, mid, aid, fid int64, ip string) (err error)

AddFavorite add article favorite .

func (*Service) AddHistory

func (s *Service) AddHistory(c context.Context, mid, cvid int64, listID int64, ip string, plat int8, from string) (err error)

AddHistory .

func (*Service) AddShare

func (s *Service) AddShare(c context.Context, id int64, mid int64, ip string) (err error)

AddShare adds share stats count.

func (*Service) AllRecommends

func (s *Service) AllRecommends(c context.Context, pn, ps int) (count int64, res []*model.Meta, err error)

AllRecommends all recommends articles

func (*Service) AnniversaryInfo

func (s *Service) AnniversaryInfo(c context.Context, mid int64) (res *model.AnniversaryInfo, err error)

AnniversaryInfo get reader and author info in passed year

func (*Service) Apply

func (s *Service) Apply(c context.Context, mid int64, content, category string) (err error)

Apply add apply

func (*Service) ApplyInfo

func (s *Service) ApplyInfo(c context.Context, mid int64) (res *model.Apply, err error)

ApplyInfo get apply info 检查顺序: 是否已通过->拒绝-> 已提交-> 开放申请-> 申请已满 -> 实名认证/封禁状态/绑定手机

func (*Service) Archives

func (s *Service) Archives(c context.Context, aids []int64, ip string) (arcs map[int64]*api.Arc, err error)

Archives gets archives by aids.

func (*Service) ArtDraft

func (s *Service) ArtDraft(c context.Context, aid, mid int64) (res *artmdl.Draft, err error)

ArtDraft get article draft by id.

func (*Service) Article

func (s *Service) Article(c context.Context, id int64) (res *artmdl.Article, err error)

Article get article

func (*Service) ArticleCapture

func (s *Service) ArticleCapture(c context.Context, url string) (loc string, size int, err error)

ArticleCapture capture a new image.

func (*Service) ArticleMeta

func (s *Service) ArticleMeta(c context.Context, aid int64) (res *artmdl.Meta, err error)

ArticleMeta gets article's meta.

func (*Service) ArticleMetas

func (s *Service) ArticleMetas(c context.Context, ids []int64) (res map[int64]*artmdl.Meta, err error)

ArticleMetas get article meta

func (*Service) ArticleRemainCount

func (s *Service) ArticleRemainCount(c context.Context, mid int64) (num int, err error)

ArticleRemainCount returns the number that user could be use to posting new articles.

func (*Service) ArticleUpCover

func (s *Service) ArticleUpCover(c context.Context, fileType string, body []byte) (url string, err error)

ArticleUpCover article upload cover.

func (*Service) ArticleVersion

func (s *Service) ArticleVersion(c context.Context, aid int64) (a *model.Article, err error)

ArticleVersion .

func (*Service) Authors

func (s *Service) Authors(c context.Context, mid int64, author int64) (res []*model.AccountCard)

Authors recommends similar authors by categories

func (*Service) Banners

func (s *Service) Banners(c context.Context, plat int8, build int, t time.Time) (res []*model.Banner, err error)

Banners get banners

func (*Service) BindTags

func (s *Service) BindTags(c context.Context, mid, aid int64, tags []string, ip string, activityID int64) (err error)

BindTags bind tags with activity

func (*Service) CategoryToRoot

func (s *Service) CategoryToRoot(cid int64) (res int64, err error)

CategoryToRoot 找到一级分区

func (*Service) CheckIdentify

func (s *Service) CheckIdentify(identify int) (err error)

CheckIdentify fn

func (*Service) Close

func (s *Service) Close()

Close close dao.

func (*Service) Coin

func (s *Service) Coin(c context.Context, mid, aid int64, ip string) (res int64, err error)

Coin get user coin number

func (*Service) CreationArticle

func (s *Service) CreationArticle(c context.Context, aid, mid int64) (a *model.Article, err error)

CreationArticle .

func (*Service) CreationUpperArticlesMeta

func (s *Service) CreationUpperArticlesMeta(c context.Context, mid int64, group, category, sortType, pn, ps int, ip string) (res *model.CreationArts, err error)

CreationUpperArticlesMeta gets article list by mid.

func (*Service) CreationWithdrawArticle

func (s *Service) CreationWithdrawArticle(c context.Context, mid, aid int64) (err error)

CreationWithdrawArticle recall the article and add it to draft.

func (*Service) CreativeAddDraft

func (s *Service) CreativeAddDraft(c context.Context, mid int64, art *model.ArtParam) (aid int64, err error)

CreativeAddDraft .

func (*Service) CreativeAddList

func (s *Service) CreativeAddList(c context.Context, mid int64, name string, summary, imageURL string) (res *model.List, err error)

CreativeAddList add list

func (*Service) CreativeArticles

func (s *Service) CreativeArticles(c context.Context, mid int64, pn, ps, sort, group, category int, ip string) (arts *model.CreativeArtList, err error)

CreativeArticles creative articles list

func (*Service) CreativeCanAddArticles

func (s *Service) CreativeCanAddArticles(c context.Context, mid int64) (res []*model.ListArtMeta, err error)

CreativeCanAddArticles can added passed articles

func (*Service) CreativeDelList

func (s *Service) CreativeDelList(c context.Context, mid int64, id int64) (err error)

CreativeDelList del list

func (*Service) CreativeDraft

func (s *Service) CreativeDraft(c context.Context, aid, mid int64, ip string) (res *model.CreativeMeta, err error)

CreativeDraft get draft.

func (*Service) CreativeDraftCount

func (s *Service) CreativeDraftCount(c context.Context, mid int64) (count int)

CreativeDraftCount count of upper's drafts

func (*Service) CreativeDrafts

func (s *Service) CreativeDrafts(c context.Context, mid int64, pn, ps int, ip string) (dls *model.CreativeDraftList, err error)

CreativeDrafts get draft list.

func (*Service) CreativeListAllArticles

func (s *Service) CreativeListAllArticles(c context.Context, mid, id int64) (list *model.List, arts []*model.ListArtMeta, err error)

CreativeListAllArticles get read list articles

func (*Service) CreativeSubArticle

func (s *Service) CreativeSubArticle(c context.Context, mid int64, art *model.ArtParam, ak, ck, ip string) (aid int64, err error)

CreativeSubArticle submit model.

func (*Service) CreativeUpLists

func (s *Service) CreativeUpLists(c context.Context, mid int64) (novel bool, lists []*model.CreativeList, err error)

CreativeUpLists up list

func (*Service) CreativeUpdateArticle

func (s *Service) CreativeUpdateArticle(c context.Context, mid int64, art *model.ArtParam, ak, ck, ip string) (err error)

CreativeUpdateArticle update model.

func (*Service) CreativeUpdateArticleList

func (s *Service) CreativeUpdateArticleList(c context.Context, mid, aid, listID int64, onlyPass bool) (err error)

CreativeUpdateArticleList update article list

func (*Service) CreativeUpdateList

func (s *Service) CreativeUpdateList(c context.Context, id int64, name, imageURL, summary string, publishTime xtime.Time, words int64) (res *model.List, err error)

CreativeUpdateList update list

func (*Service) CreativeUpdateListArticles

func (s *Service) CreativeUpdateListArticles(c context.Context, listID int64, name, imageURL, summary string, onlyList bool, mid int64, aids []int64) (list *model.List, err error)

CreativeUpdateListArticles update list articles

func (*Service) CreativeView

func (s *Service) CreativeView(c context.Context, aid, mid int64, ip string) (res *model.CreativeMeta, err error)

CreativeView get article detail.

func (*Service) DelArtDraft

func (s *Service) DelArtDraft(c context.Context, aid, mid int64) (err error)

DelArtDraft deletes article draft.

func (*Service) DelArticle

func (s *Service) DelArticle(c context.Context, aid, mid int64) (err error)

DelArticle drops article.

func (*Service) DelArticleCache

func (s *Service) DelArticleCache(c context.Context, mid, aid int64) (err error)

DelArticleCache deletes artmdl.

func (*Service) DelCacheHotspotArt

func (s *Service) DelCacheHotspotArt(c context.Context, aid int64) (err error)

DelCacheHotspotArt delete art from hotspots

func (*Service) DelCheatFilter

func (s *Service) DelCheatFilter(c context.Context, aid int64) (err error)

DelCheatFilter .

func (*Service) DelFavorite

func (s *Service) DelFavorite(c context.Context, mid, aid, fid int64, ip string) (err error)

DelFavorite del article favorite .

func (*Service) DelMediaScore

func (s *Service) DelMediaScore(c context.Context, aid, mediaID, mid int64) (err error)

DelMediaScore get media score.

func (*Service) DelRecommendArt

func (s *Service) DelRecommendArt(categoryID int64, aid int64)

DelRecommendArt delete recommend article

func (*Service) DelRecommendArtCache

func (s *Service) DelRecommendArtCache(c context.Context, aid, cid int64) (err error)

DelRecommendArtCache delete recommend article cache

func (*Service) EditTimes

func (s *Service) EditTimes(c context.Context, id int64) (res int)

EditTimes .

func (*Service) Favorites

func (s *Service) Favorites(c context.Context, mid, fid int64, pn, ps int, ip string) (favs *favmdl.Favorites, err error)

Favorites article favorites.

func (*Service) Favs

func (s *Service) Favs(c context.Context, mid, fid int64, pn, ps int, ip string) (favs []*artmdl.Favorite, page *artmdl.Page, err error)

Favs gets user favorite article list.

func (*Service) FeedArticleMetas

func (s *Service) FeedArticleMetas(c context.Context, ids []int64) (res map[int64]*artmdl.Meta, err error)

FeedArticleMetas .

func (*Service) FindCard

func (s *Service) FindCard(c context.Context, idStr string) (res interface{}, err error)

FindCard find card from source

func (*Service) FindCards

func (s *Service) FindCards(c context.Context, ids []string) (res map[string]interface{}, err error)

FindCards find cards

func (*Service) HadLikesByMid

func (s *Service) HadLikesByMid(c context.Context, mid int64, aids []int64) (res map[int64]int8, err error)

HadLikesByMid .

func (*Service) HotspotArts

func (s *Service) HotspotArts(c context.Context, id int64, pn, ps int, lastAids []int64, sort int8, mid int64) (hotspot *model.Hotspot, res []*model.MetaWithLike, err error)

HotspotArts get hotspot articles

func (*Service) IdentifyInfo

func (s *Service) IdentifyInfo(c context.Context, mid int64, phoneOnly int8, ak, ck, ip string) (ret int, err error)

IdentifyInfo .

func (*Service) IsAuthor

func (s *Service) IsAuthor(c context.Context, mid int64) (res bool, forbid bool, err error)

IsAuthor check that whether user has permission to write article.

func (*Service) IsFav

func (s *Service) IsFav(c context.Context, mid, aid int64) (res bool, err error)

IsFav return user is fav article

func (*Service) LevelRequired

func (s *Service) LevelRequired(c context.Context, mid int64) (ok bool, err error)

LevelRequired .

func (*Service) Like

func (s *Service) Like(c context.Context, mid, aid int64, likeType int) (err error)

Like like article

func (*Service) List

func (s *Service) List(c context.Context, id int64) (res *model.List, err error)

List .

func (*Service) ListArticles

func (s *Service) ListArticles(c context.Context, id, mid int64) (res *model.ListArticles, err error)

ListArticles get list passed articles

func (*Service) ListCategories

func (s *Service) ListCategories(c context.Context, ip string) (res artmdl.Categories, err error)

ListCategories list categories

func (*Service) ListCategoriesMap

func (s *Service) ListCategoriesMap(c context.Context, ip string) (res map[int64]*artmdl.Category, err error)

ListCategoriesMap list category map

func (*Service) ListInfo

func (s *Service) ListInfo(c context.Context, aid int64) (res *model.ListInfo, err error)

ListInfo list info

func (*Service) Lists

func (s *Service) Lists(c context.Context, keys []int64) (res map[int64]*model.List, err error)

Lists .

func (*Service) MediaArticle

func (s *Service) MediaArticle(c context.Context, mediaID, mid int64) (id int64, err error)

MediaArticle .

func (*Service) MediaCategory

func (s *Service) MediaCategory(c context.Context, mediaID int64, mid int64) (cg *artmdl.Category, err error)

MediaCategory .

func (*Service) MediaIDByID

func (s *Service) MediaIDByID(c context.Context, aid int64) (id int64, err error)

MediaIDByID .

func (*Service) MoreArts

func (s *Service) MoreArts(c context.Context, aid int64) (res []*artmdl.Meta, err error)

MoreArts get author's more articles.

func (*Service) Mores

func (s *Service) Mores(c context.Context, aid, loginMID int64) (res artmdl.MoreArts, err error)

Mores get more articles

func (*Service) NewArticleCount

func (s *Service) NewArticleCount(c context.Context, ptime int64) (res int64, err error)

NewArticleCount get new article count

func (*Service) Notice

func (s *Service) Notice(platform string, build int) (res *artmdl.Notice)

Notice get notice

func (*Service) ParseDraftParam

func (s *Service) ParseDraftParam(c context.Context, categoryStr, reprintStr, tidStr, imageURLs, originImageURLs string) (art *model.ArtParam, err error)

ParseDraftParam parse draft param which type is int.

func (*Service) ParseParam

func (s *Service) ParseParam(c context.Context, categoryStr, reprintStr, tidStr, imageURLs, originImageURLs string) (art *model.ArtParam, err error)

ParseParam parse article param which type is int.

func (*Service) Ping

func (s *Service) Ping(c context.Context) (err error)

Ping check connection success.

func (*Service) RankCategories

func (s *Service) RankCategories(c context.Context) (res []*artmdl.RankCategory)

RankCategories rank categoires

func (*Service) Ranks

func (s *Service) Ranks(c context.Context, cid int64, mid int64, ip string) (res []*artmdl.RankMeta, note string, err error)

Ranks get ranks

func (*Service) ReadPing

func (s *Service) ReadPing(c context.Context, buvid string, aid int64, mid int64, ip string, cur int64, source string) (err error)

ReadPing 处理用户阅读心跳

func (*Service) RebuildAllListReadCount

func (s *Service) RebuildAllListReadCount(c context.Context)

RebuildAllListReadCount .

func (*Service) RebuildListCache

func (s *Service) RebuildListCache(c context.Context, id int64) (err error)

RebuildListCache rebuild list cache

func (*Service) RecommendAuthors

func (s *Service) RecommendAuthors(c context.Context, platform string, mobiApp string, device string, build int, clientIP string, userID int64, buvid string, mid int64) (res *model.RecommendAuthors, err error)

RecommendAuthors get recommends from search.

func (*Service) RecommendHome

func (s *Service) RecommendHome(c context.Context, plat int8, build int, pn, ps int, aids []int64, mid int64, ip string, t time.Time, buvid string) (res *model.RecommendHome, sky *model.SkyHorseResp, err error)

RecommendHome recommend home

func (*Service) RecommendInfoc

func (s *Service) RecommendInfoc(mid int64, plat int8, pageType, cid, build int, buvid, ip string, metas []*model.Meta, isRcmd bool, now time.Time, pn int64, sky *model.SkyHorseResp)

RecommendInfoc .

func (*Service) RecommendPlus

func (s *Service) RecommendPlus(c context.Context, cid int64, plat int8, build int, pn, ps int, aids []int64, mid int64, t time.Time, sort int, buvid string) (res *model.RecommendPlus, sky *model.SkyHorseResp, err error)

RecommendPlus recommend plus

func (*Service) Recommends

func (s *Service) Recommends(c context.Context, cid int64, pn, ps int, lastAids []int64, sort int) (res []*model.RecommendArt, err error)

Recommends list recommend arts by category id

func (*Service) RecommendsWithLike

func (s *Service) RecommendsWithLike(c context.Context, cid int64, pn, ps int, lastAids []int64, sort int, mid int64) (res []*artmdl.RecommendArtWithLike, err error)

RecommendsWithLike recommends with like state

func (*Service) RefreshList

func (s *Service) RefreshList(c context.Context, id int64) (err error)

RefreshList refresh list info and cache use in api

func (*Service) RootCategory

func (s *Service) RootCategory(c context.Context, aid int64) (root int64, cid int64, err error)

RootCategory 找到一级分区

func (*Service) Segment

func (s *Service) Segment(c context.Context, id int32, content string, withTag int, remarks string) (keywords []string, err error)

Segment .

func (*Service) SendMessage

func (s *Service) SendMessage(c context.Context, aid int64, stat *artmdl.Stats) (err error)

SendMessage send message to uppper

func (*Service) Sentinel

func (s *Service) Sentinel(c context.Context) *conf.Sentinel

Sentinel .

func (*Service) SetMediaScore

func (s *Service) SetMediaScore(c context.Context, score, aid, mediaID, mid int64) (err error)

SetMediaScore set media score.

func (*Service) SetStat

func (s *Service) SetStat(c context.Context, aid int64, stat *artmdl.Stats) (err error)

SetStat sets article's stat.

func (*Service) ShowInfoc

func (s *Service) ShowInfoc(ip string, now time.Time, buvid string, mid int64, client int8, pageType string, from string, build string, ua string, referer string)

ShowInfoc .

func (*Service) SkyHorse

func (s *Service) SkyHorse(c context.Context, cid int64, pn, ps int, lastAids []int64, sort int, mid int64, build int, buvid string, plat int8) (res []*model.RecommendArtWithLike, sky *model.SkyHorseResp, err error)

SkyHorse .

func (*Service) Tags

func (s *Service) Tags(c context.Context, aid int64, skipAct bool) (res []*artmdl.Tag, err error)

Tags gets article tags.

func (*Service) UpArtMetasAndLists

func (s *Service) UpArtMetasAndLists(c context.Context, mid int64, pn int, ps int, sortType int) (res model.UpArtMetasLists, err error)

UpArtMetasAndLists .

func (*Service) UpArticleMetas

func (s *Service) UpArticleMetas(c context.Context, mid int64, pn int, ps int, sortType int) (res *artmdl.UpArtMetas, err error)

UpArticleMetas list up article metas

func (*Service) UpLists

func (s *Service) UpLists(c context.Context, mid int64, sortType int8) (res model.UpLists, err error)

UpLists .

func (*Service) UpStat

func (s *Service) UpStat(c context.Context, mid int64) (res model.UpStat, err error)

UpStat up stat

func (*Service) UpThirtyDayStat

func (s *Service) UpThirtyDayStat(c context.Context, mid int64) (res []*model.ThirtyDayArticle, err error)

UpThirtyDayStat for 30 days stat.

func (*Service) UpdateArticle

func (s *Service) UpdateArticle(c context.Context, a *model.Article, actID, listID int64, ip string) (err error)

UpdateArticle update article.

func (*Service) UpdateArticleCache

func (s *Service) UpdateArticleCache(c context.Context, aid, oldCid int64) (err error)

UpdateArticleCache adds artmdl.

func (*Service) UpdateAuthorCache

func (s *Service) UpdateAuthorCache(c context.Context, mid int64) (err error)

UpdateAuthorCache update author cache

func (*Service) UpdateHotspots

func (s *Service) UpdateHotspots(force bool) (err error)

UpdateHotspots update all hotspots

func (*Service) UpdateRecommends

func (s *Service) UpdateRecommends(c context.Context) (err error)

UpdateRecommends update recommends

func (*Service) UpdateSortCache

func (s *Service) UpdateSortCache(c context.Context, aid int64, changed [][2]int64, ip string) (err error)

UpdateSortCache update sort cache

func (*Service) UpdateUserNoticeState

func (s *Service) UpdateUserNoticeState(c context.Context, mid int64, typ string) (err error)

UpdateUserNoticeState .

func (*Service) UpperArtsCount

func (s *Service) UpperArtsCount(c context.Context, mid int64) (res int, err error)

UpperArtsCount count upper article

func (*Service) UpperDrafts

func (s *Service) UpperDrafts(c context.Context, mid int64, pn, ps int) (res *artmdl.Drafts, err error)

UpperDrafts batch get draft by mid.

func (*Service) UpsArticleMetas

func (s *Service) UpsArticleMetas(c context.Context, mids []int64, start int, end int) (res map[int64][]*artmdl.Meta, err error)

UpsArticleMetas list up article metas

func (*Service) UserDisabled

func (s *Service) UserDisabled(c context.Context, mid int64) (res bool, level int, err error)

UserDisabled check user is disabled

func (*Service) UserNoticeState

func (s *Service) UserNoticeState(c context.Context, mid int64) (res model.NoticeState, err error)

UserNoticeState .

func (*Service) ValidFavs

func (s *Service) ValidFavs(c context.Context, mid, fid int64, pn, ps int, ip string) (res []*artmdl.Favorite, page *artmdl.Page, err error)

ValidFavs get valid favorites

func (*Service) ViewInfo

func (s *Service) ViewInfo(c context.Context, mid, id int64, ip string, cheat *model.CheatInfo, plat int8, from string) (res *model.ViewInfo, err error)

ViewInfo get view info

func (*Service) ViewInfoc

func (s *Service) ViewInfoc(mid int64, plat int8, build int, itemType, from, buvid string, itemID int64, now time.Time, ua string)

ViewInfoc .

func (*Service) ViewList

func (s *Service) ViewList(c context.Context, aid int64, buvid string, from string, ip string, build int, plat int8, mid int64) (pre int64, next int64)

ViewList .

func (*Service) WebListArticles

func (s *Service) WebListArticles(c context.Context, id, mid int64) (res *model.WebListArticles, err error)

WebListArticles .

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL