1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- package model
- import (
- "go-common/library/time"
- )
- const (
- SubTypeVideo = int32(1)
- SubStateOpen = int32(0)
- SubStateClosed = int32(1)
- AttrSubGuest = uint(0)
- AttrSubSpolier = uint(1)
- AttrSubMission = uint(2)
- AttrSubAdvance = uint(3)
- AttrSubMonitorBefore = uint(4)
- AttrSubMonitorAfter = uint(5)
- AttrSubMaskOpen = uint(6)
- AttrSubMblMaskReady = uint(7)
- AttrSubWebMaskReady = uint(8)
- )
- type Subject struct {
- ID int64 `json:"id"`
- Type int32 `json:"type"`
- Oid int64 `json:"oid"`
- Pid int64 `json:"pid"`
- Mid int64 `json:"mid"`
- State int32 `json:"state"`
- Attr int32 `json:"attr"`
- ACount int64 `json:"acount"`
- Count int64 `json:"count"`
- MCount int64 `json:"mcount"`
- MoveCnt int64 `json:"move_count"`
- Maxlimit int64 `json:"maxlimit"`
- Childpool int32 `json:"childpool"`
- Ctime time.Time `json:"ctime"`
- Mtime time.Time `json:"mtime"`
- }
- type ViewVideoSubtitle struct {
- Author *ViewAuthor `json:"author,omitempty"`
- ID int64 `json:"id"`
- Lan string `json:"lan"`
- LanDoc string `json:"lan_doc"`
- SubtitleURL string `json:"subtitle_url"`
- }
- type ViewAuthor struct {
- Mid int64 `json:"mid"`
- Name string `json:"name"`
- Sex string `json:"sex"`
- Face string `json:"face"`
- Sign string `json:"sign"`
- Rank int32 `json:"rank"`
- }
- func (s *Subject) AttrVal(bit uint) int32 {
- return (s.Attr >> bit) & int32(1)
- }
- func (s *Subject) AttrSet(v int32, bit uint) {
- s.Attr = s.Attr&(^(1 << bit)) | (v << bit)
- }
- type SubjectInfo struct {
- Closed bool `json:"closed"`
- Realname bool `json:"real_name"`
- Count int64 `json:"count"`
- MaskList Mask `json:"mask"`
- VideoSubtitle []*ViewVideoSubtitle `json:"subtitles"`
- }
- func (s *Subject) IsMonitoring() bool {
- return s.AttrVal(AttrSubMonitorBefore) == AttrYes ||
- s.AttrVal(AttrSubMonitorAfter) == AttrYes
- }
|