reply

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

Documentation

Index

Constants

View Source
const (
	EQ = int8(0) // condition equal
	GT = int8(1) // greater
	LT = int8(2) // less
)

eq

View Source
const (
	// AttrNo attribute no
	AttrNo = uint32(0)
	// AttrYes attribute yes
	AttrYes = uint32(1)
)
View Source
const (
	Rule = "https://www.bilibili.com/blackboard/foldingreply.html"

	UserLevelFirst = 1
	UserLevelSnd   = 2

	SubTypeArchive      = int8(1)
	SubTypeTopic        = int8(2)
	SubTypeDrawyoo      = int8(3)
	SubTypeActivity     = int8(4)
	SubTypeLive         = int8(5)
	SubTypeForbiden     = int8(6) // reply forbiden info
	SubTypeNotice       = int8(7) //reply notice info
	SubTypeLiveAct      = int8(8)
	SubTypeActArc       = int8(9)
	SubTypeLiveNotice   = int8(10)
	SubTypeLivePicture  = int8(11) // 文画
	SubTypeArticle      = int8(12) // 文章
	SubTypeTicket       = int8(13) // 票务
	SubTypeMusic        = int8(14) // 音乐
	SubTypeCredit       = int8(15) // 风纪委
	SubTypePgcCmt       = int8(16) // pgc点评
	SubTypeDynamic      = int8(17) // 庐山动态
	SubTypePlaylist     = int8(18) // 播单
	SubTypeMusicList    = int8(19) // 音乐播单
	SubTypeComicSeason  = int8(20) // 漫画部评论
	SubTypeComicEpisode = int8(21) // 漫画话评论
	SubTypeHuoniao      = int8(22) // 火鸟
	SubTypeBBQ          = int8(23) // BBQ
	SubTypePGC          = int8(24) // PGC 全网落地页
	SubTypeGame         = int8(25) // 赛事库电竞
	SubTypeMedialist    = int8(26) // 播单(收藏夹)
	SubTypeEsportsInfo  = int8(27) // 电竞项目比赛数据页

	SubStateNormal = int8(0)
	SubStateForbid = int8(1)

	// Sub attr bit
	SubAttrAdminTop = uint32(0)
	SubAttrUpperTop = uint32(1)
	SubAttrMonitor  = uint32(2)
	SubAttrConfig   = uint32(3)
	SubAttrAudit    = uint32(4)
	SubAttrFrozen   = uint32(5)
	// 标识有被折叠的根评论
	SubAttrFolded = uint32(7)

	ReplyStateNormal    = int8(0)  // normal
	ReplyStateHidden    = int8(1)  // hidden by up
	ReplyStateFiltered  = int8(2)  // filtered
	ReplyStateAdminDel  = int8(3)  // delete by admin
	ReplyStateUserDel   = int8(4)  // delete by user
	ReplyStateMonitor   = int8(5)  // reply after audit
	ReplyStateGarbage   = int8(6)  // spam reply
	ReplyStateTop       = int8(7)  // top
	ReplyStateUpDel     = int8(8)  // delete by up
	ReplyStateBlacklist = int8(9)  // in a blacklist
	ReplyStateAssistDel = int8(10) // delete by assistant
	ReplyStateAudit     = int8(11) // 监管中
	ReplyStateFolded    = int8(12) // 被折叠

	ReplyAttrAdminTop = uint32(0)
	ReplyAttrUpperTop = uint32(1)
	ReplyAttrGarbage  = uint32(2)
	ReplyAttrFilter   = uint32(3)
	// 标识有被折叠的子评论
	ReplyAttrFolded = uint32(7)

	SortByFloor = int8(0)
	SortByCount = int8(1)
	SortByLike  = int8(2)

	ReportStateNew         = int8(0) // 待一审
	ReportStateDelete      = int8(1) // 移除,已废弃
	ReportStateIgnore      = int8(2) // 忽略,已废弃
	ReportStateDeleteOne   = int8(3) // 一审移除
	ReportStateNewTwo      = int8(4) // 待二审
	ReportStateDeleteTwo   = int8(5) // 二审移除
	ReportStateIgnoreTwo   = int8(6) // 二审忽略
	ReportStateIgnoreOne   = int8(7) // 一审忽略
	ReportStateTransferred = int8(8) // 举报转移风纪委

	ReportAttrTransferred = uint(0) //标识举报State是否曾今从待一审\二审转换成待二审\一审

	ReportUserStateNew      = int8(0) // 新增
	ReportUserStateReported = int8(1) // 已反馈

	OpCancel = int8(0) // 取消赞踩
	OpAdd    = int8(1) // 添加赞踩

	ActionNormal = int8(0) // 未踩赞
	ActionLike   = int8(1) // 赞
	ActionHate   = int8(2) // 踩

	UpperOpHide = int8(1)
	UpperOpShow = int8(2)

	ReportReasonAd                 = int8(1)  // 广告
	ReportReasonPorn               = int8(2)  // 色情
	ReportReasonMeaningless        = int8(3)  // 刷屏
	ReportReasonProvoke            = int8(4)  // 引战
	ReportReasonSpoiler            = int8(5)  // 剧透
	ReportReasonPolitic            = int8(6)  // 政治
	ReportReasonAttack             = int8(7)  // 人身攻击
	ReportReasonUnrelated          = int8(8)  // 视频不相关
	ReportReasonProhibited         = int8(9)  // 违禁
	ReportReasonVulgar             = int8(10) // 低俗
	ReportReasonIllegalWebsite     = int8(11) // 非法网站
	ReportReasonGamblingFraud      = int8(12) // 赌博诈骗
	ReportReasonRumor              = int8(13) // 传播不实信息
	ReportReasonAbetting           = int8(14) // 怂恿教唆信息
	ReportReasonPrivacyInvasion    = int8(15) // 侵犯隐私
	ReportReasonUnlimitedSign      = int8(16) // 抢楼
	ReportReasonYouthInappropriate = int8(17) // 青少年不良信息
	ReportReasonOther              = int8(0)  // 其他

	PlatUnknow   = int8(0)
	PlatWeb      = int8(1)
	PlatAndroid  = int8(2)
	PlatIPhone   = int8(3)
	PlatWpM      = int8(4) // wp mobile
	PlatIPad     = int8(5)
	PlatPadHd    = int8(6) // ipad hd
	PlatWpPc     = int8(7) // win10
	PlatAndroidI = int8(8) // 国际版安卓

	AdminOperDelete         = int8(0)  // admin delete
	AdminOperDeleteByReport = int8(1)  // admin delete by report
	AdminOperIgnoreReport   = int8(2)  // admin ignore report
	AdminOperRecover        = int8(3)  // admin recover
	AdminOperEdit           = int8(4)  // admin edit reply content
	AdminOperPass           = int8(5)  // admin pass
	AdminOperSubState       = int8(6)  // admin change subject state
	AdminOperSubTop         = int8(7)  // top reply
	AdminOperSubMid         = int8(8)  // admin change subject mid
	AdminOperRptIgnore1     = int8(9)  // admin report ignore 1
	AdminOperRptIgnore2     = int8(10) // admin report ignore 2
	AdminOperRptDel1        = int8(11) // admin report del 1
	AdminOperRptDel2        = int8(12) // admin report del 2
	AdminOperRptRecover1    = int8(13) // admin report recover 1
	AdminOperRptRecover2    = int8(14) // admin report recover 2
	AdminOperActionSet      = int8(15) // admin action set

	AdminIsNotReport = int8(0)
	AdminIsReport    = int8(1)
	AdminIsNotNew    = int8(0)
	AdminIsNew       = int8(1)

	AuditTypeOne = int8(1) // 一审
	AuditTypeTwo = int8(2) // 二审

	BlacklistRelation = int16(-1)

	ReportReplyAdd = "reply_add"
	ReportReplyDel = "reply_del"

	ReportReplyLike       = "reply_like"
	ReportReplyHate       = "reply_hate"
	ReportReplyCancelLike = "reply_cancel_like"
	ReportReplyCancelHate = "reply_cancel_hate"

	ReportReplyTop   = "reply_top"
	ReportReplyUntop = "reply_untop"

	ReportReplyReport = "reply_report"
)

subtype

View Source
const (
	RecordTimeLayout = "2006-01-02 15:04:05"
)

time layout

Variables

View Source
var (
	OrderDESC = func(x, y int64) bool { return x > y }
	OrderASC  = func(x, y int64) bool { return x < y }
)

order

Functions

func CheckAction

func CheckAction(act int8) (err error)

CheckAction CheckAction

func CheckPlat

func CheckPlat(plat int8) bool

CheckPlat CheckPlat

func CheckReportReason

func CheckReportReason(reason int8) (err error)

CheckReportReason CheckReportReason

func CheckSort

func CheckSort(sort int8) bool

CheckSort WithinSortRange

func CheckSubForbid

func CheckSubForbid(state int8) (err error)

CheckSubForbid CheckSubForbid

func CheckSubState

func CheckSubState(state int8) (err error)

CheckSubState CheckSubState

func GetReportType

func GetReportType(reason int8) int8

GetReportType GetReportType

func LegalSubjectType

func LegalSubjectType(tp int8) bool

LegalSubjectType LegalSubjectType

func ShouldShowFolded

func ShouldShowFolded(mobi_app string, build, scene int64) bool

ShouldShowFolded ...

func SortArr

func SortArr(arr []int64, cmp Comp) []int64

SortArr SortArr

func WithinSortRange

func WithinSortRange(sort int8) bool

WithinSortRange WithinSortRange

Types

type Action

type Action struct {
	ID     int64      `json:"-"`
	RpID   int64      `json:"rpid"`
	Action int8       `json:"action"`
	Mid    int64      `json:"mid"`
	CTime  xtime.Time `json:"-"`
}

Action Action

type ActionCount

type ActionCount struct {
	Like int32 `json:"like"`
	Hate int32 `json:"hate"`
}

ActionCount ActionCount

type AscFloors

type AscFloors []int64

AscFloors floors sort.

func (AscFloors) Len

func (f AscFloors) Len() int

func (AscFloors) Less

func (f AscFloors) Less(i, j int) bool

func (AscFloors) Swap

func (f AscFloors) Swap(i, j int)

type Business

type Business struct {
	Type   int32  `json:"type"`
	Alias  string `json:"alias"`
	Appkey string `json:"appkey"`
}

Business Business

type Comp

type Comp func(x, y int64) bool

Comp Comp

type Config

type Config struct {
	ID        int64  `json:"id"`
	Type      int8   `json:"type"`
	Oid       int64  `json:"oid"`
	AdminID   int64  `json:"adminid"`
	Operator  string `json:"operator"`
	Category  int8   `json:"category"`
	Config    string `json:"config"`
	ShowEntry int8   `json:"showentry"`
	ShowAdmin int8   `json:"showadmin"`
	CTime     string `json:"ctime"`
	MTime     string `json:"mtime"`
}

Config reply config info.

type Content

type Content struct {
	RpID    int64  `json:"-"`
	Message string `json:"message"`

	Ats     Int64Bytes `json:"ats,omitempty"`
	Topics  Mstr       `json:"topics,omitempty"`
	IP      uint32     `json:"ipi,omitempty"`
	Plat    int8       `json:"plat"`
	Device  string     `json:"device"`
	Version string     `json:"version,omitempty"`
	CTime   xtime.Time `json:"-"`
	MTime   xtime.Time `json:"-"`
	// ats member info
	Members []*Info `json:"members"`
}

Content ReplyContent

func (*Content) FillAts

func (rc *Content) FillAts(cards map[int64]*accmdl.Card)

FillAts FillAts

type Counts

type Counts struct {
	SubjectState int8  `json:"sub_state"`
	Counts       int64 `json:"count"`
}

Counts ReplyCounts

type Cursor

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

Cursor Cursor

func NewCursor

func NewCursor(maxID int64, minID int64, size int, cmp Comp) (*Cursor, error)

NewCursor NewCursor

func (*Cursor) Current

func (c *Cursor) Current() int64

Current Current

func (*Cursor) Descrease

func (c *Cursor) Descrease() bool

Descrease Descrease

func (*Cursor) Increase

func (c *Cursor) Increase() bool

Increase Increase

func (*Cursor) Latest

func (c *Cursor) Latest() bool

Latest Latest

func (*Cursor) Len

func (c *Cursor) Len() int

Len Len

func (*Cursor) Max

func (c *Cursor) Max() int64

Max return maxID

func (*Cursor) Min

func (c *Cursor) Min() int64

Min return minID

func (*Cursor) Sort

func (c *Cursor) Sort(arr []int64) []int64

Sort Sort

func (*Cursor) String

func (c *Cursor) String() string

String String

type CursorParams

type CursorParams struct {
	Mid        int64
	Oid        int64
	OTyp       int8
	Sort       int8
	HTMLEscape bool
	IP         string
	RootID     int64
	Cursor     *Cursor
	HotSize    int
	ShowFolded bool
}

CursorParams CursorParams

type DescFloors

type DescFloors []int64

DescFloors floors sort.

func (DescFloors) Len

func (f DescFloors) Len() int

func (DescFloors) Less

func (f DescFloors) Less(i, j int) bool

func (DescFloors) Swap

func (f DescFloors) Swap(i, j int)

type DialogCursor

type DialogCursor struct {
	MinFloor int `json:"min_floor"`
	MaxFloor int `json:"max_floor"`
	Size     int `json:"size"`
}

type DialogMeta

type DialogMeta struct {
	MinFloor int `json:"min_floor"`
	MaxFloor int `json:"max_floor"`
}

type Emoji

type Emoji struct {
	ID        int64  `json:"id"`
	PackageID int64  `json:"-"`
	Name      string `json:"name"`
	URL       string `json:"url"`
	State     int8   `json:"state"`
	Remark    string `json:"remark"`
}

Emoji Emoji

type EmojiPackage

type EmojiPackage struct {
	ID     int64    `json:"pid"`
	Name   string   `json:"pname"`
	State  int8     `json:"pstate"`
	URL    string   `json:"purl"`
	Emojis []*Emoji `json:"emojis"`
}

EmojiPackage EmojiPackage

type FansDetail

type FansDetail struct {
	UID       int64  `json:"uid"`
	MedalID   int32  `json:"medal_id"`      //勋章id
	MedalName string `json:"medal_name"`    //勋章名称
	Score     int32  `json:"score"`         //当前总经验值
	Level     int8   `json:"level"`         //level等级
	Intimacy  int32  `json:"intimacy"`      //当前亲密度
	Status    int8   `json:"master_status"` //佩戴状态1:佩戴中0:未佩戴
	Received  int8   `json:"is_receive"`    //是否领取0:未领取1:已领取
}

FansDetail FansDetail

type Folder

type Folder struct {
	HasFolded bool   `json:"has_folded"`
	IsFolded  bool   `json:"is_folded"`
	Rule      string `json:"rule"`
}

type Info

type Info struct {
	Mid         string `json:"mid"`
	Name        string `json:"uname"`
	Sex         string `json:"sex"`
	Sign        string `json:"sign"`
	Avatar      string `json:"avatar"`
	Rank        string `json:"rank"`
	DisplayRank string `json:"DisplayRank"`
	LevelInfo   struct {
		Cur     int `json:"current_level"`
		Min     int `json:"current_min"`
		NowExp  int `json:"current_exp"`
		NextExp int `json:"next_exp"`
	} `json:"level_info"`
	Pendant        accmdl.PendantInfo   `json:"pendant"`
	Nameplate      accmdl.NameplateInfo `json:"nameplate"`
	OfficialVerify struct {
		Type int    `json:"type"`
		Desc string `json:"desc"`
	} `json:"official_verify"`
	Vip struct {
		Type          int    `json:"vipType"`
		DueDate       int64  `json:"vipDueDate"`
		DueRemark     string `json:"dueRemark"`
		AccessStatus  int    `json:"accessStatus"`
		VipStatus     int    `json:"vipStatus"`
		VipStatusWarn string `json:"vipStatusWarn"`
	} `json:"vip"`
}

Info Info

func (*Info) FromCard

func (i *Info) FromCard(c *accmdl.Card)

FromCard FromCard

type Int64Bytes

type Int64Bytes []int64

Int64Bytes implements the Scanner interface.

func (Int64Bytes) Bytes

func (is Int64Bytes) Bytes() []byte

Bytes marshal int64 slice to bytes,each int64 will occupy Fixed 8 bytes

func (*Int64Bytes) Evict

func (is *Int64Bytes) Evict(e int64) (ok bool)

Evict get rid of the sepcified num from the slice

func (Int64Bytes) Exist

func (is Int64Bytes) Exist(i int64) (e bool)

Exist judge the sepcified num is in the slice or not

func (*Int64Bytes) Scan

func (is *Int64Bytes) Scan(src interface{}) (err error)

Scan parse the data into int64 slice

func (Int64Bytes) Value

func (is Int64Bytes) Value() (driver.Value, error)

Value marshal int64 slice to driver.Value,each int64 will occupy Fixed 8 bytes

type Member

type Member struct {
	*Info
	FansDetail *FansDetail `json:"fans_detail"`
	Following  int16       `json:"following"` //是否关注
}

Member ReplyMember

type Mstr

type Mstr []string

Mstr Mstr

func (Mstr) Bytes

func (ms Mstr) Bytes() []byte

Bytes Bytes

func (*Mstr) Scan

func (ms *Mstr) Scan(src interface{}) (err error)

Scan Scan

func (Mstr) Value

func (ms Mstr) Value() (driver.Value, error)

Value Value

type Notice

type Notice struct {
	ID         int64  `json:"id"`
	Plat       int8   `json:"-"`
	Condition  int8   `json:"-"`
	Build      int64  `json:"-"`
	Title      string `json:"title"`
	Content    string `json:"content"`
	Link       string `json:"link"`
	ClientType string `json:"-"`
}

Notice Notice

func (*Notice) CheckBuild

func (n *Notice) CheckBuild(plat int8, build int64, clientType string) bool

CheckBuild CheckBuild

type PageParams

type PageParams struct {
	Mid  int64
	Oid  int64
	Type int8
	Sort int8

	PageNum  int
	PageSize int

	NeedHot    bool
	NeedSecond bool
	Escape     bool
}

PageParams reply page param.

type PageResult

type PageResult struct {
	Subject  *Subject
	TopAdmin *Reply
	TopUpper *Reply
	Roots    []*Reply
	Hots     []*Reply
	Total    int
	AllCount int
}

PageResult reply page result.

type Record

type Record struct {
	RpID    int64   `json:"id"`
	Oid     int64   `json:"oid"`
	Type    int32   `json:"type"`
	Floor   int32   `json:"floor"`
	Like    int32   `json:"like"`
	RCount  int32   `json:"rcount"`
	Mid     int64   `json:"mid"`
	State   int32   `json:"state"`
	Message string  `json:"message"`
	CTime   string  `json:"ctime"`
	Ats     string  `json:"ats,omitempty"`
	Members []*Info `json:"members"`
}

Record reply record.

func (*Record) FillAts

func (rc *Record) FillAts(cards map[int64]*accmdl.Card)

FillAts fill member info of ats.

type Reply

type Reply struct {
	RpID      int64      `json:"rpid"`
	Oid       int64      `json:"oid"`
	Type      int8       `json:"type"`
	Mid       int64      `json:"mid"`
	Root      int64      `json:"root"`
	Parent    int64      `json:"parent"`
	Dialog    int64      `json:"dialog"`
	Count     int        `json:"count"`
	RCount    int        `json:"rcount"`
	Floor     int        `json:"floor,omitempty"`
	State     int8       `json:"state"`
	FansGrade int8       `json:"fansgrade"`
	Attr      uint32     `json:"attr"`
	CTime     xtime.Time `json:"ctime"`
	MTime     xtime.Time `json:"-"`
	// string
	RpIDStr   string `json:"rpid_str,omitempty"`
	RootStr   string `json:"root_str,omitempty"`
	ParentStr string `json:"parent_str,omitempty"`
	DialogStr string `json:"dialog_str",omitempty`
	// action count, from ReplyAction count
	Like   int  `json:"like"`
	Hate   int  `json:"-"`
	Action int8 `json:"action"`
	// member info
	Member *Member `json:"member"`
	// other
	Content *Content `json:"content"`
	Replies []*Reply `json:"replies"`
	Assist  int      `json:"assist"`
	// 是否有折叠评论
	Folder Folder `json:"folder"`
}

Reply Reply

func (*Reply) AttrSet

func (r *Reply) AttrSet(v uint32, bit uint32)

AttrSet set attr of reply'attr

func (*Reply) AttrVal

func (r *Reply) AttrVal(bit uint32) uint32

AttrVal return val of reply'attr

func (*Reply) Clone

func (r *Reply) Clone() (res *Reply)

Clone clone a reply content.

func (*Reply) FillFolder

func (r *Reply) FillFolder()

FillFolder ...

func (*Reply) FillStr

func (r *Reply) FillStr(isEscape bool)

FillStr FillStr

func (*Reply) HasFolded

func (r *Reply) HasFolded() bool

HasFolded ...

func (*Reply) IsDeleted

func (r *Reply) IsDeleted() bool

IsDeleted IsDeleted

func (*Reply) IsFolded

func (r *Reply) IsFolded() bool

IsFolded ...

func (*Reply) IsNormal

func (r *Reply) IsNormal() bool

IsNormal IsNormal

func (*Reply) IsRoot

func (r *Reply) IsRoot() bool

IsRoot IsRoot

func (*Reply) IsTop

func (r *Reply) IsTop() bool

IsTop IsTop

func (*Reply) UnmarkHasFolded

func (r *Reply) UnmarkHasFolded()

UnmarkHasFolded ...

type Report

type Report struct {
	ID      int64      `json:"id"`
	RpID    int64      `json:"rpid"`
	Oid     int64      `json:"oid"`
	Type    int8       `json:"type"`
	Mid     int64      `json:"mid"`
	Reason  int8       `json:"reason"`
	Content string     `json:"content"`
	Count   int        `json:"count"`
	Score   int        `json:"score"`
	State   int8       `json:"state"`
	CTime   xtime.Time `json:"ctime"`
	MTime   xtime.Time `json:"-"`
	Attr    int8       `json:"attr"`
}

Report Report

func (Report) AttrVal

func (rpt Report) AttrVal(bit uint) int8

AttrVal AttrVal

func (Report) IsTransffered

func (rpt Report) IsTransffered() bool

IsTransffered IsTransffered

type ReportUser

type ReportUser struct {
	ID      int64      `json:"id"`
	Oid     int64      `json:"oid"`
	Type    int8       `json:"type"`
	RpID    int64      `json:"rpid"`
	Mid     int64      `json:"mid"`
	Reason  int8       `json:"reason"`
	Content string     `json:"content"`
	State   int8       `json:"state"`
	CTime   xtime.Time `json:"ctime"`
	MTime   xtime.Time `json:"mtime"`
}

ReportUser report user.

type RootReplyList

type RootReplyList struct {
	Subject *Subject

	Header *RootReplyListHeader

	TopAdmin *Reply
	TopUpper *Reply
	Hots     []*Reply

	Roots                          []*Reply
	CursorRangeMax, CursorRangeMin int64
}

RootReplyList RootReplyList

type RootReplyListHeader

type RootReplyListHeader struct {
	TopAdmin *Reply
	TopUpper *Reply
	Hots     []*Reply
}

RootReplyListHeader RootReplyListHeader

type Subject

type Subject struct {
	ID     int64      `json:"-"`
	Oid    int64      `json:"oid"`
	Type   int8       `json:"type"`
	Mid    int64      `json:"mid"`
	Count  int        `json:"count"`
	RCount int        `json:"rcount"`
	ACount int        `json:"acount"`
	State  int8       `json:"state"`
	Attr   uint32     `json:"attr"`
	Meta   string     `json:"meta"`
	CTime  xtime.Time `json:"ctime"`
	MTime  xtime.Time `json:"-"`
}

Subject ReplySubject

func (*Subject) AttrVal

func (s *Subject) AttrVal(bit uint32) uint32

AttrVal return val of subject'attr.

func (*Subject) Folder

func (s *Subject) Folder() (f Folder)

Folder ...

func (*Subject) HasFolded

func (s *Subject) HasFolded() bool

HasFolded ...

func (*Subject) IsNormal

func (s *Subject) IsNormal() bool

IsNormal IsNormal

type SubjectMeta

type SubjectMeta struct {
	AdminTop int64 `json:"atop,omitempty"`
	UpperTop int64 `json:"utop,omitempty"`
}

SubjectMeta SubjectMeta

Jump to

Keyboard shortcuts

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