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,44 @@
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = [
"addit.go",
"archive.go",
"archive_result.go",
"biz_poi.go",
"biz_vote.go",
"config.go",
"cover.go",
"databus.go",
"delay.go",
"forbid.go",
"oper.go",
"task.go",
"type.go",
"video.go",
],
importpath = "go-common/app/job/main/videoup/model/archive",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = ["//library/time: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,20 @@
package archive
//UpFromPGC 生产组, UpFromPGCSecret 机密生产组, UpFromCoopera 企业
const (
UpFromPGC = 1
UpFromPGCSecret = 5
UpFromCoopera = 6
)
//Addit id,aid,source,redirect_url,dynamic
type Addit struct {
ID int64
Aid int64
Source string
RedirectURL string
MissionID int64
UpFrom int8
OrderID int
Dynamic string
}

View File

@@ -0,0 +1,271 @@
package archive
import (
xtime "go-common/library/time"
)
//# state 稿件状态
//# 0 开放浏览 , -1 待审 , -2 打回稿件回收站 , -3 网警锁定删除
//# -4 锁定稿件 , -6 修复待审 , -7 暂缓审核 , -9 等待转码
//# -10 延迟发布 , -11 视频源待修 , -13 允许评论待审 , -15 分发中
//# -16 转码失败, -30 创建提交, -40 用户定时发布, -100 UP主删除
//# attribute bit位置
//# 右1 - norank 禁止排名 , 右2 - noindex 首页禁止 , 右3 - noweb 禁止网页端输出 , 右4 - nomobile 禁止移动端输出
//# 右5 - nosearch 禁止移动端未登录搜索 , 右6 - overseas 海外禁止 , 右7 - nocount 不计算点击
//# 右8 - hidecoins 禁止显示硬币 , 右9 - is_hdflv2 1080p 是否有高清1080p , 右10 - dm 是否允许游客发弹幕
//# 右11 - allow_bp 是否允许投放bp , 右12 - 是否番剧 , 右13 - allow_download 是否允许下载
//# 右14 - hideclick 是否隐藏点击数, 右15 - allow_tag 允许添加tag, 右16 - 是否api投稿
//# 右17 - jump 是否跳转别的url, 右18 - 是否付费影视, 右19 - 付费标识
//# access 会员状态
//# 10000 普通会员 , 15000 新番搬运 , 20000 字幕君, 25000 VIP , 30000 真职人
//# 35000 橙色通过开放浏览 , 40000 橙色通过会员浏览
const (
// StateOpen 开发浏览
StateOpen = int8(0)
// StateOrange 橙色通过
StateOrange = int8(1)
// StateForbidWait 待审
StateForbidWait = int8(-1)
// StateForbidRecicle 打回
StateForbidRecicle = int8(-2)
// StateForbidPolice 网警锁定
StateForbidPolice = int8(-3)
// StateForbidLock 被锁定
StateForbidLock = int8(-4)
// StateForbidFackLock 管理员锁定(可浏览)
StateForbidFackLock = int8(-5)
// StateForbidFixed 修复待审
StateForbidFixed = int8(-6)
// StateForbidLater 暂缓审核
StateForbidLater = int8(-7)
// StateForbidPatched 补档待审
StateForbidPatched = int8(-8)
// StateForbidWaitXcode 等待转码
StateForbidWaitXcode = int8(-9)
// StateForbidAdminDelay 延迟审核
StateForbidAdminDelay = int8(-10)
// StateForbidFixing 视频源待修
StateForbidFixing = int8(-11)
// StateForbidStorageFail 转储失败
StateForbidStorageFail = int8(-12)
// StateForbidOnlyComment 允许评论待审
StateForbidOnlyComment = int8(-13)
// StateForbidTmpRecicle 临时回收站
StateForbidTmpRecicle = int8(-14)
// StateForbidDispatch 分发中
StateForbidDispatch = int8(-15)
// StateForbidXcodeFail 转码失败
StateForbidXcodeFail = int8(-16)
// StateForbidSubmit 创建已提交
StateForbidSubmit = int8(-30)
// StateForbidUserDelay 定时发布
StateForbidUserDelay = int8(-40)
// StateForbidUpDelete 用户删除
StateForbidUpDelete = int8(-100)
// RoundBegin 一审阶段
RoundBegin = int8(0)
// RoundAuditSecond 二审选定分区的多P稿件 及 PGC/活动的单P多P稿件
RoundAuditSecond = int8(10)
// RoundAuditThird 三审:选定分区/PGC/活动 的单P多P稿件
RoundAuditThird = int8(20)
// RoundReviewFlow 私单回查私单ID大于0
RoundReviewFlow = int8(21)
//RoundAuditUGCPayFlow 付费待审
RoundAuditUGCPayFlow = int8(24)
// RoundReviewFirst 分区回查:粉丝小于配置阈值 如 5000 且 指定分区
RoundReviewFirst = int8(30)
// RoundReviewFirstWaitTrigger 点击/粉丝 等待触发中间状态7天内达到阈值进列表未达到自动变99
RoundReviewFirstWaitTrigger = int8(31)
// RoundReviewSecond 社区回查:粉丝大于配置阈值 如 5000 或 优质高危up
RoundReviewSecond = int8(40)
// RoundTriggerFans 粉丝回查:粉丝量达到配置阈值
RoundTriggerFans = int8(80)
// RoundTriggerClick 点击回查:点击量达到配置阈值
RoundTriggerClick = int8(90)
// RoundEnd 结束
RoundEnd = int8(99)
// AccessDefault 非会员可见
AccessDefault = int16(0)
// AccessMember 会员可见
AccessMember = int16(10000)
// CopyrightUnknow 未知版权类型
CopyrightUnknow = int8(0)
// CopyrightOriginal 原创
CopyrightOriginal = int8(1)
// CopyrightCopy 转载
CopyrightCopy = int8(2)
// AttrYes attribute yes
AttrYes = int32(1)
// AttrNo attribute no
AttrNo = int32(0)
// AttrBitNoRank 禁止排行
AttrBitNoRank = uint(0)
// AttrBitNoDynamic 动态禁止
AttrBitNoDynamic = uint(1)
// AttrBitNoWeb 禁止网页输出
AttrBitNoWeb = uint(2)
// AttrBitNoMobile 禁止客户端列表
AttrBitNoMobile = uint(3)
// AttrBitNoSearch 搜索禁止
AttrBitNoSearch = uint(4)
// AttrBitOverseaLock 海外禁止
AttrBitOverseaLock = uint(5)
// AttrBitNoRecommend 禁止推荐
AttrBitNoRecommend = uint(6)
// AttrBitNoReprint 禁止转载
AttrBitNoReprint = uint(7)
// AttrBitHasHD5 是否高清
AttrBitHasHD5 = uint(8)
// AttrBitIsPGC 是否PGC稿件
AttrBitIsPGC = uint(9)
// AttrBitAllowBp 允许承包
AttrBitAllowBp = uint(10)
// AttrBitIsBangumi 是否番剧
AttrBitIsBangumi = uint(11)
// AttrBitIsPorder 是否私单
AttrBitIsPorder = uint(12)
// AttrBitLimitArea 是否限制地区
AttrBitLimitArea = uint(13)
// AttrBitAllowTag 允许其他人添加tag
AttrBitAllowTag = uint(14)
// AttrBitIsFromArcAPI useless
AttrBitIsFromArcAPI = uint(15)
// AttrBitJumpURL 跳转
AttrBitJumpURL = uint(16)
// AttrBitIsMovie 是否影视
AttrBitIsMovie = uint(17)
// AttrBitBadgepay 付费
AttrBitBadgepay = uint(18)
//AttrNoPushBplus 禁止Bplus动态
AttrNoPushBplus = uint(20)
//AttrParentMode 家长模式
AttrBitParentMode = uint(21)
//AttrUGCPay UGC付费
AttrBitUGCPay = uint(22)
//AttrBitSTAFF 联合投稿
AttrBitSTAFF = uint(24)
STATESTAFFON = int8(1)
STATESTAFFOFF = int8(2)
)
// Archive is archive model.
type Archive struct {
Aid int64 `json:"aid"`
Mid int64 `json:"mid"`
TypeID int16 `json:"tid"`
Title string `json:"title"`
Author string `json:"author"`
Cover string `json:"cover"`
Tag string `json:"tag"`
Duration int64 `json:"duration"`
Copyright int8 `json:"copyright"`
Desc string `json:"desc"`
Round int8 `json:"round"`
Forward int64 `json:"forward"`
Attribute int32 `json:"attribute"`
HumanRank int `json:"humanrank"`
Access int16 `json:"access"`
State int8 `json:"state"`
Reason string `json:"reject_reason"`
PTime xtime.Time `json:"ptime"`
CTime xtime.Time `json:"ctime"`
MTime xtime.Time `json:"mtime"`
}
// Attr archive attribute
type Attr int32
// Set set archive attribute
func (a *Attr) Set(v int32, bit uint) {
*a = Attr(int32(*a)&(^(1 << bit)) | (v << bit))
}
// IsNormal check archive is open.
func (a *Archive) IsNormal() bool {
return a.State >= StateOpen || a.State == StateForbidFixed
}
// NotAllowUp check archive is or not allow update state.
func (a *Archive) NotAllowUp() bool {
return a.State == StateForbidUpDelete || a.State == StateForbidLater || a.State == StateForbidLock || a.State == StateForbidPolice
}
// IsForbid check archive state forbid by admin or delete.
func (a *Archive) IsForbid() bool {
return a.State == StateForbidUpDelete || a.State == StateForbidRecicle || a.State == StateForbidPolice || a.State == StateForbidLock || a.State == StateForbidLater || a.State == StateForbidXcodeFail
}
// AttrVal get attribute value.
func (a *Archive) AttrVal(bit uint) int32 {
return (a.Attribute >> bit) & int32(1)
}
// AttrSet set attribute value.
func (a *Archive) AttrSet(v int32, bit uint) {
a.Attribute = a.Attribute&(^(1 << bit)) | (v << bit)
}
// WithAttr set attribute value with a attr value.
func (a *Archive) WithAttr(attr Attr) {
a.Attribute = a.Attribute | int32(attr)
}
// NormalState check archive state is normal
func NormalState(state int8) bool {
return state == StateOpen || state == StateOrange
}
// History archive history model
type History struct {
Aid int64 `json:"aid"`
Title string `json:"title"`
Cover string `json:"cover"`
Desc string `json:"desc"`
State int8 `json:"state"`
}
// BlogCard 粉丝动态
type BlogCard struct {
Type int64 `json:"type"`
//Stype int64 `json:"stype"`
Rid int64 `json:"rid"`
OwnerID int64 `json:"owner_id"`
Show int64 `json:"show"`
Comment string `json:"comment"`
Ts int64 `json:"ts"`
Dynamic string `json:"dynamic"`
Ext string `json:"extension"`
Staffs []*StaffItem `json:"staffs,omitempty"`
}
//StaffItem 联合投稿人信息 type=1
type StaffItem struct {
Type int8 `json:"uid_type"`
UID int64 `json:"uid"`
}
//Staff . 正式staff
type Staff struct {
ID int64 `json:"id"`
AID int64 `json:"aid"`
MID int64 `json:"mid"`
StaffMID int64 `json:"staff_mid"`
StaffTitle string `json:"staff_title"`
StaffTitleID int64 `json:"staff_title_id"`
State int8 `json:"state"`
}
//Ext 动态 ext 配置
type Ext struct {
LBS string `json:"lbs_cfg"`
Vote string `json:"vote_cfg"`
}

View File

@@ -0,0 +1,56 @@
package archive
// Result is archive model.
type Result struct {
Aid int64 `json:"aid"`
Mid int64 `json:"mid"`
TypeID int16 `json:"tid"`
Title string `json:"title"`
Author string `json:"author"`
Cover string `json:"cover"`
Tag string `json:"tag"`
Duration int64 `json:"duration"`
Copyright int8 `json:"copyright"`
Desc string `json:"desc"`
Round int8 `json:"round"`
Forward int64 `json:"forward"`
Attribute int32 `json:"attribute"`
HumanRank int `json:"humanrank"`
Access int16 `json:"access"`
State int8 `json:"state"`
Reason string `json:"reject_reason"`
PTime string `json:"ptime"`
CTime string `json:"ctime"`
MTime string `json:"mtime"`
Dynamic string `json:"dynamic"`
}
// IsNormal check archive is open.
func (a *Result) IsNormal() bool {
return a.State >= StateOpen || a.State == StateForbidFixed
}
// NotAllowUp check archive is or not allow update state.
func (a *Result) NotAllowUp() bool {
return a.State == StateForbidUpDelete || a.State == StateForbidLater || a.State == StateForbidLock || a.State == StateForbidPolice
}
// IsForbid check archive state forbid by admin or delete.
func (a *Result) IsForbid() bool {
return a.State == StateForbidUpDelete || a.State == StateForbidRecicle || a.State == StateForbidPolice || a.State == StateForbidLock || a.State == StateForbidLater || a.State == StateForbidXcodeFail
}
// AttrVal get attribute value.
func (a *Result) AttrVal(bit uint) int32 {
return (a.Attribute >> bit) & int32(1)
}
// AttrSet set attribute value.
func (a *Result) AttrSet(v int32, bit uint) {
a.Attribute = a.Attribute&(^(1 << bit)) | (v << bit)
}
// WithAttr set attribute value with a attr value.
func (a *Result) WithAttr(attr Attr) {
a.Attribute = a.Attribute | int32(attr)
}

View File

@@ -0,0 +1,39 @@
package archive
const (
BIZPOI = int64(1)
)
// PoiObj str
type PoiObj struct {
POI string `json:"poi"`
Type int32 `json:"type"`
Addr string `json:"address"`
Title string `json:"title"`
ShowTitle string `json:"show_title"`
AdInfo *AdInfo `json:"ad_info"`
Ancestors []*Ancestor `json:"ancestors"`
Distance float64 `json:"distance"`
ShowDistrance string `json:"show_distance"`
Location *Location `json:"location"`
}
// AdInfo str
type AdInfo struct {
Nation string `json:"nation"`
Provin string `json:"province"`
Distri string `json:"district"`
City string `json:"city"`
}
// Ancestor str
type Ancestor struct {
POI string `json:"poi"`
Type int32 `json:"type"`
}
// Location str
type Location struct {
Lat float64 `json:"lat"`
Lng float64 `json:"lng"`
}

View File

@@ -0,0 +1,17 @@
package archive
const (
BIZVote = int64(2)
)
//Vote1 .
type VoteOld struct {
VoteID int64 `json:"vote_id"`
VoteTitle string `json:"vote_title"`
}
//Vote .
type Vote struct {
VoteID int64 `json:"vote_id"`
VoteTitle string `json:"title"`
}

View File

@@ -0,0 +1,11 @@
package archive
//archive_config name list
const (
ConfForClick = "round_limit_fans"
ConfForRoundType = "round_limit_tids"
ConfForRoundEnd = "round_delay_time"
ConfForAuditType = "wait_audit_arctype"
ConfForThreshold = "threshold_arctype"
ConfForWeightValue = "weight_conf_values"
)

View File

@@ -0,0 +1,15 @@
package archive
import xtime "go-common/library/time"
// Cover str
type Cover struct {
Filename string
TotalNum int
IndexNum int
NFSPath string
BFSPath string
Used int64
CTime xtime.Time
MTime xtime.Time
}

View File

@@ -0,0 +1,10 @@
package archive
// Databus db
type Databus struct {
ID int64
Group string
Topic string
Partition int8
Offset int64
}

View File

@@ -0,0 +1,18 @@
package archive
import "time"
//定时发布类型
const (
DelayTypeForAdmin = int8(1)
DelayTypeForUser = int8(2)
)
//Delay 定时发布结构
type Delay struct {
ID int64
Aid int64
DTime time.Time
Type int8
State int8
}

View File

@@ -0,0 +1,92 @@
package archive
//稿件禁止项目
const (
ForbidRank = "rank"
ForbidDynamic = "dynamic"
ForbidRecommend = "recommend"
ForbidShow = "show"
ForbidRankMain = 0
ForbidRankRecentArc = 1
ForbidRankAllArc = 2
ForbidDynamicMain = 0
ForbidRecommendMain = 0
ForbidShowMain = 0
ForbidShowMobile = 1
ForbidShowWeb = 2
ForbidShowOversea = 3
ForbidShowOnline = 4
)
// ForbidAttr forbid attribute
type ForbidAttr struct {
Aid int64 `json:"aid"`
OnFlowID int64 `json:"-"`
RankV int32 `json:"-"`
DynamicV int32 `json:"-"`
RecommendV int32 `json:"-"`
ShowV int32 `json:"-"`
// specific
Rank struct {
Main int32 `json:"main"`
RecentArc int32 `json:"recent_arc"`
AllArc int32 `json:"all_arc"`
} `json:"rank_attr"`
Dynamic struct {
Main int32 `json:"main"`
} `json:"dynamic_attr"`
Recommend struct {
Main int32 `json:"main"`
} `json:"recommend_attr"`
Show struct {
Main int32 `json:"main"`
Mobile int32 `json:"mobile"`
Web int32 `json:"web"`
Oversea int32 `json:"oversea"`
Online int32 `json:"online"`
}
}
// Convert convert db value into attr.
func (f *ForbidAttr) Convert() {
// rank
f.Rank.Main = f.RankV & 1
f.Rank.RecentArc = (f.RankV >> 1) & 1
f.Rank.AllArc = (f.RankV >> 2) & 1
// dynamic
f.Dynamic.Main = f.DynamicV & 1
// recommend
f.Recommend.Main = f.RecommendV & 1
// show
f.Show.Main = f.ShowV & 1
f.Show.Mobile = (f.ShowV >> 1) & 1
f.Show.Web = (f.ShowV >> 2) & 1
f.Show.Oversea = (f.ShowV >> 3) & 1
f.Show.Online = (f.ShowV >> 4) & 1
}
// SetAttr set forbid attr.
func (f *ForbidAttr) SetAttr(name string, v int32, bit uint) (change bool) {
if name == ForbidRank {
old := f.RankV
f.RankV = f.RankV&(^(1 << bit)) | (v << bit)
change = old == f.RankV
} else if name == ForbidDynamic {
old := f.DynamicV
f.DynamicV = f.DynamicV&(^(1 << bit)) | (v << bit)
change = old == f.DynamicV
} else if name == ForbidRecommend {
old := f.RecommendV
f.RecommendV = f.RecommendV&(^(1 << bit)) | (v << bit)
change = old == f.RecommendV
} else if name == ForbidShow {
old := f.ShowV
f.ShowV = f.ShowV&(^(1 << bit)) | (v << bit)
change = old == f.ShowV
}
return
}

View File

@@ -0,0 +1,7 @@
package archive
//archive_oper last_id
const (
FirstRoundID = int64(1)
ZeroID = int64(0)
)

View File

@@ -0,0 +1,20 @@
package archive
const (
// PoolForFirst 一审
PoolForFirst = int8(0)
// PoolForSecond 二审
PoolForSecond = int8(1)
// SubjectForNormal 普通任务
SubjectForNormal = int8(0)
// SubjectForTask 指派任务
SubjectForTask = int8(1)
// StateForTaskDefault 初始化状态(未认领)
StateForTaskDefault = int8(0)
// StateForTaskWork 已认领,未处理
StateForTaskWork = int8(1)
// StateForTaskDelay 延迟审核
StateForTaskDelay = int8(3)
// StateForTaskUserDeleted 被释放
StateForTaskUserDeleted = int8(6)
)

View File

@@ -0,0 +1,44 @@
package archive
const (
// Donghua 动画
Donghua = int16(1)
// Music 音乐
Music = int16(3)
// Game 游戏
Game = int16(4)
// Ent 娱乐
Ent = int16(5)
// Tv 电视剧
Tv = int16(11)
// Bangumi 番剧
Bangumi = int16(13)
// Movie 电影
Movie = int16(23)
// Tech 科技
Tech = int16(36)
// Kichiku 鬼畜
Kichiku = int16(119)
// Dance 舞蹈
Dance = int16(129)
// Fashion 时尚
Fashion = int16(155)
// Life 生活
Life = int16(160)
// Ad 广告
Ad = int16(165)
// Guochuang 国创
Guochuang = int16(167)
// Filmwithtele 影视
Filmwithtele = int16(181)
// Documentary 纪录片
Documentary = int16(177)
)
// Type info
type Type struct {
ID int16 `json:"id"`
PID int16 `json:"pid"`
Name string `json:"name"`
Desc string `json:"description"`
}

View File

@@ -0,0 +1,130 @@
package archive
import (
xtime "go-common/library/time"
)
const (
// VideoUploadInfo 视频上传完成
VideoUploadInfo = int8(0)
// VideoXcodeSDFail 视频转码失败
VideoXcodeSDFail = int8(1)
// VideoXcodeSDFinish 一转完成
VideoXcodeSDFinish = int8(2)
// VideoXcodeHDFail 二转失败
VideoXcodeHDFail = int8(3)
// VideoXcodeHDFinish 二转完成
VideoXcodeHDFinish = int8(4)
// VideoDispatchRunning 正在分发
VideoDispatchRunning = int8(5)
// VideoDispatchFinish 分发完成
VideoDispatchFinish = int8(6)
// VideoStatusOpen 视频开放浏览
VideoStatusOpen = int16(0)
// VideoStatusAccess 视频会员可见
VideoStatusAccess = int16(10000)
// VideoStatusWait 视频待审
VideoStatusWait = int16(-1)
// VideoStatusRecicle 视频被打回
VideoStatusRecicle = int16(-2)
// VideoStatusLock 视频被锁定
VideoStatusLock = int16(-4)
// VideoStatusXcodeFail 视频转码失败
VideoStatusXcodeFail = int16(-16)
// VideoStatusSubmit 视频创建已提交
VideoStatusSubmit = int16(-30)
// VideoStatusDelete 视频被删除
VideoStatusDelete = int16(-100)
// XcodeFailZero 转码失败
XcodeFailZero = 0
// SrcTypeForVupload 合作方嵌套
SrcTypeForVupload = "vupload"
// SrcTypeForQQ 腾讯视频
SrcTypeForQQ = "qq"
// SrcTypeForHunan 湖南
SrcTypeForHunan = "hunan"
// SrcTypeForSohu 搜狐
SrcTypeForSohu = "sohu"
)
var (
// XcodeFailCodes is bvc message mapping int value.
//http://git.bilibili.co/bili_xcode/bili_xcode_docs/blob/master/%E7%B3%BB%E7%BB%9F%E6%95%B0%E6%8D%AE/%E8%BD%AC%E7%A0%81%E9%94%99%E8%AF%AF%E5%8E%9F%E5%9B%A0.md
XcodeFailCodes = map[string]int8{
"FileDataUnrecognized": 1, // 上传文件不是视频
"VideoTrackAbsent": 2, // 没有视频轨
"AudioTrackAbsent": 3, // 没有音频轨
"VideoTrackEmpty": 4, // 视频轨无有效内容
"AudioTrackEmpty": 5, // 音频轨无有效内容
"DurationOverflow": 6, // 视频过长
"VideoTooNarrow": 7, // 画面太窄
"VideoTooFlat": 8, // 画面太扁
"DataCorrupted": 9, // 文件损坏
"WatermarkDownloadFail": 10, // 水印图片损坏
"DurationUnderflow": 11, // 可检测到的时长不足一秒
"StreamDataCorrupted": 12, // 文件编码数据错误
"IncorrectDataPackaging": 13, // 文件的封包数据错误
"UntolerableTimestampJump": 14, // 文件中时间戳有跳变
"UntolerableTimestampStretch": 15, // 文件中时间戳异常
"AACDataCorrupted": 16, // AAC音频数据错误
}
// XcodeFailMsgs is int value mapping comment.
XcodeFailMsgs = map[int8]string{
1: "文件格式错误,请检查是否上传了错误文件并尝试重新上传",
2: "无视频轨,请补充视频轨并重新压制上传",
3: "无音频轨,请补充音频轨并重新压制上传",
4: "视频轨无有效内容,请补充缺失的视频数据重新压制上传",
5: "音频轨无有效内容,请补充缺失的音频数据重新压制上传",
6: "单个视频时长超过10小时请剪辑后通过分P上传",
7: "视频画面过窄,请纵向裁剪视频后重新上传",
8: "视频画面过扁,请横向裁剪视频后重新上传",
9: "视频数据有误,请重新编码后重新上传",
10: "水印图片损坏",
11: "单个视频时长不足1秒请检查视频时长并尝试重新上传",
12: "文件编码数据错误",
13: "文件封包数据错误,请重新压制后上传",
14: "视频时间戳有异常,请修正后重新压制上传",
15: "视频时间戳有异常,请检查音视频数据并重新压制上传",
16: "AAC音频数据错误请重新使用AAC编码后上传",
}
)
// Video is archive_video model.
type Video struct {
ID int64
Filename string
Cid int64
Aid int64
Title string
Desc string
SrcType string
Duration int64
Filesize int64
Resolutions string
Playurl string
FailCode int8
Index int
Attribute int32
XcodeState int8
Status int16
WebLink string
Dimensions string
CTime xtime.Time
MTime xtime.Time
}
//AuditParam is from video audit
type AuditParam struct {
IsAudit bool
}
// AttrVal get attribute value.
func (v *Video) AttrVal(bit uint) int32 {
return (v.Attribute >> bit) & int32(1)
}
// AttrSet set attribute value.
func (v *Video) AttrSet(vl int32, bit uint) {
v.Attribute = v.Attribute&(^(1 << bit)) | (vl << bit)
}

View File

@@ -0,0 +1,28 @@
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = ["manager.go"],
importpath = "go-common/app/job/main/videoup/model/manager",
tags = ["automanaged"],
visibility = ["//visibility:public"],
)
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,28 @@
package manager
// upper type.
const (
UpperTypeWhite int8 = 1
UpperTypeBlack int8 = 2
UpperTypePGC int8 = 3
UpperTypeUGCX int8 = 3
UpperTypePolitices int8 = 5
UpperTypeEnterprise int8 = 7
UpperTypeSigned int8 = 15
)
// first round audit result for video.
const (
FirstRoundLock int16 = -4 //锁定
FirstRoundRejectBack int16 = -2 //打回
FirstRoundWait int16 = -1 //待审
FirstRoundOpen int16 = 0 //开放
FirstRoundLoginOpen int16 = 10000 //会员开放(需登录非VIP)
)
//User user info
type User struct {
ID int `json:"uid"`
Username string `json:"username"`
Department string `json:"department"`
}

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 = ["message.go"],
importpath = "go-common/app/job/main/videoup/model/message",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = ["//app/job/main/videoup/model/archive: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,114 @@
package message
import (
"encoding/json"
"go-common/app/job/main/videoup/model/archive"
)
//RouteVideocovers routes.
const (
// bvc
RouteVideocovers = "videocovers"
RouteBFSVideocovers = "bfs_videocovers"
RouteUploadInfo = "upload_info"
RouteXcodeSdFinish = "xcode_sd_finish"
RouteXcodeSDFail = "xcode_sd_fail"
RouteXcodeHDFinish = "xcode_hd_finish"
RouteXcodeHDFail = "xcode_hd_fail"
RouteDispatchRunning = "dispatch_running"
RouteDispatchFinish = "dispatch_finish"
RouteVideoshotpv = "bfs_videoshotpv"
// videoup
RouteSyncCid = "sync_cid"
RouteFirstRound = "first_round"
RouteUGCFirstRound = "ugc_first_round"
RouteSecondRound = "second_round"
RouteAddArchive = "add_archive"
RouteModifyArchive = "modify_archive"
RouteModifyVideo = "modify_video"
RouteDeleteArchive = "delete_archive"
RouteDeleteVideo = "delete_video"
RouteDelayOpen = "delay_open"
RouteAutoOpen = "auto_open"
RouteForceSync = "force_sync"
RouteFirstRoundForbid = "first_round_forbid"
RoutePostFirstRound = "post_first_round"
// bvc video_capable
CanPlay = 0
CanNotPlay = 1
)
// BvcVideo from bvc video info.
type BvcVideo struct {
Route string `json:"route"`
Filename string `json:"filename"`
Timestamp int64 `json:"timestamp"`
// covers
Count int `json:"count,omitempty"`
URLFormat string `json:"url_format,omitempty"`
Deadline int64 `json:"deadline,omitempty"`
// video
Filesize int64 `json:"filesize,omitempty"`
Duration int64 `json:"duration,omitempty"`
Width int64 `json:"width,omitempty"`
Height int64 `json:"height,omitempty"`
Rotate int8 `json:"rotate,omitempty"`
PlayURL string `json:"playurl,omitempty"`
FailInfo string `json:"failinfo,omitempty"`
Resolutions string `json:"resolutions,omitempty"`
BinURL string `json:"bin_url"`
ImgURLs []string `json:"img_urls"`
}
// ArcResult archive result databus message
type ArcResult struct {
Action string `json:"action"`
Table string `json:"table"`
New json.RawMessage `json:"new"`
Old json.RawMessage `json:"old"`
}
// Videoup from videoup api.
type Videoup struct {
Route string `json:"route"`
Filename string `json:"filename"`
Timestamp int64 `json:"timestamp"`
// cid
Cid int64 `json:"cid,omitempty"`
// encode
Xcode int8 `json:"xcode,omitempty"`
EncodePurpose string `json:"encode_purpose,omitempty"`
EncodeRegionID int16 `json:"encode_region_id,omitempty"`
Status int16 `json:"status,omitempty"`
// modify archive
Aid int64 `json:"aid,omitempty"`
EditArchive bool `json:"edit_archive,omitempty"`
EditVideo bool `json:"edit_video,omitempty"`
// second_round
Reply int `json:"reply,omitempty"`
IsSendNotify bool `json:"send_notify,omitempty"`
// ChangeTypeID
ChangeTypeID bool `json:"change_typeid,omitempty"`
// ChangeCopyright
ChangeCopyright bool `json:"change_copyright,omitempty"`
// ChangeCover
ChangeCover bool `json:"change_cover,omitempty"`
// ChangeTitle
ChangeTitle bool `json:"change_title,omitempty"`
MissionID int64 `json:"mission_id,omitempty"`
AdminChange bool `json:"admin_change,omitempty"`
}
// BlogCardMsg 粉丝动态databus消息
type BlogCardMsg struct {
Card *archive.BlogCard `json:"card"`
}
// StatMsg from archive stat.
type StatMsg struct {
Type string
ID int64
Count int
Timestamp int64
}

View File

@@ -0,0 +1,28 @@
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = ["redis.go"],
importpath = "go-common/app/job/main/videoup/model/redis",
tags = ["automanaged"],
visibility = ["//visibility:public"],
)
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,30 @@
package redis
//redis action list
const (
// ActionForDispatchFinish = "dispatchFinish"
// ActionForModifyArchive = "modifyArchive"
ActionForBvcCapable = "bvcCapable"
// ActionForSecondRound = "secondRound"
ActionForSendOpenMsg = "sendOpenMsg"
ActionForSendBblog = "sendBblog"
ActionForVideoshot = "addVideoshot"
ActionForVideocovers = "addVideocovers"
ActionForPostFirstRound = "postFirstRound"
)
//Retry struct
type Retry struct {
Action string `json:"action"`
}
//RetryJSON struct
type RetryJSON struct {
Action string `json:"action"`
Data struct {
Aid int64 `json:"aid"`
Route string `json:"route"`
Mid int64 `json:"mid"`
Content string `json:"content"`
} `json:"data"`
}