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,17 @@
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [
":package-srcs",
"//app/service/main/archive/model/archive:all-srcs",
"//app/service/main/archive/model/videoshot:all-srcs",
],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)

View File

@@ -0,0 +1,69 @@
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",
)
go_library(
name = "go_default_library",
srcs = [
"addit.go",
"archive.go",
"pgc.go",
"report_result.go",
"rpc.go",
"rpc2.go",
],
embed = [":archive_go_proto"],
importpath = "go-common/app/service/main/archive/model/archive",
tags = ["automanaged"],
deps = [
"//app/service/main/archive/api:go_default_library",
"//library/time:go_default_library",
"@com_github_gogo_protobuf//gogoproto:go_default_library",
"@com_github_golang_protobuf//proto:go_default_library",
],
)
proto_library(
name = "archive_proto",
srcs = [
"archive.proto",
"bvc.proto",
],
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = ["@gogo_special_proto//github.com/gogo/protobuf/gogoproto"],
)
go_proto_library(
name = "archive_go_proto",
compilers = ["@io_bazel_rules_go//proto:gogofast_proto"],
importpath = "go-common/app/service/main/archive/model/archive",
proto = ":archive_proto",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = [
"//library/time:go_default_library",
"@com_github_gogo_protobuf//gogoproto: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,13 @@
package archive
// Addit id,aid,source,redirect_url,description
type Addit struct {
ID int64
Aid int64
Source string
RedirectURL string
MissionID int64
UpFrom int8
OrderID int
Description string
}

View File

@@ -0,0 +1,328 @@
package archive
import (
"go-common/app/service/main/archive/api"
"go-common/library/time"
)
// 各属性地址见 http://syncsvn.bilibili.co/platform/doc/blob/master/archive/field/state.md
// all const
const (
// open state
StateOpen = 0
StateOrange = 1
AccessMember = int32(10000)
// forbid state
StateForbidWait = -1
StateForbidRecicle = -2
StateForbidPolice = -3
StateForbidLock = -4
StateForbidFixed = -6
StateForbidLater = -7
StateForbidAdminDelay = -10
StateForbidXcodeFail = -16
StateForbidSubmit = -30
StateForbidUserDelay = -40
StateForbidUpDelete = -100
// copyright
CopyrightUnknow = int8(0)
CopyrightOriginal = int8(1)
CopyrightCopy = int8(2)
// attribute yes and no
AttrYes = int32(1)
AttrNo = int32(0)
// attribute bit
AttrBitNoRank = uint(0)
AttrBitNoDynamic = uint(1)
AttrBitNoWeb = uint(2)
AttrBitNoMobile = uint(3)
// AttrBitNoSearch = uint(4)
AttrBitOverseaLock = uint(5)
AttrBitNoRecommend = uint(6)
AttrBitNoReprint = uint(7)
AttrBitHasHD5 = uint(8)
AttrBitIsPGC = uint(9)
AttrBitAllowBp = uint(10)
AttrBitIsBangumi = uint(11)
AttrBitIsPorder = uint(12)
AttrBitLimitArea = uint(13)
AttrBitAllowTag = uint(14)
// AttrBitIsFromArcApi = uint(15)
AttrBitJumpUrl = uint(16)
AttrBitIsMovie = uint(17)
AttrBitBadgepay = uint(18)
AttrBitUGCPay = uint(22)
AttrBitHasBGM = uint(23)
AttrBitIsCooperation = uint(24)
AttrBitHasViewpoint = uint(25)
AttrBitHasArgument = uint(26)
)
var (
_emptyTags = []string{}
)
// AidPubTime aid's pubdate and copyright
type AidPubTime struct {
Aid int64 `json:"aid"`
PubDate time.Time `json:"pubdate"`
Copyright int8 `json:"copyright"`
}
// ArchiveWithPlayer with first player info
type ArchiveWithPlayer struct {
*Archive3
PlayerInfo *PlayerInfo `json:"player_info,omitempty"`
}
// ArchiveWithBvc with first player info
type ArchiveWithBvc struct {
*Archive3
PlayerInfo *BvcVideoItem `json:"player_info,omitempty"`
}
// PlayerInfo player info
type PlayerInfo struct {
Cid int64 `json:"cid"`
ExpireTime int64 `json:"expire_time,omitempty"`
FileInfo map[int][]*PlayerFileInfo `json:"file_info"`
SupportQuality []int `json:"support_quality"`
SupportFormats []string `json:"support_formats"`
SupportDescription []string `json:"support_description"`
Quality int `json:"quality"`
URL string `json:"url,omitempty"`
VideoCodecid uint32 `json:"video_codecid"`
VideoProject bool `json:"video_project"`
Fnver int `json:"fnver"`
Fnval int `json:"fnval"`
Dash *ResponseDash `json:"dash,omitempty"`
}
// PlayerFileInfo is
type PlayerFileInfo struct {
TimeLength int64 `json:"timelength"`
FileSize int64 `json:"filesize"`
Ahead string `json:"ahead,omitempty"`
Vhead string `json:"vhead,omitempty"`
URL string `json:"url,omitempty"`
Order int64 `json:"order,omitempty"`
}
// ArcType arctype
type ArcType struct {
ID int16 `json:"id"`
Pid int16 `json:"pid"`
Name string `json:"name"`
}
// Videoshot videoshot
type Videoshot struct {
PvData string `json:"pvdata"`
XLen int `json:"img_x_len"`
YLen int `json:"img_y_len"`
XSize int `json:"img_x_size"`
YSize int `json:"img_y_size"`
Image []string `json:"image"`
Attr int32 `json:"-"`
}
// RankArchives3 RankArchives3
type RankArchives3 struct {
Archives []*api.Arc `json:"archives"`
Count int `json:"count"`
}
// LikedArchives3 LikedArchives3
type LikedArchives3 struct {
Archives []*Archive3 `json:"archives"`
Count int64
}
// RegionArc RegionArc
type RegionArc struct {
Aid int64
Attribute int32
Copyright int8
PubDate time.Time
}
// IsNormal is
func (a *Archive3) IsNormal() bool {
return a.State >= StateOpen || a.State == StateForbidFixed
}
// AttrVal get attr val by bit.
func (a *Archive3) AttrVal(bit uint) int32 {
return (a.Attribute >> bit) & int32(1)
}
func (ra *RegionArc) attrVal(bit uint) int32 {
return (ra.Attribute >> bit) & int32(1)
}
type PGCPlayer struct {
PlayerInfo *PlayerInfo `json:"player_info"`
Aid int64 `json:"aid"`
}
// BuildArchive3 build Archive3 with new proto
func BuildArchive3(a *api.Arc) (arc *Archive3) {
if a == nil {
return nil
}
arc = &Archive3{
Aid: a.Aid,
Videos: a.Videos,
TypeID: a.TypeID,
TypeName: a.TypeName,
Copyright: a.Copyright,
Pic: a.Pic,
Title: a.Title,
PubDate: a.PubDate,
Ctime: a.Ctime,
Desc: a.Desc,
State: a.State,
Access: a.Access,
Attribute: a.Attribute,
Duration: a.Duration,
MissionID: a.MissionID,
OrderID: a.OrderID,
RedirectURL: a.RedirectURL,
Forward: a.Forward,
Rights: Rights3{
Bp: a.Rights.Bp,
Elec: a.Rights.Elec,
Download: a.Rights.Download,
Movie: a.Rights.Movie,
Pay: a.Rights.Pay,
HD5: a.Rights.HD5,
NoReprint: a.Rights.NoReprint,
Autoplay: a.Rights.Autoplay,
UGCPay: a.Rights.UGCPay,
IsCooperation: a.Rights.IsCooperation,
},
Author: Author3{
Mid: a.Author.Mid,
Name: a.Author.Name,
Face: a.Author.Face,
},
Stat: Stat3{
Aid: a.Stat.Aid,
View: a.Stat.View,
Danmaku: a.Stat.Danmaku,
Reply: a.Stat.Reply,
Fav: a.Stat.Fav,
Coin: a.Stat.Coin,
Share: a.Stat.Share,
NowRank: a.Stat.NowRank,
HisRank: a.Stat.HisRank,
Like: a.Stat.Like,
DisLike: a.Stat.DisLike,
},
ReportResult: a.ReportResult,
Dynamic: a.Dynamic,
FirstCid: a.FirstCid,
Dimension: Dimension{
Width: a.Dimension.Width,
Height: a.Dimension.Height,
Rotate: a.Dimension.Rotate,
},
}
return
}
// BuildView3 build View3 with new proto.
func BuildView3(a *api.Arc, pages []*api.Page) (v *View3) {
if a == nil {
return nil
}
var arc = &Archive3{
Aid: a.Aid,
Videos: a.Videos,
TypeID: a.TypeID,
TypeName: a.TypeName,
Copyright: a.Copyright,
Pic: a.Pic,
Title: a.Title,
PubDate: a.PubDate,
Ctime: a.Ctime,
Desc: a.Desc,
State: a.State,
Access: a.Access,
Attribute: a.Attribute,
Duration: a.Duration,
MissionID: a.MissionID,
OrderID: a.OrderID,
RedirectURL: a.RedirectURL,
Forward: a.Forward,
Rights: Rights3{
Bp: a.Rights.Bp,
Elec: a.Rights.Elec,
Download: a.Rights.Download,
Movie: a.Rights.Movie,
Pay: a.Rights.Pay,
HD5: a.Rights.HD5,
NoReprint: a.Rights.NoReprint,
Autoplay: a.Rights.Autoplay,
UGCPay: a.Rights.UGCPay,
IsCooperation: a.Rights.IsCooperation,
},
Author: Author3{
Mid: a.Author.Mid,
Name: a.Author.Name,
Face: a.Author.Face,
},
Stat: Stat3{
Aid: a.Stat.Aid,
View: a.Stat.View,
Danmaku: a.Stat.Danmaku,
Reply: a.Stat.Reply,
Fav: a.Stat.Fav,
Coin: a.Stat.Coin,
Share: a.Stat.Share,
NowRank: a.Stat.NowRank,
HisRank: a.Stat.HisRank,
Like: a.Stat.Like,
DisLike: a.Stat.DisLike,
},
ReportResult: a.ReportResult,
Dynamic: a.Dynamic,
FirstCid: a.FirstCid,
Dimension: Dimension{
Width: a.Dimension.Width,
Height: a.Dimension.Height,
Rotate: a.Dimension.Rotate,
},
}
for _, s := range a.StaffInfo {
arc.StaffInfo = append(arc.StaffInfo, &StaffInfo{
Mid: s.Mid,
Title: s.Title,
})
}
var viewPages []*Page3
for _, v := range pages {
viewPages = append(viewPages, &Page3{
Cid: v.Cid,
Page: v.Page,
From: v.From,
Part: v.Part,
Duration: v.Duration,
Vid: v.Vid,
Desc: v.Desc,
WebLink: v.WebLink,
Dimension: Dimension{
Width: v.Dimension.Width,
Height: v.Dimension.Height,
Rotate: v.Dimension.Rotate,
},
})
}
v = &View3{
Archive3: arc,
Pages: viewPages,
}
return
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,115 @@
syntax = "proto3";
package archive;
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 Archive3 {
int64 Aid = 1 [(gogoproto.jsontag) = "aid"];
int64 Videos = 2 [(gogoproto.jsontag) = "videos"];
int32 TypeID = 3 [(gogoproto.jsontag) = "tid"];
string TypeName = 4 [(gogoproto.jsontag) = "tname"];
int32 Copyright = 5 [(gogoproto.jsontag) = "copyright"];
string Pic = 6 [(gogoproto.jsontag) = "pic"];
string Title = 7 [(gogoproto.jsontag) = "title"];
int64 PubDate = 8 [(gogoproto.jsontag) = "pubdate", (gogoproto.casttype) = "go-common/library/time.Time"];
int64 Ctime = 9 [(gogoproto.jsontag) = "ctime", (gogoproto.casttype) = "go-common/library/time.Time"];
string Desc = 10 [(gogoproto.jsontag) = "desc"];
int32 State = 11 [(gogoproto.jsontag) = "state"];
int32 Access = 12 [(gogoproto.jsontag) = "access,omitempty"];
int32 Attribute = 13 [(gogoproto.jsontag) = "attribute,omitempty"];
string Tag = 14 [(gogoproto.jsontag) = "-"];
repeated string Tags = 15 [(gogoproto.jsontag) = "tags,omitempty"];
int64 Duration = 16 [(gogoproto.jsontag) = "duration"];
int64 MissionID = 17 [(gogoproto.jsontag) = "mission_id,omitempty"];
int64 OrderID = 18 [(gogoproto.jsontag) = "order_id,omitempty"];
string RedirectURL = 19 [(gogoproto.jsontag) = "redirect_url,omitempty"];
int64 Forward = 20 [(gogoproto.jsontag) = "forward,omitempty"];
Rights3 Rights = 21 [(gogoproto.jsontag) = "rights", (gogoproto.nullable) = false];
Author3 Author = 22 [(gogoproto.jsontag) = "owner", (gogoproto.nullable) = false];
Stat3 Stat = 23 [(gogoproto.jsontag) = "stat", (gogoproto.nullable) = false];
string ReportResult = 24 [(gogoproto.jsontag) = "report_result,omitempty"];
string Dynamic = 25 [(gogoproto.jsontag) = "dynamic"];
int64 FirstCid = 26 [(gogoproto.jsontag) = "cid,omitempty"];
Dimension Dimension = 27 [(gogoproto.jsontag) = "dimension,omitempty", (gogoproto.nullable) = false];
repeated StaffInfo StaffInfo = 28 [(gogoproto.jsontag) = "-"];
}
message StaffInfo {
int64 Mid = 1 [(gogoproto.jsontag) = "mid"];
string Title = 2 [(gogoproto.jsontag) = "title"];
}
message Dimension {
int64 Width = 1 [(gogoproto.jsontag) = "width"];
int64 Height = 2 [(gogoproto.jsontag) = "height"];
int64 Rotate = 3 [(gogoproto.jsontag) = "rotate"];
}
message Rights3 {
int32 Bp = 1 [(gogoproto.jsontag) = "bp"];
int32 Elec = 2 [(gogoproto.jsontag) = "elec"];
int32 Download = 3 [(gogoproto.jsontag) = "download"];
int32 Movie = 4 [(gogoproto.jsontag) = "movie"];
int32 Pay = 5 [(gogoproto.jsontag) = "pay"];
int32 HD5 = 6 [(gogoproto.jsontag) = "hd5"];
int32 NoReprint = 7 [(gogoproto.jsontag) = "no_reprint"];
int32 Autoplay = 8 [(gogoproto.jsontag) = "autoplay"];
int32 UGCPay = 9 [(gogoproto.jsontag) = "ugc_pay"];
int32 IsCooperation = 10 [(gogoproto.jsontag) = "is_cooperation"];
}
message Author3 {
int64 Mid = 1 [(gogoproto.jsontag) = "mid"];
string Name = 2 [(gogoproto.jsontag) = "name"];
string Face = 3 [(gogoproto.jsontag) = "face"];
}
message Stat3 {
int64 Aid = 1 [(gogoproto.jsontag) = "aid"];
int32 View = 2 [(gogoproto.jsontag) = "view"];
int32 Danmaku = 3 [(gogoproto.jsontag) = "danmaku"];
int32 Reply = 4 [(gogoproto.jsontag) = "reply"];
int32 Fav = 5 [(gogoproto.jsontag) = "favorite"];
int32 Coin = 6 [(gogoproto.jsontag) = "coin"];
int32 Share = 7 [(gogoproto.jsontag) = "share"];
int32 NowRank = 8 [(gogoproto.jsontag) = "now_rank"];
int32 HisRank = 9 [(gogoproto.jsontag) = "his_rank"];
int32 Like = 10 [(gogoproto.jsontag) = "like"];
int32 DisLike = 11 [(gogoproto.jsontag) = "dislike"];
}
message Click3 {
int64 Aid = 1 [(gogoproto.jsontag) = "aid"];
int32 Web = 2 [(gogoproto.jsontag) = "web"];
int32 Ios = 3 [(gogoproto.jsontag) = "ios"];
int32 Android = 4 [(gogoproto.jsontag) = "android"];
int32 H5 = 5 [(gogoproto.jsontag) = "h5"];
int32 Outter = 6 [(gogoproto.jsontag) = "outter"];
}
message AidVideos3 {
int64 Aid = 1 [(gogoproto.jsontag) = "aid"];
repeated Page3 Pages = 2 [(gogoproto.jsontag) = "pages"];
}
message View3 {
Archive3 Archive = 1 [(gogoproto.embed) = true, (gogoproto.jsontag) = ""];
repeated Page3 Pages = 2 [(gogoproto.jsontag) = "pages,omitempty"];
}
message Page3 {
int64 Cid = 1 [(gogoproto.jsontag) = "cid"];
int32 Page = 2 [(gogoproto.jsontag) = "page"];
string From = 3 [(gogoproto.jsontag) = "from"];
string Part = 4 [(gogoproto.jsontag) = "part"];
int64 Duration = 5 [(gogoproto.jsontag) = "duration"];
string Vid = 6 [(gogoproto.jsontag) = "vid"];
string Desc = 7 [(gogoproto.jsontag) = "description,omitempty"];
string WebLink = 8 [(gogoproto.jsontag) = "weblink"];
Dimension Dimension = 9 [(gogoproto.jsontag) = "dimension", (gogoproto.nullable) = false];
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,54 @@
syntax = "proto3";
package archive;
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;
// !!!Note: only response message defined, since we put pb into http response body
message VideoFileInfo {
uint64 filesize = 1 [(gogoproto.jsontag) = "filesize", (gogoproto.casttype) = "int64"];
uint64 timelength = 2 [(gogoproto.jsontag) = "timelength", (gogoproto.casttype) ="int64"];
string ahead = 3 [(gogoproto.jsontag) = "ahead"];
string vhead = 4 [(gogoproto.jsontag) = "vhead"];
}
message VideoFormatFileInfo {
repeated VideoFileInfo infos = 1 [(gogoproto.jsontag) = "infos"];
}
message DashItem {
uint32 id = 1 [(gogoproto.jsontag) = "id", (gogoproto.casttype) = "int64"];
string baseUrl = 2 [(gogoproto.jsontag) = "base_url"];
uint32 bandwidth = 3 [(gogoproto.jsontag) = "bandwidth", (gogoproto.casttype) = "int64"];
uint32 codecid = 4 [(gogoproto.jsontag) = "codecid", (gogoproto.casttype) = "int64"];
}
message ResponseDash {
repeated DashItem video = 1 [(gogoproto.jsontag) = "video"];
repeated DashItem audio = 2 [(gogoproto.jsontag) = "audio"];
}
message BvcVideoItem {
uint64 expire_time = 1 [(gogoproto.jsontag) = "expire_time", (gogoproto.casttype) = "int64"];
uint32 cid = 2 [(gogoproto.jsontag) = "cid", (gogoproto.casttype) ="int64"];
repeated uint32 support_quality = 3 [(gogoproto.jsontag) = "support_quality", (gogoproto.casttype) = "int"];
repeated string support_formats = 4 [(gogoproto.jsontag) = "support_formats"];
repeated string support_description = 5 [(gogoproto.jsontag) = "support_description"];
uint32 quality = 6 [(gogoproto.jsontag) = "quality", (gogoproto.casttype) = "int"];
string url = 7 [(gogoproto.jsontag) = "url"];
map<uint32, VideoFormatFileInfo> file_info = 8 [(gogoproto.jsontag) = "file_info"];
uint32 video_codecid = 9 [(gogoproto.jsontag) = "video_codecid"];
bool video_project = 10 [(gogoproto.jsontag) = "video_project"];
uint32 fnver = 11 [(gogoproto.jsontag) = "fnver", (gogoproto.casttype) = "int"];
uint32 fnval = 12 [(gogoproto.jsontag) = "fnval", (gogoproto.casttype) = "int"];
ResponseDash dash = 13 [(gogoproto.jsontag) = "dash"];
}
message BvcResponseMsg {
uint32 code = 1 [(gogoproto.jsontag) = "code", (gogoproto.casttype) = "int64"];
map<uint32, BvcVideoItem> data = 2 [(gogoproto.jsontag) = "data"];
}

View File

@@ -0,0 +1,7 @@
package archive
// type of archive. season or move.
const (
TypeSeason = 1
TypeMovie = 2
)

View File

@@ -0,0 +1,10 @@
package archive
// ReportResult ReportResult
type ReportResult struct {
Aid int64
Result string
State int
AdminID int64
AfterDeal int
}

View File

@@ -0,0 +1,63 @@
package archive
// ArgAid ArgAid
type ArgAid struct {
Aid int64
RealIP string
}
// ArgCid ArgCid
type ArgCid struct {
Cid int64
RealIP string
}
// ArgAids ArgAids
type ArgAids struct {
Aids []int64
RealIP string
}
// ArgPage ArgPage
type ArgPage struct {
Aid int64
Mid int64
AccessKey string
RealIP string
}
// ArgVideoshot ArgVideoshot
type ArgVideoshot struct {
Cid int64
Count int
RealIP string
}
// ArgStat ArgStat
type ArgStat struct {
Aid int64
Field int
Value int
RealIP string
}
// ArgTag ArgTag
type ArgTag struct {
Aid int64
Tag string
RealIP string
}
// ArgPlayer ArgPlayer
type ArgPlayer struct {
Aids []int64
Qn int
Platform string
RealIP string
Fnval int
Fnver int
Build int
// 非必传
Session string
ForceHost int
}

View File

@@ -0,0 +1,151 @@
package archive
// ArgAid2 ArgAid2
type ArgAid2 struct {
Aid int64
RealIP string
}
// ArgCid2 ArgCid2
type ArgCid2 struct {
Aid int64
Cid int64
RealIP string
}
// ArgVideo2 ArgVideo2
type ArgVideo2 struct {
Aid, Cid int64
RealIP string
}
// ArgAids2 ArgAids2
type ArgAids2 struct {
Aids []int64
RealIP string
}
// ArgPage2 ArgPage2
type ArgPage2 struct {
Aid int64
Mid int64
AccessKey string
RealIP string
}
// ArgVideoshot2 ArgVideoshot2
type ArgVideoshot2 struct {
Cid int64
Count int
RealIP string
}
// ArgStat2 ArgStat2
type ArgStat2 struct {
Aid int64
Field int
Value int
RealIP string
}
// ArgAidMid2 ArgAidMid2
type ArgAidMid2 struct {
Aid int64
Mid int64
RealIP string
}
// ArgUpArcs2 ArgUpArcs2
type ArgUpArcs2 struct {
Mid int64
Pn, Ps int
RealIP string
}
// ArgUpCount2 ArgUpCount2
type ArgUpCount2 struct {
Mid int64
}
// ArgUpsArcs2 ArgUpsArcs2
type ArgUpsArcs2 struct {
Mids []int64
Pn, Ps int
RealIP string
}
// ArgMovie2 ArgMovie2
type ArgMovie2 struct {
MovieId int64
RealIP string
}
// ArgMid2 ArgMid2
type ArgMid2 struct {
Mid int64
RealIP string
}
// ArgRank2 ArgRank2
type ArgRank2 struct {
Rid int16
Type int8
Pn, Ps int
RealIP string
}
// ArgRanks2 ArgRanks2
type ArgRanks2 struct {
Rids []int16
Type int8
Pn, Ps int
RealIP string
}
// ArgRankTop2 ArgRankTop2
type ArgRankTop2 struct {
ReID int16
Pn, Ps int
}
// ArgRankAll2 ArgRankAll2
type ArgRankAll2 struct {
Pn, Ps int
}
// ArgRankTopsCount2 ArgRankTopsCount2
type ArgRankTopsCount2 struct {
ReIDs []int16
}
// ArgCIDs2 ArgCIDs2
type ArgCIDs2 struct {
Cids []int64
}
// ArgEp2 ArgEp2
type ArgEp2 struct {
EpIDs []int64
Tp int8
}
// const action type
const (
CacheAdd = "add"
CacheUpdate = "update"
CacheDelete = "delete"
)
// ArgCache2 ArgCache2
type ArgCache2 struct {
Aid int64
Tp string
OldMid int64
}
// ArgFieldCache2 ArgFieldCache2
type ArgFieldCache2 struct {
Aid int64
TypeID int16
OldTypeID int16
}

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 = ["videoshot.go"],
importpath = "go-common/app/service/main/archive/model/videoshot",
tags = ["automanaged"],
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,33 @@
package videoshot
import (
"time"
xtime "go-common/library/time"
)
var (
_verDate = time.Date(2015, 6, 1, 0, 0, 0, 0, time.Local)
)
// Videoshot is struct.
type Videoshot struct {
Cid int64
Count int
version int
CTime xtime.Time
MTime xtime.Time
}
// Version get version.
func (v *Videoshot) Version() int {
if v.version > 0 {
return v.version
}
return int(v.MTime.Time().Sub(_verDate) / time.Second)
}
// SetVersion set version from cache.
func (v *Videoshot) SetVersion(version int) {
v.version = version
}