Create & Init Project...

This commit is contained in:
2019-04-22 18:49:16 +08:00
commit fc4fa37393
25440 changed files with 4054998 additions and 0 deletions

View File

@@ -0,0 +1,73 @@
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
load(
"@io_bazel_rules_go//proto:def.bzl",
"go_proto_library",
)
proto_library(
name = "model_proto",
srcs = ["dm.proto"],
tags = ["automanaged"],
deps = ["@gogo_special_proto//github.com/gogo/protobuf/gogoproto"],
)
go_proto_library(
name = "model_go_proto",
compilers = ["@io_bazel_rules_go//proto:gogofast_proto"],
importpath = "go-common/app/job/main/dm2/model",
proto = ":model_proto",
tags = ["manual"],
deps = [
"//library/time:go_default_library",
"@com_github_gogo_protobuf//gogoproto:go_default_library",
],
)
go_library(
name = "go_default_library",
srcs = [
"action.go",
"bnj.go",
"dm.go",
"dm_seg.go",
"dm_special.go",
"rank_list.go",
"report.go",
"subject.go",
"subtitle.go",
"task.go",
"transfer.go",
"videoup.go",
],
embed = [":model_go_proto"],
importpath = "go-common/app/job/main/dm2/model",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = [
"//library/time:go_default_library",
"@com_github_gogo_protobuf//gogoproto:go_default_library",
"@com_github_gogo_protobuf//proto:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [
":package-srcs",
"//app/job/main/dm2/model/oplog:all-srcs",
],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)

View File

@@ -0,0 +1,34 @@
package model
import (
"encoding/json"
)
// action from DMAction-T
const (
ActFlushDM = "flush" // 刷新弹幕缓存
ActReportDel = "report_del" // 删除举报弹幕
ActAddDM = "dm_add" // 新增弹幕
ActFlushDMSeg = "dm_seg_flush" // 刷新分段弹幕缓存
)
// Action action message
type Action struct {
Action string `json:"action"`
Data json.RawMessage `json:"data"`
}
// Flush flush cache message
type Flush struct {
Type int32 `json:"type"`
Oid int64 `json:"oid"`
Force bool `json:"force"`
}
// FlushDMSeg flush segment dm cache
type FlushDMSeg struct {
Type int32 `json:"type"`
Oid int64 `json:"oid"`
Force bool `json:"force"`
Page *Page `json:"page"`
}

View File

@@ -0,0 +1,29 @@
package model
// Spam .
const (
SpamBlack = 52001
SpamOverflow = 52002
SpamRestrict = 52005
LiveDanmuMsgTypeNormal = 0
)
// LiveDanmu .
type LiveDanmu struct {
RoomID int64 `json:"room_id"`
UID int64 `json:"uid"`
UName string `json:"uname"`
UserLevel int32 `json:"user_level"`
Color int32 `json:"color"`
Content string `json:"content"`
Time int64 `json:"time"`
MsgType int32 `json:"msg_type"`
}
// BnjLiveConfig .
type BnjLiveConfig struct {
DanmuDtarTime string `json:"danmu_start_time"`
CommentID int64 `json:"comment_id"`
RoomID int64 `json:"room_id"`
}

View File

@@ -0,0 +1,172 @@
package model
import (
"encoding/json"
"fmt"
"hash/crc32"
"strconv"
)
var (
bAmp = []byte(`&`)
bGt = []byte(`>`)
bLt = []byte(`<`)
bSp = []byte(` `)
// <d p="播放时间弹幕模式字体大小颜色发送时间弹幕池用户hash弹幕id">弹幕内容</d>
_xmlFmt = `<d p="%.5f,%d,%d,%d,%d,%d,%s,%d">%s</d>`
// <d p="播放时间弹幕模式字体大小颜色发送时间弹幕池用户hash弹幕id用户id">弹幕内容</d>
_rnameFmt = `<d p="%.5f,%d,%d,%d,%d,%d,%s,%d,%d">%s</d>`
)
// All const variable use in job
const (
AttrNo = int32(0) // 属性位为0
AttrYes = int32(1) // 属性位为1
AttrProtect = uint(0) // 保护弹幕
StateNormal = int32(0) // 普通状态
StateDelete = int32(1) // 删除状态
StateHide = int32(2) // 隐藏状态
StateBlock = int32(3) // 屏蔽状态
StateFilter = int32(4) // 过滤状态
StateMonitorBefore = int32(5) // 先审后发
StateMonitorAfter = int32(6) // 先发后审
StateSystemFilter = int32(7) // 敏感词过滤
StateReportDelete = int32(8) // 举报删除
StateAdminDelete = int32(9) // 弹幕管理删除
StateUserDelete = int32(10) // 用户删除
StateScriptDelete = int32(11) // 举报脚本删除
StateTaskDel = int32(12) //弹幕任务删除
// 弹幕模式
ModeRolling = int32(1)
ModeBottom = int32(4)
ModeTop = int32(5)
ModeReverse = int32(6)
ModeSpecial = int32(7)
ModeCode = int32(8)
ModeBAS = int32(9)
PoolNormal = int32(0) // 普通弹幕池
PoolSubtitle = int32(1) // 字幕弹幕池
PoolSpecial = int32(2) // 特殊弹幕池
MaskPriorityHgih = int32(1) // 弹幕蒙版优先级高
MaskPriorityLow = int32(0) // 弹幕蒙版优先级低
NotFound = int64(-1)
)
// BinlogMsg binlog msg produced by canal
type BinlogMsg struct {
Action string `json:"action"`
Table string `json:"table"`
New json.RawMessage `json:"new"`
Old json.RawMessage `json:"old"`
}
// AttrVal return val of index'attr
func (d *DM) AttrVal(bit uint) int32 {
return (d.Attr >> bit) & int32(1)
}
// AttrSet set val of index'attr
func (d *DM) AttrSet(v int32, bit uint) {
d.Attr = d.Attr&(^(1 << bit)) | (v << bit)
}
// DMSlice dm array
type DMSlice []*DM
func (d DMSlice) Len() int { return len(d) }
func (d DMSlice) Swap(i, j int) { d[i], d[j] = d[j], d[i] }
func (d DMSlice) Less(i, j int) bool { return d[i].ID < d[j].ID }
// ToXML convert dm struct to xml.
func (d *DM) ToXML(realname bool) (s string) {
if d.Content == nil {
return
}
msg := d.Content.Msg
if d.ContentSpe != nil {
msg = d.ContentSpe.Msg
}
if len(msg) == 0 {
return
}
if realname {
// <d e="用户id" p="播放时间弹幕模式字体大小颜色发送时间弹幕池用户hash弹幕id">弹幕内容</d>
s = fmt.Sprintf(_rnameFmt, float64(d.Progress)/1000.0, d.Content.Mode, d.Content.FontSize, d.Content.Color, d.Ctime, d.Pool, hash(d.Mid, uint32(d.Content.IP)), d.ID, d.Mid, xmlReplace([]byte(msg)))
} else {
// <d p="播放时间弹幕模式字体大小颜色发送时间弹幕池用户hash弹幕id">弹幕内容</d>
s = fmt.Sprintf(_xmlFmt, float64(d.Progress)/1000.0, d.Content.Mode, d.Content.FontSize, d.Content.Color, d.Ctime, d.Pool, hash(d.Mid, uint32(d.Content.IP)), d.ID, xmlReplace([]byte(msg)))
}
return
}
// xmlReplace replace special char in xml.
func xmlReplace(bi []byte) (bo []byte) {
for _, b := range bi {
if b == 0 {
continue
} else if b == '&' {
bo = append(bo, bAmp...)
continue
} else if b == '>' {
bo = append(bo, bGt...)
continue
} else if b == '<' {
bo = append(bo, bLt...)
continue
} else if (b >= 0x01 && b <= 0x08) || (b >= 0x0b && b <= 0x0c) || (b >= 0x0e && b <= 0x1f) || (b == 0x7f) {
bo = append(bo, bSp...)
} else {
bo = append(bo, b)
}
}
return
}
// hash return hash string.
func hash(mid int64, ip uint32) string {
var s uint32
if mid != 0 {
s = crc32.ChecksumIEEE([]byte(strconv.FormatInt(mid, 10)))
return strconv.FormatInt(int64(s), 16)
}
s = crc32.ChecksumIEEE([]byte(strconv.FormatInt(int64(ip), 10)))
return "D" + strconv.FormatInt(int64(s), 16)
}
// GetSpecialSeg .
func (d *DM) GetSpecialSeg() (msg string) {
if d.Content == nil || d.Pool != PoolSpecial {
return
}
msg = d.Content.Msg
if d.ContentSpe != nil {
msg = d.ContentSpe.Msg
}
return
}
// NeedDisplay 判断该条弹幕是否需要展示
func (d *DM) NeedDisplay() bool {
return d.State == StateNormal || d.State == StateMonitorAfter
}
// NeedUpdateSpecial .
func (d *DM) NeedUpdateSpecial(old *DM) bool {
if (d.Pool == PoolSpecial || old.Pool == PoolSpecial) && d.Pool != old.Pool {
return true
}
if d.Pool == PoolSpecial && d.NeedDisplay() && !old.NeedDisplay() {
return true
}
if d.Pool == PoolSpecial && old.NeedDisplay() && !d.NeedDisplay() {
return true
}
return false
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,54 @@
syntax = "proto3";
package model;
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
option (gogoproto.goproto_enum_prefix_all) = false;
option (gogoproto.goproto_getters_all) = false;
option (gogoproto.unmarshaler_all) = true;
option (gogoproto.marshaler_all) = true;
option (gogoproto.sizer_all) = true;
message DM {
int64 ID = 1 [(gogoproto.jsontag) = "id"];
int32 Type = 2 [(gogoproto.jsontag) = "type"];
int64 Oid = 3 [(gogoproto.jsontag) = "oid"];
int64 Mid = 4 [(gogoproto.jsontag) = "mid"];
int32 Progress = 5 [(gogoproto.jsontag) = "progress"];
int32 Pool = 6 [(gogoproto.jsontag) = "pool"];
int32 Attr = 7 [(gogoproto.jsontag) = "attr"];
int32 State = 8 [(gogoproto.jsontag) = "state"];
int64 Ctime = 9 [(gogoproto.jsontag) = "ctime", (gogoproto.casttype) = "stime"];
int64 Mtime = 10 [(gogoproto.jsontag) = "mtime", (gogoproto.casttype) = "stime"];
Content Content = 11 [(gogoproto.jsontag) = "content,omitempty"];
ContentSpecial ContentSpe = 12 [(gogoproto.jsontag) = "content_special,omitempty"];
}
message Content {
int64 ID = 1 [(gogoproto.jsontag) = "id"];
int32 FontSize = 2 [(gogoproto.jsontag) = "fontsize"];
int64 Color = 3 [(gogoproto.jsontag) = "color"];
int32 Mode = 4 [(gogoproto.jsontag) = "mode"];
int64 IP = 5 [(gogoproto.jsontag) = "ip"];
int32 Plat = 6 [(gogoproto.jsontag) = "plat"];
string Msg = 7 [(gogoproto.jsontag) = "msg"];
int64 Ctime = 8 [(gogoproto.jsontag) = "ctime", (gogoproto.casttype) = "go-common/library/time.Time"];
int64 Mtime = 9 [(gogoproto.jsontag) = "mtime", (gogoproto.casttype) = "go-common/library/time.Time"];
}
message ContentSpecial {
int64 ID = 1 [(gogoproto.jsontag) = "id"];
string Msg = 2 [(gogoproto.jsontag) = "msg"];
int64 Ctime = 3 [(gogoproto.jsontag) = "ctime", (gogoproto.casttype) = "go-common/library/time.Time"];
int64 Mtime = 4 [(gogoproto.jsontag) = "mtime", (gogoproto.casttype) = "go-common/library/time.Time"];
}
message Elem {
string Attribute = 1 [(gogoproto.jsontag) = "attribute,omitempty"];
string Content = 2 [(gogoproto.jsontag) = "content,omitempty"];
}
message DMSeg {
repeated Elem Elems = 1 [(gogoproto.jsontag) = "dms"];
repeated string SpecialURL = 2 [(gogoproto.jsontag) = "special_url,omitempty"];
}

View File

@@ -0,0 +1,138 @@
package model
import (
"fmt"
)
var (
// segmentLength 分段长度,根据视频时长做分段,单位:毫秒
segmentLength = int64(6 * 60 * 1000)
_defaultSeg = &Segment{Start: 0, End: DefaultVideoEnd, Cnt: 1, Num: 1, Duration: 0}
// <d p="弹幕ID,弹幕属性,播放时间,弹幕模式,字体大小,颜色,发送时间,弹幕池,用户hash id">弹幕内容</d>
_xmlSegFmt = `<d p="%d,%d,%d,%d,%d,%d,%d,%d,%s">%s</d>`
// DefaultPage default page info
DefaultPage = &Page{Num: 1, Size: DefaultVideoEnd, Total: 1}
_xmlSegHeader = `<?xml version="1.0" encoding="UTF-8"?><i><oid>%d</oid><ps>%d</ps><pe>%d</pe><pc>%d</pc><pn>%d</pn><state>%d</state><real_name>%d</real_name>`
)
// const variable
const (
// DefaultVideoEnd 当视频时长不存在或者为0时的默认视频结尾时间点
DefaultVideoEnd = 10 * 60 * 60 * 1000
// DefaultPageSize 默认分段长度
DefaultPageSize = 60 * 6 * 1000
)
// Page dm page info
type Page struct {
Num int64 `json:"num"`
Size int64 `json:"size"`
Total int64 `json:"total"`
}
// Segment dm segment struct
type Segment struct {
Start int64 `json:"ps"` // 分段起始时间
End int64 `json:"pe"` // 分段结束时间
Cnt int64 `json:"cnt"` // 总分段数
Num int64 `json:"num"` // 当前第几段
Duration int64 `json:"duration"` // 视频总时长
}
// ToXMLHeader convert segment to xml header format.
func (s *Segment) ToXMLHeader(oid int64, state, realname int32) string {
return fmt.Sprintf(_xmlSegHeader, oid, s.Start, s.End, s.Cnt, s.Num, state, realname)
}
// SegmentInfo get segment info by start time and video duration.
func SegmentInfo(ps, duration int64) (s *Segment) {
var cnt, num, pe int64
if duration == 0 {
s = _defaultSeg
return
}
cnt = duration / DefaultPageSize
if duration%DefaultPageSize > 0 {
cnt++
}
for i := int64(0); i < cnt; i++ {
if ps >= i*DefaultPageSize && ps < (i+1)*DefaultPageSize {
ps = i * DefaultPageSize
pe = (i + 1) * DefaultPageSize
num = i + 1
}
}
if pe > duration {
pe = duration
}
s = &Segment{
Start: ps,
End: pe,
Cnt: cnt,
Num: num,
Duration: duration,
}
return
}
// ToXMLSeg convert dm struct to xml.
func (d *DM) ToXMLSeg() (s string) {
if d.Content == nil {
return
}
msg := d.Content.Msg
if d.ContentSpe != nil {
msg = d.ContentSpe.Msg
}
if len(msg) == 0 {
return
}
if d.Pool == PoolSpecial {
msg = ""
}
s = fmt.Sprintf(_xmlSegFmt, d.ID, d.Attr, d.Progress, d.Content.Mode, d.Content.FontSize, d.Content.Color, d.Ctime, d.Pool, hash(d.Mid, uint32(d.Content.IP)), xmlReplace([]byte(msg)))
return
}
// ToElem convert dm struct to element.
func (d *DM) ToElem() (e *Elem) {
if d.Content == nil {
return
}
msg := d.Content.Msg
if d.ContentSpe != nil {
msg = d.ContentSpe.Msg
}
if len(msg) == 0 {
return
}
if d.Pool == PoolSpecial {
msg = ""
}
// "弹幕ID,弹幕属性,播放时间,弹幕模式,字体大小,颜色,发送时间,弹幕池,用户hash id
e = &Elem{
Attribute: fmt.Sprintf(`%d,%d,%d,%d,%d,%d,%d,%d,%s`, d.ID, d.Attr, d.Progress, d.Content.Mode, d.Content.FontSize, d.Content.Color, d.Ctime, d.Pool, hash(d.Mid, uint32(d.Content.IP))),
Content: msg,
}
return
}
// SegmentPoint 根据当前段数和视频总时长计算分段的起始时间点
func SegmentPoint(num, duration int64) (ps, pe int64) {
if duration == 0 {
ps = 0
pe = DefaultVideoEnd
return
}
pe = num * segmentLength
ps = pe - segmentLength
if pe > duration {
pe = duration
}
if ps < 0 {
ps = 0
}
return
}

View File

@@ -0,0 +1,47 @@
package model
import (
"fmt"
"regexp"
"strings"
)
var (
_regFmt = `.*/bfs/([\S]+)/%s.xml`
)
// DmSpecialContent .
type DmSpecialContent struct {
ID int64 `json:"id"`
Content string `json:"content"`
}
// DmSpecial special dm bfs location
type DmSpecial struct {
ID int64
Type int32
Oid int64
Locations string
}
// Split .
func (d *DmSpecial) Split() []string {
return strings.Split(d.Locations, ",")
}
// Join .
func (d *DmSpecial) Join(s []string) {
d.Locations = strings.Join(s, ",")
}
// Find find url if exist
func (d *DmSpecial) Find(sha1Sum string) string {
locations := d.Split()
reg := regexp.MustCompile(fmt.Sprintf(_regFmt, sha1Sum))
for _, location := range locations {
if reg.MatchString(location) {
return location
}
}
return ""
}

View File

@@ -0,0 +1,29 @@
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = ["oplog.go"],
importpath = "go-common/app/job/main/dm2/model/oplog",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = ["//library/log:go_default_library"],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)

View File

@@ -0,0 +1,79 @@
package oplog
import (
"go-common/library/log"
)
// Infoc operation log for administrator
type Infoc struct {
Oid int64 `json:"oid"`
Type int `json:"type"`
DMIds []int64 `json:"dmids"`
Subject string `json:"subject"`
OriginVal string `json:"origin_val"`
CurrentVal string `json:"current_val"`
OperationTime string `json:"optime"`
OperatorType OperatorType `json:"operator_type"`
Operator int64 `json:"operator"`
Source Source `json:"source"`
Remark string `json:"remark"`
}
// Source enum integer value
type Source int
// Source enum definition list
const (
_ Source = iota
SourceManager
SourceUp
SourcePlayer
)
// String returns the Source enmu description
func (source Source) String() string {
var text string
switch source {
case SourceManager:
text = "运营后台"
case SourceUp:
text = "创作中心"
case SourcePlayer:
text = "播放器"
default:
log.Warn("String() Unknow Source, warn(%+v)", int(source))
text = "未知来源"
}
return text
}
// OperatorType enum integer value
type OperatorType int
// OperatorType enum definition list
const (
_ OperatorType = iota
OperatorAdmin
OperatorMember
OperatorUp
OperatorSystem
)
// String returns the Source enmu description
func (opType OperatorType) String() string {
var text string
switch opType {
case OperatorAdmin:
text = "管理员"
case OperatorMember:
text = "用户"
case OperatorUp:
text = "UP主"
case OperatorSystem:
text = "系统"
default:
log.Warn("String() Unknow Source, warn(%+v)", int(opType))
text = "未知来源"
}
return text
}

View File

@@ -0,0 +1,15 @@
package model
// RankRecentRegion 分区排行榜
type RankRecentRegion struct {
Aid int64 `json:"aid"`
Mid int64 `json:"mid"`
Others []*RankRecentRegion `json:"others"`
}
// RankRecentResp .
type RankRecentResp struct {
Code int32 `json:"code"`
List []*RankRecentRegion `json:"list"`
Num int32 `json:"num"`
}

View File

@@ -0,0 +1,8 @@
package model
// ReportAction report message
type ReportAction struct {
Cid int64 `json:"cid"` // 视频id
Did int64 `json:"dmid"` // 弹幕id
HideTime int64 `json:"hide_time"` // 弹幕隐截止j时间
}

View File

@@ -0,0 +1,94 @@
package model
import (
"database/sql/driver"
"strconv"
"time"
)
// All const variable used in job
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) // 开启蒙版
AttrSubMaskReady = uint(7) // 蒙版生产完成
MaskPlatWeb int8 = 0 // web端
MaskPlatMbl int8 = 1 // 移动端
MaskPlatAll int8 = 100 //全部端
)
// Subject dm_subject.
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 stime `json:"ctime"`
Mtime stime `json:"mtime"`
}
// ConvertStime .
func ConvertStime(t time.Time) stime {
return stime(t.Unix())
}
type stime int64
// Scan scan time.
func (st *stime) Scan(src interface{}) (err error) {
switch sc := src.(type) {
case time.Time:
*st = stime(sc.Unix())
case string:
var i int64
i, err = strconv.ParseInt(sc, 10, 64)
*st = stime(i)
}
return
}
// Value get time value.
func (st stime) Value() (driver.Value, error) {
return time.Unix(int64(st), 0), nil
}
// UnmarshalJSON implements the json.Unmarshaler interface.
func (st *stime) UnmarshalJSON(data []byte) error {
timestamp, err := strconv.ParseInt(string(data), 10, 64)
if err == nil {
*st = stime(timestamp)
return nil
}
t, err := time.ParseInLocation(`"2006-01-02 15:04:05"`, string(data), time.Local)
*st = stime(t.Unix())
return err
}
// AttrVal return val of subject'attr
func (s *Subject) AttrVal(bit uint) int32 {
return (s.Attr >> bit) & int32(1)
}
// AttrSet set val of subject'attr
func (s *Subject) AttrSet(v int32, bit uint) {
s.Attr = s.Attr&(^(1 << bit)) | (v << bit)
}

View File

@@ -0,0 +1,64 @@
package model
// SubtitleStatus .
type SubtitleStatus uint8
// SubtitleStatus
const (
SubtitleStatusUnknown SubtitleStatus = iota
SubtitleStatusDraft
SubtitleStatusToAudit
SubtitleStatusAuditBack
SubtitleStatusRemove
SubtitleStatusPublish
SubtitleStatusCheckToAudit
SubtitleStatusCheckPublish
)
// Subtitle .
type Subtitle struct {
ID int64 `json:"id"`
Oid int64 `json:"oid"`
Type int32 `json:"type"`
Lan uint8 `json:"lan"`
Aid int64 `json:"aid"`
Mid int64 `json:"mid"`
UpMid int64 `json:"up_mid"`
Status SubtitleStatus `json:"status"`
SubtitleURL string `json:"subtitle_url"`
PubTime int64 `json:"pub_time"`
RejectComment string `json:"reject_comment"`
}
// SubtitlePub .
type SubtitlePub struct {
Oid int64
Type int32
Lan uint8
SubtitleID int64
IsDelete bool
}
// SubtitleItem .
type SubtitleItem struct {
From float64 `json:"from"`
To float64 `json:"to"`
Location int8 `json:"location"`
Content string `json:"content"`
}
// SubtitleBody .
type SubtitleBody struct {
FontSize float64 `json:"font_size,omitempty"`
FontColor string `json:"font_color,omitempty"`
BackgroundAlpha float64 `json:"background_alpha,omitempty"`
BackgroundColor string `json:"background_color,omitempty"`
Stroke string `json:"Stroke,omitempty"`
Bodys []*SubtitleItem `json:"body"`
}
// SubtitleAuditMsg .
type SubtitleAuditMsg struct {
SubtitleID int64 `json:"subtitle_id"`
Oid int64 `json:"oid"`
}

View File

@@ -0,0 +1,47 @@
package model
import "time"
// const var
const (
TaskStateSearch = int32(2) //查询执行中
TaskStateDelDM = int32(3) //删除执行中
TaskStateFail = int32(4) //执行失败
TaskStatePause = int32(5) //任务中断
TaskStateSuc = int32(6) //执行成功
TaskStateDel = int32(8) //任务被删除
TaskStateWait = int32(9) //等待执行删除
// 数据平台返回的弹幕任务查询状态
TaskSearchSuc = int32(1) // 查询完成
TaskSearchFail = int32(2) // 查询失败
// 企业微信通知
TaskNoticeTitle = "弹幕任务删除过多告警"
TaskNoticeContent = "弹幕任务(id:%d, title:%s)已删除%d条弹幕已经被暂停请前往管理后台查看"
)
// TaskInfo .
type TaskInfo struct {
ID int64
Topic string
State int32
Count int64
Result string
Sub int32
LastIndex int32
Priority int64
Title string
Creator string
Reviewer string
}
// SubTask .
type SubTask struct {
ID int64
Operation int32
Rate int32
Tcount int64 //删除总数
Start time.Time
End time.Time
}

View File

@@ -0,0 +1,26 @@
package model
import (
"time"
)
// dm transfer state
const (
StatInit = 0
StatFinished = 1
StatFailed = 2
StatTransfing = 3
)
// Transfer dm transfer task
type Transfer struct {
ID int64
FromCid int64
ToCid int64
Mid int64
Offset float64
State int8
Dmid int64
Ctime time.Time
Mtime time.Time
}

View File

@@ -0,0 +1,40 @@
package model
const (
// RouteSecondRound 稿件二审消息
RouteSecondRound = "second_round"
// RouteAutoOpen = 稿件自动开放浏览
RouteAutoOpen = "auto_open"
// RouteForceSync 稿件强制同步
RouteForceSync = "force_sync"
// RouteDelayOpen 稿件定时开放浏览
RouteDelayOpen = "delay_open"
// VideoStatusOpen 视频开放浏览
VideoStatusOpen = int32(0)
//VideoXcodeHDFinish 高清转码完成
VideoXcodeHDFinish = int32(4)
//VideoXcodeFinish 视频转码
VideoXcodeFinish = int32(2)
)
// VideoupMsg second round msg from VideoupBvc.
type VideoupMsg struct {
Route string `json:"route"`
Aid int64 `json:"aid"`
}
// Archive archive info.
type Archive struct {
Aid int64 `json:"aid"`
Mid int64 `json:"mid"`
}
// Video video info.
type Video struct {
Aid int64 `json:"aid"`
Cid int64 `json:"cid"`
Mid int64 `json:"mid"`
Duration int64 `json:"duration"`
Status int32 `json:"status"`
XCodeState int32 `json:"xcode_state"`
}