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: 56 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusNormal      = 1
	StatusNeedContest = 2
	StatusForbidden   = 3
)

status

Variables

This section is empty.

Functions

func Fetch

func Fetch(idReplyMap map[int64]*model.Reply, ids []int64) []*model.Reply

Fetch Fetch

func InsertInto

func InsertInto(ids []int64, id int64, size int, cmp model.Comp) []int64

InsertInto insert `id` into sorted list(order by `cmp`) `ids` after insertion if the total length > `size`, truncate the extra element

func NeedInsertPendingReply

func NeedInsertPendingReply(params *model.CursorParams, sub *model.Subject) bool

NeedInsertPendingReply NeedInsertPendingReply

func Remove

func Remove(arr []int64, k int64) []int64

Remove Remove

func RepressEmotions

func RepressEmotions(msg string, emoCodes []string) string

RepressEmotions RepressEmotions

func Unique

func Unique(arr []int64) []int64

Unique Unique

Types

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service is reply service

func New

func New(c *conf.Config) (s *Service)

New new a service

func (*Service) AddAction

func (s *Service) AddAction(c context.Context, mid, oid, rpID int64, tp, action int8, ak, ck, op, platform, buvid string, build int64) (err error)

AddAction do act or cancel act for a reply.

func (*Service) AddFilteredReply

func (s *Service) AddFilteredReply(c context.Context, rpID, oid, mid int64, tp, level int8, message string, now time.Time) (err error)

AddFilteredReply AddFilteredReply

func (*Service) AddReply

func (s *Service) AddReply(c context.Context, mid, oid int64, tp, plat int8, ats []int64, accessKey, cookie, captcha, msg, dev, ver, platform string, build int64, buvid string) (r *reply.Reply, uri string, err error)

AddReply add a reply.

func (*Service) AddReplyReply

func (s *Service) AddReplyReply(c context.Context, mid, oid, rootID, parentID int64, tp, plat int8, ats []int64, accessKey, cookie, captcha, msg, dev, ver, platform string, build int64, buvid string) (r *reply.Reply, uri string, err error)

AddReplyReply add reply to a root reply.

func (*Service) AddReport

func (s *Service) AddReport(c context.Context, mid, oid, rpID int64, tp, reason int8, cont, platform string, build int64, buvid string) (cd int, err error)

AddReport report a reply.

func (*Service) AdminAddTop

func (s *Service) AdminAddTop(c context.Context, adid, oid, rpID int64, tp, act int8) (err error)

AdminAddTop add top reply by admin

func (*Service) AdminDelete

func (s *Service) AdminDelete(c context.Context, adid, oid, rpID, ftime int64, tp int8, moral int, notify bool, adname, remark string, reason, freason int8) (err error)

AdminDelete delete reply by admin.

func (*Service) AdminDeleteByReport

func (s *Service) AdminDeleteByReport(c context.Context, adid, oid, rpID, ftime int64, tp int8, moral int, notify bool, adname, remark string, audit int8, reason int8, content string, freason int8) (err error)

AdminDeleteByReport delete report reply by admin.

func (*Service) AdminEdit

func (s *Service) AdminEdit(c context.Context, adid, oid, rpID int64, tp int8, msg, remark string) (err error)

AdminEdit edit reply content by admin.

func (*Service) AdminGetSubject

func (s *Service) AdminGetSubject(c context.Context, oid int64, tp int8) (sub *reply.Subject, err error)

AdminGetSubject get subject state

func (*Service) AdminPass

func (s *Service) AdminPass(c context.Context, adid, oid, rpID int64, tp int8, remark string) (err error)

AdminPass recover reply by admin.

func (*Service) AdminRecover

func (s *Service) AdminRecover(c context.Context, adid, oid, rpID int64, tp int8, remark string) (err error)

AdminRecover recover reply by admin.

func (*Service) AdminReportIgnore

func (s *Service) AdminReportIgnore(c context.Context, adid, oid, rpID int64, tp, audit int8, remark string) (err error)

AdminReportIgnore ignore report by admin.

func (*Service) AdminReportRecover

func (s *Service) AdminReportRecover(c context.Context, adid, oid, rpID int64, tp, audit int8, remark string) (err error)

AdminReportRecover recover report by admin.

func (*Service) AdminReportStateSet

func (s *Service) AdminReportStateSet(c context.Context, adid, oid, rpID int64, tp, state int8) (err error)

AdminReportStateSet set report state by admin.

func (*Service) AdminReportTransfer

func (s *Service) AdminReportTransfer(c context.Context, adid, oid, rpID int64, tp, audit int8) (err error)

AdminReportTransfer transfer report by admin.

func (*Service) AdminSubRegist

func (s *Service) AdminSubRegist(c context.Context, oid, mid int64, tp, state int8, appkey string) (err error)

AdminSubRegist register subject of new archive

func (Service) AdminSubjectMid

func (s Service) AdminSubjectMid(c context.Context, adid, mid, oid int64, tp int8, remark string) (err error)

AdminSubjectMid set the subject mid info.

func (*Service) AdminSubjectState

func (s *Service) AdminSubjectState(c context.Context, adid, oid, mid int64, tp, state int8, remark string) (err error)

AdminSubjectState change subject state by admin.

func (*Service) AliasToType

func (s *Service) AliasToType(alias string) (t int32, exists bool)

AliasToType map alias to type

func (*Service) Captcha

func (s *Service) Captcha(c context.Context, mid int64) (string, error)

Captcha return Captcha

func (*Service) CheckAssist

func (s *Service) CheckAssist(c context.Context, mid, uid int64) (assisted bool, operation bool)

CheckAssist check whether upper grant the supervision permission for user

func (*Service) Close

func (s *Service) Close()

Close close service connection

func (*Service) ContainUrls

func (s *Service) ContainUrls(msg string) bool

ContainUrls ContainUrls

func (*Service) Delete

func (s *Service) Delete(c context.Context, mid, oid, rpID int64, tp int8, ak, ck, platform string, build int64, buvid string) (err error)

Delete delete reply by upper or self.

func (*Service) Dialog

func (s *Service) Dialog(c context.Context, mid, oid int64, tp int8, root, dialog int64, pn, ps int, escape bool) (rps []*model.Reply, err error)

Dialog ...

func (*Service) DialogByCursor

func (s *Service) DialogByCursor(c context.Context, mid, oid int64, tp int8, root, dialog int64, cursor *model.Cursor) (rps []*model.Reply, dialogCursor *model.DialogCursor, dialogMeta *model.DialogMeta, err error)

DialogByCursor ...

func (*Service) DialogMaxMinFloor

func (s *Service) DialogMaxMinFloor(c context.Context, oid int64, tp int8, root, dialog int64) (maxFloor, minFloor int, err error)

DialogMaxMinFloor return max and min floor in dialog

func (*Service) EmojiReplace

func (s *Service) EmojiReplace(plat int8, build int64, roots ...*model.Reply)

EmojiReplace EmojiReplace

func (*Service) EmojiReplaceI

func (s *Service) EmojiReplaceI(mobiAPP string, build int64, roots ...*model.Reply)

EmojiReplaceI EmojiReplace international

func (*Service) Emojis

func (s *Service) Emojis(c context.Context) (emo []*reply.EmojiPackage)

Emojis get vip emojis

func (*Service) FetchFans

func (s *Service) FetchFans(c context.Context, uids []int64, mid int64) (fans map[int64]*reply.FansDetail, err error)

FetchFans fetching a fans relation array between upper(mid) and the users(uids)

func (*Service) FilDelReply

func (s *Service) FilDelReply(rps []*model.Reply) (filtedRps []*model.Reply)

FilDelReply delete reply which is deleted

func (*Service) FillRootReplies

func (s *Service) FillRootReplies(ctx context.Context,
	rs []*model.Reply,
	mid int64,
	ip string,
	htmlEscape bool,
	sub *model.Subject)

FillRootReplies FillRootReplies

func (*Service) GetAccountInfoMap

func (s *Service) GetAccountInfoMap(ctx context.Context, mids []int64, ip string) (map[int64]*accmdl.Card, error)

GetAccountInfoMap fn

func (*Service) GetAssistMap

func (s *Service) GetAssistMap(ctx context.Context, mid int64, ip string) (assistMap map[int64]int, err error)

GetAssistMap fn

func (*Service) GetBlacklist

func (s *Service) GetBlacklist(c context.Context, mid int64) (blacklistMap map[int64]bool, err error)

GetBlacklist get account infos of mids

func (*Service) GetBlacklistMap

func (s *Service) GetBlacklistMap(ctx context.Context,
	mid int64, ip string) (map[int64]bool, error)

GetBlacklistMap GetBlacklistMap

func (*Service) GetChildrenIDsByCursor

func (s *Service) GetChildrenIDsByCursor(ctx context.Context, sub *model.Subject, rootID int64, sort int8, cursor *model.Cursor) ([]int64, error)

GetChildrenIDsByCursor GetChildrenIDsByCursor

func (*Service) GetFansMap

func (s *Service) GetFansMap(ctx context.Context, uids []int64, mid int64, ip string) (map[int64]*model.FansDetail, error)

GetFansMap fn

func (*Service) GetPendingReply

func (s *Service) GetPendingReply(ctx context.Context, mid int64, oid int64, typ int8) (map[int64]*model.Reply, error)

GetPendingReply GetPendingReply

func (*Service) GetRelationMap

func (s *Service) GetRelationMap(ctx context.Context, mid int64, targetMids []int64, ip string) (map[int64]*accmdl.RelationReply, error)

GetRelationMap GetRelationMap

func (*Service) GetReply

func (s *Service) GetReply(c context.Context, oid, rpID int64, tp int8) (*reply.Reply, error)

GetReply GetReply

func (*Service) GetReplyByIDs

func (s *Service) GetReplyByIDs(ctx context.Context, oid int64, otyp int8, ids []int64) (map[int64]*model.Reply, error)

GetReplyByIDs GetReplyByIDs

func (*Service) GetReplyCounts

func (s *Service) GetReplyCounts(ctx context.Context, oids []int64, otyp int8) (map[int64]*model.Counts, error)

GetReplyCounts get reply counts.

func (*Service) GetReplyFromDBByIDs

func (s *Service) GetReplyFromDBByIDs(ctx context.Context, oid int64, otyp int8, ids []int64) ([]*model.Reply, error)

GetReplyFromDBByIDs GetReplyFromDBByIDs

func (*Service) GetReplyLogConfig

func (s *Service) GetReplyLogConfig(c context.Context, sub *reply.Subject, category int8) (config *reply.Config, err error)

GetReplyLogConfig get reply configuration from memocached or load a record from database by oid, type, category

func (*Service) GetRootReply

func (s *Service) GetRootReply(c context.Context, oid, rpID int64, tp int8) (*reply.Reply, error)

GetRootReply GetRootReply

func (*Service) GetRootReplyIDs

func (s *Service) GetRootReplyIDs(ctx context.Context, oid int64, otyp int8, sort int8, offset, limit int64) ([]int64, error)

GetRootReplyIDs GetRootReplyIDs

func (*Service) GetRootReplyIDsByCursor

func (s *Service) GetRootReplyIDsByCursor(ctx context.Context, sub *model.Subject, sort int8, cursor *model.Cursor) ([]int64, error)

GetRootReplyIDsByCursor GetRootReplyIDsByCursor

func (*Service) GetRootReplyListByCursor

func (s *Service) GetRootReplyListByCursor(ctx context.Context, params *model.CursorParams) (*model.RootReplyList, error)

GetRootReplyListByCursor GetRootReplyListByCursor

func (*Service) GetRootReplyListHeader

func (s *Service) GetRootReplyListHeader(ctx context.Context, sub *model.Subject, params *model.CursorParams) (*model.RootReplyListHeader, error)

GetRootReplyListHeader GetRootReplyListHeader

func (*Service) GetSubReplyListByCursor

func (s *Service) GetSubReplyListByCursor(ctx context.Context, params *model.CursorParams) (*model.RootReplyList, error)

GetSubReplyListByCursor GetSubReplyListByCursor

func (*Service) GetSubject

func (s *Service) GetSubject(ctx context.Context, oid int64, tp int8) (*model.Subject, error)

GetSubject GetSubject

func (*Service) GetTop

func (s *Service) GetTop(c context.Context, sub *reply.Subject, oid int64, tp int8, top uint32) (r *reply.Reply, err error)

GetTop get upperTop reply from cache or db.

func (*Service) GetTopReply

func (s *Service) GetTopReply(ctx context.Context, oid int64, otyp int8, topType uint32) (*model.Reply, error)

GetTopReply GetTopReply

func (*Service) Hide

func (s *Service) Hide(c context.Context, oid, mid, rpID int64, tp int8, ak, ck string) (err error)

Hide hide reply by upper.

func (*Service) HotsBatch

func (s *Service) HotsBatch(c context.Context, tp, size int8, oids []int64, mid int64) (res map[int64][]*reply.Reply, err error)

HotsBatch return HotsBatch

func (*Service) IDReplyMap

func (s *Service) IDReplyMap(ctx context.Context, sub *model.Subject,
	parentChildrenIDRelation map[int64][]int64) (map[int64]*model.Reply, error)

IDReplyMap IDReplyMap

func (*Service) IsBnj

func (s *Service) IsBnj(oid int64, tp int8) bool

IsBnj avid...

func (*Service) IsHotReply

func (s *Service) IsHotReply(c context.Context, tp int8, oid, rpID int64) (isHot bool, err error)

IsHotReply IsHotReply

func (*Service) IsWhiteAid

func (s *Service) IsWhiteAid(aid int64, tp int8) bool

IsWhiteAid IsWhiteAid

func (*Service) JumpReplies

func (s *Service) JumpReplies(c context.Context, mid, oid, rpID int64, tp int8, ps, sndPs int, escape bool) (roots, hots []*model.Reply, topAdmin, topUpper *model.Reply, sub *model.Subject, pn, sndPn, total int, err error)

JumpReplies jump to page by reply id.

func (*Service) ListBusiness

func (s *Service) ListBusiness(c context.Context) (business []*reply.Business, err error)

ListBusiness return all non-deleted business record.

func (*Service) NewCursorByReplyID

func (s *Service) NewCursorByReplyID(ctx context.Context, oid int64,
	otyp int8, replyID int64, size int, cmp model.Comp) (*model.Cursor, error)

NewCursorByReplyID NewCursorByReplyID

func (*Service) NewSubCursorByReplyID

func (s *Service) NewSubCursorByReplyID(ctx context.Context, oid int64, otyp int8, replyID int64, size int, cmp model.Comp) (rootID int64, cursor *model.Cursor, err error)

NewSubCursorByReplyID NewSubCursorByReplyID

func (*Service) PaginateUpperDeletedLogs

func (s *Service) PaginateUpperDeletedLogs(c context.Context, oid int64, tp int, curPage, pageSize int) (logs []*adminlog.AdminLog, replyCount, reportCount, pageCount, total int64, err error)

PaginateUpperDeletedLogs paginating the admin logs for size of 'pageSize', and returning the number of reporting, the number of admin logs delete by administrator

func (*Service) ParentChildrenReplyIDRelation

func (s *Service) ParentChildrenReplyIDRelation(ctx context.Context, sub *model.Subject, parentIDs []int64) (map[int64][]int64, error)

ParentChildrenReplyIDRelation ParentChildrenReplyIDRelation

func (*Service) Ping

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

Ping check service health

func (*Service) Records

func (s *Service) Records(c context.Context, types []int64, mid, stime, etime int64, order, sort string, pn, ps int32) (res []*model.Record, total int32, err error)

Records return reply record from es.

func (*Service) RelationBlocked

func (s *Service) RelationBlocked(c context.Context, srcMid, targetMid int64) bool

RelationBlocked RelationBlocked

func (*Service) Reply

func (s *Service) Reply(c context.Context, oid int64, tp int8, rpID int64) (r *reply.Reply, err error)

Reply get reply from cache or db. NOTE old php api call TODO mobile jump

func (*Service) ReplyContent

func (s *Service) ReplyContent(c context.Context, oid, rpID int64, tp int8) (r *model.Reply, err error)

ReplyContent get reply and content.

func (*Service) ReplyCount

func (s *Service) ReplyCount(c context.Context, oid int64, tp int8) (count int, err error)

ReplyCount get all reply count.

func (*Service) ReplyCounts

func (s *Service) ReplyCounts(c context.Context, oids []int64, tp int8) (counts map[int64]int, err error)

ReplyCounts get all reply count.

func (*Service) ReplyHots

func (s *Service) ReplyHots(c context.Context, oid int64, typ int8, pn, ps int) (sub *model.Subject, res []*model.Reply, err error)

ReplyHots return the hot replies.

func (*Service) ReportRelated

func (s *Service) ReportRelated(c context.Context, mid, oid, rpid int64, tp int8, escape bool) (sub *model.Subject, root *model.Reply, related []*model.Reply, err error)

ReportRelated get related replies of report.

func (*Service) ReportReply

func (s *Service) ReportReply(c context.Context, mid, oid, rpid int64, tp int8, pn, ps int, escape bool) (sub *model.Subject, root *model.Reply, seconds []*model.Reply, err error)

ReportReply get report reply.

func (*Service) ResetFloor

func (s *Service) ResetFloor(rps ...*model.Reply)

ResetFloor ...

func (*Service) RootFoldedReply

func (s *Service) RootFoldedReply(ctx context.Context, req *xmodel.RootFolderReq) (res *xmodel.RootFolderRes, err error)

RootFoldedReply ...

func (*Service) RootReplies

func (s *Service) RootReplies(c context.Context, params *model.PageParams) (page *model.PageResult, err error)

RootReplies return a page list of reply.

func (*Service) RootReplyListByCursor

func (s *Service) RootReplyListByCursor(ctx context.Context, sub *model.Subject, params *model.CursorParams) ([]*model.Reply, error)

RootReplyListByCursor RootReplyListByCursor

func (*Service) RplyNotice

func (s *Service) RplyNotice(c context.Context, plat int8, build int64, app, buvid string) (n *model.Notice)

RplyNotice return a reply notice from memory.

func (*Service) SecondReplies

func (s *Service) SecondReplies(c context.Context, mid, oid, rootID, jumpID int64, tp int8, pn, ps int, escape bool) (seconds []*model.Reply, root *model.Reply, upMid int64, toPn int, err error)

SecondReplies return second replies.

func (*Service) Show

func (s *Service) Show(c context.Context, oid, mid, rpID int64, tp int8, ak, ck string) (err error)

Show show reply by upper.

func (*Service) ShowFloor

func (s *Service) ShowFloor(oid int64, tp int8) bool

ShowFloor ...

func (*Service) SubFoldedReply

func (s *Service) SubFoldedReply(ctx context.Context, req *xmodel.SubFolderReq) (res *xmodel.SubFolderRes, err error)

SubFoldedReply ...

func (*Service) Subject

func (s *Service) Subject(c context.Context, oid int64, tp int8) (*reply.Subject, error)

Subject get normal state reply subject

func (*Service) SuperviseReply

func (s *Service) SuperviseReply(c context.Context, mid int64, ak, ck string, tp int8) (err error)

SuperviseReply Supervise Reply

func (s *Service) TitleLink(c context.Context, oid int64, typ int8) (title, link string, typeId int32, err error)

TitleLink TitleLink

func (*Service) Topics

func (s *Service) Topics(c context.Context, mid int64, oid int64, typ int8, msg string) (topics []string, err error)

Topics return topics

func (*Service) TypeToAlias

func (s *Service) TypeToAlias(t int32) (alias string, exists bool)

TypeToAlias map type to alias

func (*Service) UpperAddTop

func (s *Service) UpperAddTop(c context.Context, mid, oid, rpID int64, tp, act int8, platform string, build int64, buvid string) (err error)

UpperAddTop add top reply by upper

func (*Service) UseBigdata

func (s *Service) UseBigdata(c context.Context, b bool, per int64) bool

UseBigdata use bigdata switch

func (*Service) UserBlockStatus

func (s *Service) UserBlockStatus(c context.Context, mid int64) (int, error)

UserBlockStatus UserBlockStatus

func (*Service) ValidUserAction

func (s *Service) ValidUserAction(c context.Context, profile *accmdl.Profile) (err error)

ValidUserAction validate reply user status for like/hate action.

func (*Service) ValidUserStatus

func (s *Service) ValidUserStatus(c context.Context, profile *accmdl.Profile, isUpper bool) (err error)

ValidUserStatus validate reply user status

func (*Service) VerifyCaptcha

func (s *Service) VerifyCaptcha(c context.Context, captcha string, mid int64) error

VerifyCaptcha VerifyCaptcha

func (*Service) Xreply

func (s *Service) Xreply(ctx context.Context, req *xmodel.ReplyReq) (res *xmodel.ReplyRes, err error)

Xreply ...

Jump to

Keyboard shortcuts

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