model

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

Documentation

Index

Constants

View Source
const (
	// type
	FieldFav      = "folder"
	FieldArc      = "video"
	FieldResource = "resource"
	// action
	ActionAdd                 = "add"
	ActionDel                 = "del"
	ActionMove                = "move"
	ActionCopy                = "copy"
	ActionMdel                = "mdel"
	ActionIndef               = "indef"
	ActionIncol               = "incol"
	ActionClean               = "clean"
	ActionInitRelationFids    = "initRelationFids"
	ActionInitFolderRelations = "initFolderRelations"
	ActionMultiAdd            = "multiAdd"
	ActionMultiDel            = "multiDel"
	ActionFolderAdd           = "folderAdd"
	ActionFolderDel           = "folderDel"
)
View Source
const (
	TopicCacheMiss = -1
	// http mode
	HttpMode4Http  = 1 // eg "http://a.bilibili.com"
	HttpMode4Https = 2 // eg "https://a.bilibili.com"
	HttpMode4Both  = 3 // eg "//a.bilibili.com"
)
View Source
const (
	StateDefaultPublic   = int8(0)        // binary 00 / int 0
	StateDefaultNoPublic = int8(0) | bit1 // binary 01 / int 1
	StateNormalPublic    = bit2 | int8(0) // binary 10 / int 2
	StateNormalNoPublic  = bit2 | bit1    // binary 11 / int 3
	// DefaultFolderName default name of favorite folder
	DefaultFolderName = "默认收藏夹"
	// AllFidFlag all folder id flag
	AllFidFlag = -1
	// CDFlag cool down flag
	CDFlag = -1
	// search error code
	SearchErrWordIllegal = -110 // 非法搜索词错误
	// clean state
	StateAllowToClean = 0
	StateCleaning     = 1
	StateCleanCD      = 2
)

Variables

View Source
var ErrTopicRequest = errors.New("Get topic info request error")

Functions

func CheckPublic

func CheckPublic(state int8) bool

CheckPublic check user update public value in [0, 1].

func IsDefault

func IsDefault(state int8) bool

IsDefault return true if state is default state.

Types

type AppInfo

type AppInfo struct {
	Platform string
	Build    string
	MobiApp  string
	Device   string
}

type Archive

type Archive struct {
	Id    int64      `json:"id"`
	Mid   int64      `json:"mid"`
	Fid   int64      `json:"fid"`
	Aid   int64      `json:"aid"`
	CTime xtime.Time `json:"-"`
	MTime xtime.Time `json:"-"`
}

type Cover

type Cover struct {
	Aid int64  `json:"aid"`
	Pic string `json:"pic"`
}

Cover image

type FavArchive

type FavArchive struct {
	*api.Arc
	FavAt          int64  `json:"fav_at"`
	PlayNum        string `json:"play_num"`
	HighlightTitle string `json:"highlight_title"`
}

type Message

type Message struct {
	Field         string  `json:"field"`
	Action        string  `json:"action"`
	Oid           int64   `json:"oid"`
	Type          int8    `json:"type"`
	Mid           int64   `json:"mid"`
	OldMid        int64   `json:"old_mid"`
	Fid           int64   `json:"fid"`
	FidState      int8    `json:"fid_state"`
	FolderAttr    int8    `json:"folder_attr"`
	OldFolderAttr int8    `json:"old_folder_attr"`
	NewFolderAttr int8    `json:"new_folder_attr"`
	Aid           int64   `json:"aid"`
	OldFid        int64   `json:"old_fid"`
	OldFidState   int8    `json:"old_fid_state"`
	NewFid        int64   `json:"new_fid"`
	NewFidState   int8    `json:"new_fid_state"`
	Affected      int64   `json:"affected"`
	Aids          []int64 `json:"aids"`
	Oids          []int64 `json:"oids"`
	Mids          []int64 `json:"mids"`
	FTime         int64   `json:"ftime"`
}

type Music

type Music struct {
	ID    int64  `json:"song_id"`
	Cover string `json:"cover_url"`
	Title string `json:"title"`
}

type MusicResult

type MusicResult struct {
	Code int              `json:"code"`
	Data map[int64]*Music `json:"data"`
}

type SearchArchive

type SearchArchive struct {
	Code           int    `json:"code,omitempty"`
	Seid           string `json:"seid"`
	Page           int    `json:"page"`
	PageSize       int    `json:"pagesize"`
	NumPages       int    `json:"numPages,omitempty"`
	PageCount      int    `json:"pagecount"`
	NumResults     int    `json:"numResults,omitempty"`
	Total          int    `json:"total"`
	SuggestKeyword string `json:"suggest_keyword"`
	Mid            int64  `json:"mid"`
	Fid            int64  `json:"fid"`
	Tid            int    `json:"tid"`
	Order          string `json:"order"`
	Keyword        string `json:"keyword"`
	TList          []struct {
		Tid   int    `json:"tid"`
		Name  string `json:"name"`
		Count int    `json:"count"`
	} `json:"tlist,omitempty"`
	Result   []*SearchArchiveResult `json:"result,omitempty"`
	Archives []*FavArchive          `json:"archives"`
}

type SearchArchiveResult

type SearchArchiveResult struct {
	ID      int64  `json:"id"`
	Title   string `json:"title"`
	Play    string `json:"play"`
	FavTime int64  `json:"fav_time"`
}

type Topic

type Topic struct {
	ID       int64     `json:"id"`
	TpID     int64     `json:"tp_id"`
	MID      int64     `json:"mid"`
	FavAt    time.Time `json:"fav_at"`
	State    int64     `json:"state"`
	Stime    string    `json:"stime"`
	Etime    string    `json:"etime"`
	Ctime    string    `json:"ctime"`
	Mtime    string    `json:"mtime"`
	Name     string    `json:"name"`
	Author   string    `json:"author"`
	PCUrl    string    `json:"pc_url"`
	H5Url    string    `json:"h5_url"`
	PCCover  string    `json:"pc_cover"`
	H5Cover  string    `json:"h5_cover"`
	Rank     int64     `json:"rank"`
	PageName string    `json:"page_name"`
	Plat     int64     `json:"plat"`
	Desc     string    `json:"desc"`
	Click    int64     `json:"click"`
	TPType   int64     `json:"type"`
	Mold     int64     `json:"mold"`
	Series   int64     `json:"series"`
	Dept     int64     `json:"dept"`
	ReplyID  int64     `json:"reply_id"`
}

type TopicFav

type TopicFav struct {
	ID    int64     `json:"id"`
	Mid   int64     `json:"mid"`
	TpID  int64     `json:"tpid"`
	Ctime time.Time `json:"ctime"`
	Mtime time.Time `json:"mtime"`
}

type TopicList

type TopicList struct {
	PageNum  int      `json:"page"`
	PageSize int      `json:"pagesize"`
	Total    int64    `json:"total"`
	List     []*Topic `json:"list"`
}

type TopicsResult

type TopicsResult struct {
	Code int `json:"code"`
	Data struct {
		List []*Topic `json:"list"`
	} `json:"data"`
}

TopicsResult topics.

type VideoFolder

type VideoFolder struct {
	Fid        int64      `json:"fid"`
	Mid        int64      `json:"mid"`
	Name       string     `json:"name"`
	MaxCount   int        `json:"max_count"`
	CurCount   int        `json:"cur_count"`
	AttenCount int        `json:"atten_count"`
	Favoured   int8       `json:"favoured"`
	State      int8       `json:"state"`
	CTime      xtime.Time `json:"ctime"`
	MTime      xtime.Time `json:"mtime"`
	Cover      []*Cover   `json:"cover,omitempty"`
}

func (*VideoFolder) IsDefault

func (f *VideoFolder) IsDefault() bool

IsDefault return true if folder is default.

func (*VideoFolder) IsPublic

func (f *VideoFolder) IsPublic() bool

IsPublic return true if folder is public.

func (*VideoFolder) StateDef

func (f *VideoFolder) StateDef() int8

StateDef return folder's default state.

func (*VideoFolder) StatePub

func (f *VideoFolder) StatePub() int8

StatePub return folder's public state.

type VideoFolderSort

type VideoFolderSort struct {
	ID    int64              `json:"id"`
	Mid   int64              `json:"mid"`
	Sort  []int64            `json:"sort"`
	Map   map[int64]struct{} `json:"map"`
	CTime xtime.Time         `json:"ctime"`
	MTime xtime.Time         `json:"mtime"`
}

VideoFolderSort folder index.

func (*VideoFolderSort) Index

func (f *VideoFolderSort) Index() []byte

Index return index for fids.

func (*VideoFolderSort) SetIndex

func (f *VideoFolderSort) SetIndex(b []byte) (err error)

SetIndex set sort fids.

func (*VideoFolderSort) SortFavs

func (f *VideoFolderSort) SortFavs(fs map[int64]*VideoFolder, isSelf bool) (res []*VideoFolder, update bool)

SortFavs sort the favorites by index.

type VideoFolders

type VideoFolders []*VideoFolder

func (VideoFolders) Len

func (f VideoFolders) Len() int

func (VideoFolders) Less

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

func (VideoFolders) Swap

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

Jump to

Keyboard shortcuts

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