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,35 @@
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = [
"archive.go",
"lbs.go",
"param.go",
"staff.go",
"video.go",
],
importpath = "go-common/app/interface/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,165 @@
package archive
import (
"go-common/library/time"
)
// State + Attr + Copyright + Upfrom
const (
// open state
StateOpen = int8(0)
StateOrange = int8(1)
// forbit state
StateForbidWait = int8(-1)
StateForbidRecicle = int8(-2)
StateForbidPolice = int8(-3)
StateForbidLock = int8(-4)
StateForbidFackLock = int8(-5)
StateForbidFixed = int8(-6)
StateForbidLater = int8(-7)
// StateForbidPatched = int8(-8)
StateForbidWaitXcode = int8(-9)
StateForbidAdminDelay = int8(-10)
StateForbidFixing = int8(-11)
// StateForbidStorageFail = int8(-12)
StateForbidOnlyComment = int8(-13)
// StateForbidTmpRecicle = int8(-14)
StateForbidDispatch = int8(-15)
StateForbidXcodeFail = int8(-16)
StateForbidSubmit = int8(-30)
StateForbidUserDelay = int8(-40)
StateForbidUpDelete = int8(-100)
// attribute yes and no
AttrYes = int32(1)
AttrNo = int32(0)
// attribute bit
AttrBitNoRank = uint(0)
AttrBitNoIndex = uint(1)
AttrBitNoWeb = uint(2)
AttrBitNoMobile = uint(3)
AttrBitNoSearch = uint(4)
AttrBitOverseaLock = uint(5)
AttrBitNoRecommend = uint(6)
// AttrBitHideCoins = uint(7)
AttrBitHasHD5 = uint(8)
// AttrBitVisitorDm = uint(9)
AttrBitAllowBp = uint(10)
AttrBitIsBangumi = uint(11)
// AttrBitAllowDownload = uint(12)
AttrBitHideClick = uint(13)
AttrBitAllowTag = uint(14)
AttrBitIsFromArcAPI = uint(15)
AttrBitJumpURL = uint(16)
AttrBitIsMovie = uint(17)
AttrBitBadgepay = uint(18)
AttrBitStaff = uint(24) //联合投稿
// copyright state
CopyrightUnknow = int8(0)
CopyrightOriginal = int8(1)
CopyrightCopy = int8(2)
//up_from
UpFromWeb = int8(0)
UpFromPGC = int8(1)
UpFromWindows = int8(2)
UpFromAPP = int8(3)
UpFromMAC = int8(4)
UpFromSecretPGC = int8(5)
UpFromCoopera = int8(6)
UpFromCreator = int8(7) // 创作姬
UpFromAPPAndroid = int8(8) // 安卓主APP
UpFromAPPiOS = int8(9) // iOS主APP
UpFromCM = int8(10) // Web商单用户投稿
UpFromIpad = int8(11) // ipad投稿的用户
AdvertisingTypeID = 166 // 广告分区的typeid
)
var (
_copyright = map[int8]int8{
CopyrightUnknow: CopyrightUnknow,
CopyrightOriginal: CopyrightOriginal,
CopyrightCopy: CopyrightCopy,
}
)
// InCopyrights check copyright in all copyrights.
func InCopyrights(cp int8) (ok bool) {
_, ok = _copyright[cp]
return
}
// Archive is archive model.
type Archive struct {
Aid int64 `json:"aid"`
Mid int64 `json:"mid"`
TypeID int16 `json:"tid"`
// HumanRank int `json:"-"`
Title string `json:"title"`
Author string `json:"author"`
Cover string `json:"cover"`
Tag string `json:"tag"`
Duration int64 `json:"duration"`
Copyright int8 `json:"copyright"`
Source string `json:"source"`
NoReprint int8 `json:"no_reprint"`
UgcPay int8 `json:"ugcpay"`
OrderID int64 `json:"order_id"`
Desc string `json:"desc"`
MissionID int `json:"mission_id"`
// Round int8 `json:"-"`
// Forward int64 `json:"-"`
Attribute int32 `json:"attribute"`
// Access int16 `json:"-"`
// desc_format
DescFormatID int `json:"desc_format_id,omitempty"`
State int8 `json:"state"`
StateDesc string `json:"state_desc"`
// dynamic
Dynamic string `json:"dynamic"`
Porder *Porder `json:"porder"`
// time
DTime time.Time `json:"dtime"`
PTime time.Time `json:"ptime"`
CTime time.Time `json:"ctime"`
// MTime time.Time `json:"-"`
}
// NotAllowUp check archive is or not allow update state.
func (a *Archive) NotAllowUp() bool {
return a.State == StateForbidUpDelete || a.State == StateForbidLock || a.State == StateForbidPolice
}
// AttrVal get attribute.
func (a *Archive) AttrVal(bit uint) int32 {
return (a.Attribute >> bit) & int32(1)
}
// Type type from archive
type Type struct {
ID int16 `json:"id"`
PID int16 `json:"pid"`
Name string `json:"name"`
Description string `json:"description"`
}
// DescFormat str
type DescFormat struct {
ID int `json:"id"`
TypeID int16 `json:"typeid"`
Copyright int8 `json:"copyright"`
Lang int8 `json:"lang"`
}
// FilterData filter-service data
type FilterData struct {
Level int64 `json:"level"`
Limit int64 `json:"limit"`
Msg string `json:"msg"`
TypeID []int64 `json:"typeid"`
Hit []string `json:"hit"`
}
// PayAsset str
type PayAsset struct {
Price int `json:"price"`
PlatformPrice map[string]int `json:"platform_price"`
}

View File

@ -0,0 +1,35 @@
package archive
// PoiObj str
type PoiObj struct {
POI string `json:"poi"`
Type int32 `json:"type"`
Addr string `json:"address"`
ShowTitle string `json:"show_title"`
Title string `json:"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,232 @@
package archive
import (
"go-common/library/time"
)
// ArchiveAddLogID
const (
// ArchiveAddLogID 投稿日志
ArchiveAddLogID = int(81)
// UgcpayAddarcProtocol ugc新增稿件时候记录的协议版本
UgcpayAddarcProtocol = int(83)
// LogTypeSuccess 投稿成功
LogTypeSuccess = int(0)
// LogTypeFail 投稿失败
LogTypeFail = int(1)
)
// AppRequest str
type AppRequest struct {
MobiApp string
Platform string
Build string
Device string
}
// ArcParam str
type ArcParam struct {
Aid int64 `json:"aid"`
Mid int64 `json:"mid"`
Author string `json:"author"`
TypeID int16 `json:"tid"`
Title string `json:"title"`
Cover string `json:"cover"`
Tag string `json:"tag"`
Copyright int8 `json:"copyright"`
NoReprint int8 `json:"no_reprint"`
OrderID int64 `json:"order_id"`
Desc string `json:"desc"`
Source string `json:"source"`
Attribute int32 `json:"-"` // NOTE: not allow user
OpenElec int8 `json:"open_elec"`
MissionID int `json:"mission_id"`
FromIP int64 `json:"from_ip"`
IPv6 []byte `json:"ipv6"`
UpFrom int8 `json:"up_from"`
BizFrom int8 `json:"biz_from"`
DTime time.Time `json:"dtime"`
Videos []*VideoParam `json:"videos"`
Body string `json:"body,omitempty"`
CodeMode bool `json:"code_mode,omitempty"`
DescFormatID int `json:"desc_format_id,omitempty"`
Dynamic string `json:"dynamic,omitempty"`
Porder *Porder `json:"porder"`
Lang string `json:"lang"`
Watermark *Watermark `json:"watermark"`
Geetest *Geetest `json:"geetest"`
LotteryID int64 `json:"lottery_id"`
Subtitle *Subtitle `json:"subtitle"`
Pay *Pay `json:"pay"`
UgcPay int8 `json:"ugcpay"` // videoup-service 需要按照这个字段转成attribute
FollowMids []int64 `json:"follow_mids"`
PoiObj *PoiObj `json:"poi_object"`
Staffs []*Staff `json:"staffs"`
HandleStaff bool `json:"handle_staff"`
Vote *Vote `json:"vote"`
}
// Vote str
type Vote struct {
VoteID int64 `json:"vote_id"`
VoteTitle string `json:"vote_title"`
}
// Pay str
type Pay struct {
Open int8 `json:"open"`
Price int `json:"price"`
ProtocolID string `json:"protocol_id"`
ProtocolAccept int8 `json:"protocol_accept"`
RefuseUpdate bool `json:"-"`
}
// Subtitle str only for web add and edit
type Subtitle struct {
Open int8 `json:"open"`
Lan string `json:"lan"`
}
// Geetest str
type Geetest struct {
Challenge string `json:"challenge"`
Validate string `json:"validate"`
Seccode string `json:"seccode"`
Success int `json:"success"`
}
// Watermark str
type Watermark struct {
State int8 `json:"state"`
Ty int8 `json:"type"`
Pos int8 `json:"position"`
}
// Porder str
// new porder, ads provoder
type Porder struct {
FlowID uint `json:"flow_id"` // 0/1 是否确实参加了广告平台
IndustryID int64 `json:"industry_id"` // 2 (游戏)
BrandName string `json:"brand_name"` // FGO游戏
BrandID int64 `json:"brand_id"` // 2
Official int8 `json:"official"` // 0/1
ShowType string `json:"show_type"` // 2,3,4
}
// VideoParam str
type VideoParam struct {
Title string `json:"title"`
Desc string `json:"desc"`
Filename string `json:"filename"`
Cid int64 `json:"cid"`
Sid int64 `json:"sid"`
Editor *Editor `json:"editor"`
}
// Editor str
type Editor struct {
CID int64 `json:"cid"`
UpFrom int8 `json:"upfrom"` // filled by backend
// ids set
Filters interface{} `json:"filters"` // 滤镜
Fonts interface{} `json:"fonts"` //字体
Subtitles interface{} `json:"subtitles"` //字幕
Bgms interface{} `json:"bgms"` //bgm
Stickers interface{} `json:"stickers"` //3d拍摄贴纸
VideoupStickers interface{} `json:"videoup_stickers"` //2d投稿贴纸
Transitions interface{} `json:"trans"` //视频转场特效
// add from app535
Themes interface{} `json:"themes"` //编辑器的主题使用相关
Cooperates interface{} `json:"cooperates"` //拍摄之稿件合拍
// switch env 0/1
AudioRecord int8 `json:"audio_record"` //录音
Camera int8 `json:"camera"` //拍摄
Speed int8 `json:"speed"` //变速
CameraRotate int8 `json:"camera_rotate"` //摄像头翻转
// count from app536
PicCount uint16 `json:"pic_count"` // 图片个数
VideoCount uint16 `json:"video_count"` // 视频个数
}
// VideoExpire str
type VideoExpire struct {
Filename string `json:"filename"`
Expire int64 `json:"expire"`
}
// CreatorParam struct
type CreatorParam struct {
Aid int64 `form:"aid" validate:"required"`
Title string `form:"title" validate:"required"`
Desc string `form:"desc" validate:"required"`
Tag string `form:"tag" validate:"required"`
OpenElec int8 `form:"open_elec"`
Build string `form:"build" validate:"required"`
Platform string `form:"platform" validate:"required"`
}
// Staff 稿件提交时的联合投稿人
type Staff struct {
Title string `json:"title"`
Mid int64 `json:"mid"`
}
// StaffView Archive staff
type StaffView struct {
ID int64 `json:"id"`
ApMID int64 `json:"apply_staff_mid"`
ApTitle string `json:"apply_title"`
ApAID int64 `json:"apply_aid"`
ApType int `json:"apply_type"`
ApState int `json:"apply_state"`
ApStaffID int64 `json:"apply_asid"` //Staff表的主键ID
StaffState int `json:"staff_state"`
StaffTitle string `json:"staff_title"`
}
// ForbidMultiVideoType fun
// 欧美电影,日本电影,国产电影,其他国家
func (ap *ArcParam) ForbidMultiVideoType() bool {
return ap.TypeID == 145 || ap.TypeID == 146 || ap.TypeID == 147 || ap.TypeID == 83
}
// ForbidAddVideoType fun
// 连载剧集15 完结剧集34 电视剧相关128 电影相关82
func (ap *ArcParam) ForbidAddVideoType() bool {
return ap.TypeID == 15 || ap.TypeID == 34 || ap.TypeID == 128 || ap.TypeID == 82
}
// ForbidCopyrightAndTypes fun
// // 32 完结动画; 33 连载动画
func (ap *ArcParam) ForbidCopyrightAndTypes() bool {
return (ap.Copyright == CopyrightOriginal) && (ap.TypeID == 32 || ap.TypeID == 33)
}
// EmptyVideoEditInfo fn
func (ap *ArcParam) EmptyVideoEditInfo() {
if (ap.UpFrom != UpFromAPPiOS) && (ap.UpFrom != UpFromAPPAndroid) {
for _, v := range ap.Videos {
v.Editor = nil
}
}
}
// NilPoiObj fn
func (ap *ArcParam) NilPoiObj() {
if (ap.UpFrom != UpFromAPPiOS) && (ap.UpFrom != UpFromAPPAndroid) {
ap.PoiObj = nil
}
}
// DisableVideoDesc fn
func (ap *ArcParam) DisableVideoDesc(vs []*Video) {
nvsMap := make(map[string]string)
for _, v := range vs {
nvsMap[v.Filename] = v.Desc
}
for _, pv := range ap.Videos {
if nvFilename, ok := nvsMap[pv.Filename]; ok {
pv.Desc = nvFilename
}
}
}

View File

@ -0,0 +1,7 @@
package archive
//联合投稿的分区配置
type StaffTypeConf struct {
TypeID int16 `json:"typeid"`
MaxStaff int `json:"max_staff"`
}

View File

@ -0,0 +1,47 @@
package archive
import "go-common/library/time"
// VideoStatus
const (
VideoUploadInfo = int8(0)
VideoXcodeSDFail = int8(1)
VideoXcodeSDFinish = int8(2)
VideoXcodeHDFail = int8(3)
VideoXcodeHDFinish = int8(4)
VideoDispatchRunning = int8(5)
VideoDispatchFinish = int8(6)
VideoStatusOpen = int16(0)
VideoStatusAccess = int16(10000)
VideoStatusWait = int16(-1)
VideoStatusRecicle = int16(-2)
VideoStatusLock = int16(-4)
VideoStatusXcodeFail = int16(-16)
VideoStatusSubmit = int16(-30)
VideoStatusDelete = int16(-100)
XcodeFailZero = 0
)
// Video is archive_video model.
type Video struct {
// ID int64 `json:"-"`
Aid int64 `json:"aid"`
Title string `json:"title"`
Desc string `json:"desc"`
Filename string `json:"filename"`
// SrcType string `json:"-"`
// Cid int64 `json:"-"`
// Duration int64 `json:"-"`
// Filesize int64 `json:"-"`
// Resolutions string `json:"-"`
Index int `json:"index"`
// Playurl string `json:"-"`
Status int16 `json:"status"`
StatusDesc string `json:"status_desc"`
FailCode int8 `json:"fail_code"`
FailDesc string `json:"fail_desc"`
// XcodeState int8 `json:"-"`
// Attribute int32 `json:"-"`
CTime time.Time `json:"ctime"`
// MTime time.Time `json:"-"`
}

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 = ["geetest.go"],
importpath = "go-common/app/interface/main/videoup/model/geetest",
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,12 @@
package geetest
type ProcessRes struct {
Success int8 `json:"success"`
CaptchaID string `json:"gt"`
Challenge string `json:"challenge"`
NewCaptcha int `json:"new_captcha"`
}
type ValidateRes struct {
Seccode string `json:"seccode"`
}

View File

@ -0,0 +1,27 @@
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
package(default_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"],
)
go_library(
name = "go_default_library",
srcs = ["mission.go"],
importpath = "go-common/app/interface/main/videoup/model/mission",
tags = ["automanaged"],
)

View File

@ -0,0 +1,21 @@
package mission
import "time"
type Mission struct {
ID int `json:"id"`
Name string `json:"name"`
Tags string `json:"tags"`
ETime time.Time `json:"etime"`
}
// ActInfo act proctocol & tag.
type ActInfo struct {
ID string `json:"id"`
SID string `json:"sid"`
Protocol string `json:"protocol"`
Types string `json:"types"`
Tag string `json:"tags"`
CTime string `json:"ctime"`
MTime string `json:"mtime"`
}

View File

@ -0,0 +1,27 @@
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
package(default_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"],
)
go_library(
name = "go_default_library",
srcs = ["porder.go"],
importpath = "go-common/app/interface/main/videoup/model/porder",
tags = ["automanaged"],
)

View File

@ -0,0 +1,20 @@
package porder
// OfficialIndustryMaps map
var OfficialIndustryMaps = map[int64]int64{
1: 1,
}
// Config str
type Config struct {
ID int64 `json:"id"`
Tp int8 `json:"type"`
Name string `json:"name"`
}
// Game str
type Game struct {
GameBaseID int64 `json:"game_base_id"`
GameName string `json:"game_name"`
Source int8 `json:"source"`
}