Initial commit

This commit is contained in:
Donny
2019-04-22 20:46:32 +08:00
commit 49ab8aadd1
25441 changed files with 4055000 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = [
"academy.go",
"skill.go",
],
importpath = "go-common/app/interface/main/creative/model/academy",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = [
"//app/interface/openplatform/article/model:go_default_library",
"//app/service/main/archive/api:go_default_library",
"//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,276 @@
package academy
import (
"go-common/library/time"
mdlArt "go-common/app/interface/openplatform/article/model"
"go-common/app/service/main/archive/api"
)
const (
_ = iota
//Course 教程级别
Course
//Operation 运营标签
Operation
//Classify 分类标签
Classify
//ArticleClass 专栏分类
ArticleClass
//H5 移动端tag分类
H5
//RecommendTag 推荐理由
RecommendTag
//BusinessForAll //所有类型稿件
BusinessForAll = 0
//BusinessForArchive //视频稿件
BusinessForArchive = 1
//BusinessForArticle //专栏稿件
BusinessForArticle = 2
)
//H5Conf for h5 conf.
type H5Conf struct {
//OfficialID 官方推荐id
OfficialID int64
//EditorChoiceID 编辑精选id
EditorChoiceID int64
//NewbCourseID 新人课程id
NewbCourseID int64
//ResourceID 资源管理位id 防重复
ResourceID int64
}
//TagClassMap for tag type map.
func TagClassMap(ty int) (s string) {
switch ty {
case Course:
s = "course_level"
case Operation:
s = "operation_tag"
case Classify:
s = "classify_tag"
case ArticleClass:
s = "article_class"
case H5:
s = "h5"
case RecommendTag:
s = "recommend_tag"
}
return
}
//Tag for academy tag.
type Tag struct {
ID int64 `json:"id"`
ParentID int64 `json:"parent_id"`
Type int8 `json:"type"`
State int8 `json:"-"`
Business int8 `json:"-"`
Name string `json:"name"`
Desc string `json:"-"`
CTime time.Time `json:"-"`
MTime time.Time `json:"-"`
Children []*Tag `json:"children,omitempty"`
}
//TagClassify map tag type name.
func TagClassify() map[int]string {
return map[int]string{
Course: "教程级别",
Operation: "运营标签",
Classify: "分类标签",
ArticleClass: "专栏分类",
}
}
//Archive for academy achive & article.
type Archive struct {
ID int64 `json:"id"`
OID int64 `json:"oid"`
State int8 `json:"-"`
Business int `json:"business"`
CTime time.Time `json:"-"`
MTime time.Time `json:"-"`
TIDs []int64 `json:"-"`
}
//ArchiveTag for academy achive & tag relation .
type ArchiveTag struct {
ID int64 `json:"id"`
OID int64 `json:"oid"`
TID int64 `json:"tid"`
State int8 `json:"-"`
CTime time.Time `json:"-"`
MTime time.Time `json:"-"`
}
//ArchiveMeta for archive meta.
type ArchiveMeta struct {
OID int64 `json:"oid"`
MID int64 `json:"mid"`
State int32 `json:"state"`
Forbid int8 `json:"forbid"`
Cover string `json:"cover"`
Type string `json:"type"`
Title string `json:"title"`
HighLightTitle string `json:"highlight_title"`
UName string `json:"uname"`
Face string `json:"face"`
Comment string `json:"comment"`
CTime time.Time `json:"-"`
MTime time.Time `json:"-"`
Tags map[string][]*Tag `json:"tags"`
Duration int64 `json:"duration"`
ArcStat *api.Stat `json:"arc_stat,omitempty"`
ArtStat *mdlArt.Stats `json:"art_stat,omitempty"`
Business int `json:"business"`
Rights api.Rights `json:"rights,omitempty"`
}
//ArchiveList for archive list.
type ArchiveList struct {
Items []*ArchiveMeta `json:"items"`
Page *ArchivePage `json:"page"`
}
//ArchivePage for archive pagination.
type ArchivePage struct {
Pn int `json:"pn"`
Ps int `json:"ps"`
Total int `json:"total"`
}
//FeedBack for user advise.
type FeedBack struct {
// MID int64 `json:"mid"` //TODO
Category string `json:"category"`
Course string `json:"course"`
Suggest string `json:"suggest"`
CTime time.Time `json:"ctime"`
MTime time.Time `json:"mtime"`
}
// EsParam for es page.
type EsParam struct {
OID int64
Tid []int64
TidsMap map[int][]int64
Business int
Pn int
Ps int
Keyword string
Order string
IP string
Seed int64 //支持h5随机推荐
Duration int //支持h5时长筛选
}
// EsPage for es page.
type EsPage struct {
Num int `json:"num"`
Size int `json:"size"`
Total int `json:"total"`
}
// EsArc for search archive.
type EsArc struct {
OID int64 `json:"oid"`
TID []int64 `json:"tid"`
Business int `json:"business"`
Title []string `json:"title"` //highlight
}
// SearchResult archive list from search.
type SearchResult struct {
Page *EsPage `json:"page"`
Result []*EsArc `json:"result"`
}
//LinkTag for link tag.
type LinkTag struct {
ID int64 `json:"id"`
TID int64 `json:"tid"`
LinkID int64 `json:"link_id"`
}
//RecArchive for archive.
type RecArchive struct {
OID int64 `json:"oid"`
MID int64 `json:"mid"`
Cover string `json:"cover"`
Title string `json:"title"`
Business int `json:"business,omitempty"` //只针对标签课程
Duration int64 `json:"duration,omitempty"`
ArcStat *api.Stat `json:"arc_stat,omitempty"`
ArtStat *mdlArt.Stats `json:"art_stat,omitempty"`
Tags map[string][]*Tag `json:"tags,omitempty"`
}
//RecArcList for recommend archive list.
type RecArcList struct {
Items []*RecArchive `json:"items"`
Name string `json:"name"`
TID int64 `json:"tid"`
}
//RecConf for tag conf.
type RecConf struct {
TIDs []int64
PID int64
}
//KV key for tag ids val for type ids
type KV struct {
Key []int64 `json:"key"`
Val []int64 `json:"val"`
}
//CourseRec for course rec
type CourseRec struct {
ID int64 `json:"id"`
Rank int64 `json:"rank"`
Shoot *KV `json:"shoot"`
Scene *KV `json:"scene"`
Edit *KV `json:"edit"`
Mmd *KV `json:"mmd"`
Sing *KV `json:"sing"`
Bang *KV `json:"bang"`
Other *KV `json:"other"`
}
//Drawn for Drawn rec
type Drawn struct {
ID int64 `json:"id"`
Rank int64 `json:"rank"`
MobilePlan *KV `json:"mobile_plan"`
ScreenPlan *KV `json:"screen_plan"`
RecordPlan *KV `json:"record_plan"`
Other *KV `json:"other"`
}
//Video for Video rec
type Video struct {
ID int64 `json:"id"`
Rank int64 `json:"rank"`
MobileMake *KV `json:"mobile_make"`
AudioEdit *KV `json:"audio_edit"`
EditCompose *KV `json:"edit_compose"`
Other *KV `json:"other"`
}
//Person for person rec
type Person struct {
ID int64 `json:"id"`
Rank int64 `json:"rank"`
Other *KV `json:"other"`
}
//Recommend for all type
type Recommend struct {
Course *CourseRec `json:"course"`
Drawn *Drawn `json:"drawn"`
Video *Video `json:"video"`
Person *Person `json:"person"`
}

View File

@@ -0,0 +1,146 @@
package academy
import (
"reflect"
"go-common/app/service/main/archive/api"
"go-common/library/time"
)
//Occupation for occupation.
type Occupation struct {
ID int64 `json:"id"`
Rank int64 `json:"rank"`
Name string `json:"name"`
Desc string `json:"desc"`
MainStep string `json:"main_step"`
MainSoftWare string `json:"main_software"`
Logo string `json:"logo"`
}
//Skill for Skill.
type Skill struct {
ID int64 `json:"id"`
OID int64 `json:"oid"`
Name string `json:"name"`
Desc string `json:"desc"`
}
//SkillArc for Skill.
type SkillArc struct {
ID int64 `json:"id"`
AID int64 `json:"aid"`
Type int `json:"type"`
PID int64 `json:"pid"`
SkID int64 `json:"skid"`
SID int64 `json:"sid"`
}
//ArcMeta for skill arc meta.
type ArcMeta struct {
AID int64 `json:"aid"`
MID int64 `json:"mid"`
Cover string `json:"cover"`
Title string `json:"title"`
Type string `json:"type"`
Duration int64 `json:"duration,omitempty"`
PlayTime time.Time `json:"play_time"` //历史课程上次学习时间
Watch int8 `json:"watch"` //标记是否观看过
ArcStat *api.Stat `json:"arc_stat,omitempty"`
Skill *SkillArc `json:"-"`
Business int8 `json:"business"`
Tags map[string][]*Tag `json:"tags,omitempty"`
}
//ArcList for archive list.
type ArcList struct {
Items []*ArcMeta `json:"items"`
Page *ArchivePage `json:"page"`
}
//NewbCourseList for NewbCourse list.
type NewbCourseList struct {
Items []*ArcMeta `json:"items"`
Title string `json:"title"`
TID int64 `json:"tid"`
}
//Play for academy play list.
type Play struct {
MID int64 `json:"mid"`
AID int64 `json:"aid"`
Business int8 `json:"business"`
Watch int8 `json:"watch"`
CTime time.Time `json:"ctime"`
MTime time.Time `json:"mtime"`
}
//SearchKeywords for academy h5 search keywords.
type SearchKeywords struct {
ID int64 `json:"id"`
Rank int64 `json:"rank"`
ParentID int64 `json:"parent_id"`
State int8 `json:"state"`
Name string `json:"name"`
Comment string `json:"comment"`
CTime string `json:"-"`
MTime string `json:"-"`
Count int `json:"count,omitempty"`
Children []*SearchKeywords `json:"children,omitempty"`
}
//Trees for generate tree data set
// data - db result set
// idFieldStr - primary key in table map to struct
// pidFieldStr - top parent id in table map to struct
// chFieldStr - struct child nodes
func Trees(data interface{}, idFieldStr, pidFieldStr, chFieldStr string) (res []interface{}) {
if reflect.TypeOf(data).Kind() != reflect.Slice {
return
}
sli := reflect.ValueOf(data)
top := make(map[int64]interface{})
res = make([]interface{}, 0, sli.Len())
for i := 0; i < sli.Len(); i++ {
v := sli.Index(i).Interface()
if reflect.TypeOf(v).Kind() != reflect.Ptr {
continue
}
if reflect.ValueOf(v).IsNil() {
continue
}
getValue := reflect.ValueOf(v).Elem()
getType := reflect.TypeOf(v).Elem()
pid := getValue.FieldByName(pidFieldStr).Interface().(int64)
if _, ok := getType.FieldByName(pidFieldStr); ok && pid == 0 {
id := getValue.FieldByName(idFieldStr).Interface().(int64)
top[id] = v
res = append(res, v)
}
}
for i := 0; i < sli.Len(); i++ {
v := sli.Index(i).Interface()
if reflect.TypeOf(v).Kind() != reflect.Ptr {
continue
}
if reflect.ValueOf(v).IsNil() {
continue
}
pid := reflect.ValueOf(v).Elem().FieldByName(pidFieldStr).Interface().(int64)
if pid == 0 {
continue
}
if p, ok := top[pid]; ok {
ch := reflect.ValueOf(p).Elem().FieldByName(chFieldStr)
ch.Set(reflect.Append(ch, reflect.ValueOf(v)))
}
}
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 = ["account.go"],
importpath = "go-common/app/interface/main/creative/model/account",
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,81 @@
package account
import "go-common/library/time"
// MyInfo get user info for pre archive.
type MyInfo struct {
Mid int64 `json:"mid"`
Name string `json:"uname"`
Face string `json:"face"`
Banned bool `json:"banned"`
Level int `json:"level"`
Activated bool `json:"activated"`
Deftime time.Time `json:"deftime"`
DeftimeEnd time.Time `json:"deftime_end"`
DeftimeMsg string `json:"deftime_msg"`
Commercial int `json:"commercial"`
VideoRate uint `json:"video_rate,omitempty"`
AudioRate uint `json:"audio_rate,omitempty"`
IdentifyInfo *IdentifyInfo `json:"identify_check"`
DmSubtitle bool `json:"subtitle"` //弹幕子业务之字幕协同创作
DymcLottery bool `json:"lottery"` //动态子业务之抽奖
UploadSize map[string]bool `json:"uploadsize"` // upload_size <= 8G
}
// IdentifyInfo str
type IdentifyInfo struct {
Code int `json:"code"`
Msg string `json:"msg"`
}
var (
// IdentifyEnum define
IdentifyEnum = map[int]string{
0: "已实名认证",
1: "根据国家实名制认证的相关要求您需要换绑一个非170/171的手机号才能继续进行操作。",
2: "根据国家实名制认证的相关要求,您需要绑定手机号,才能继续进行操作。",
}
)
const (
// IsUp is up
IsUp = 1
// NotUp not up
NotUp = 0
)
// UpInfo up type infos.
type UpInfo struct {
Archive int `json:"archive"`
Article int `json:"article"`
Pic int `json:"pic"`
Blink int `json:"blink"`
}
//IsUper judge up auth by archive/article/pic/blink.
func IsUper(up *UpInfo) (ok bool) {
if up.Archive == 1 || up.Article == 1 || up.Blink == 1 || up.Pic == 1 {
ok = true
}
return
}
// Friend str
type Friend struct {
Mid int64 `json:"mid"`
Name string `json:"name"`
Face string `json:"face"`
Sign string `json:"sign"`
Comment string `json:"comment"`
ShouldFollow int8 `json:"should_follow"`
}
// SearchUp UP主搜索结果
type SearchUp struct {
Mid int64 `json:"mid"`
Name string `json:"name"`
Face string `json:"face"`
IsBlock bool `json:"is_block"`
Relation int `json:"relation"`
Silence int32 `json:"silence"`
}

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 = ["actvity.go"],
importpath = "go-common/app/interface/main/creative/model/activity",
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,53 @@
package activity
const (
//CancelState 取消活动
CancelState = -1
//JoinState 参加活动
JoinState = 0
)
// Activity for activiy list.
type Activity struct {
ID int64 `json:"id"`
Name string `json:"name"`
Tags string `json:"tags"`
Hot int8 `json:"hot"`
ActURL string `json:"act_url"`
Protocol string `json:"protocol"`
Type int `json:"type"`
New int8 `json:"new"`
Comment string `json:"comment"`
STime string `json:"stime"`
}
// Like for Like
type Like struct {
Count int `json:"count"`
}
// Subject for Subject
type Subject struct {
ID string `json:"id"`
Name string `json:"name"`
}
// Protocol str
type Protocol struct {
ID string `json:"id"`
Protocol string `json:"protocol"`
Tags string `json:"tags"`
Types string `json:"types"`
}
// ActWithTP str
type ActWithTP struct {
ID int64 `json:"id"`
Name string `json:"name"`
Tags string `json:"tags"`
Types string `json:"types"`
Hot int8 `json:"hot"`
ActURL string `json:"act_url"`
Protocol string `json:"protocol"`
Type int `json:"type"`
}

View File

@@ -0,0 +1,32 @@
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = [
"app.go",
"editor.go",
],
importpath = "go-common/app/interface/main/creative/model/app",
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,217 @@
package app
import (
"go-common/library/time"
)
// platMap and Article vars
var (
platMap = map[string][]int8{
"android": {0, 1},
"ios": {0, 2},
"ipad": {0, 3},
}
MyArticle = "我的专栏"
OpenArticle = "开通专栏"
PortalIntro = 0
PortalNotice = 1
BgmFrom = map[int]int{
0: 1, // videoup
1: 1, // camera
}
)
// Type
const (
TypeSwitch = int8(-1)
TypeSubtitle = int8(0)
TypeFont = int8(1)
TypeFilter = int8(2)
TypeBGM = int8(3)
TypeHotWord = int8(4)
TypeSticker = int8(5)
TypeIntro = int8(6)
TypeVideoupSticker = int8(7)
TypeTransition = int8(8)
TypeCooperate = int8(9) // 拍摄之稿件合拍
TypeTheme = int8(10) // 编辑器的主题使用相关
//For portal White category
WhiteGroupType = int8(1)
WhitePercentType = int8(2)
WhitePercentV00 = int64(0)
WhitePercentV10 = int64(1)
WhitePercentV20 = int64(2)
WhitePercentV50 = int64(5)
)
// Icon str
type Icon struct {
State bool `json:"state"`
Name string `json:"name"`
URL string `json:"url"`
}
// AllowMaterial fn
func (pm *PortalMeta) AllowMaterial(platStr string, build int) (ret bool) {
if pm.Platform == 0 {
return true
}
platOK := false
for _, num := range platMap[platStr] {
if pm.Platform == num {
platOK = true
}
}
buildOK := true
for _, v := range pm.BuildExps {
if !AllowBuild(build, v.Condition, v.Build) {
buildOK = false
}
}
return buildOK && platOK
}
// AcademyIntro str
type AcademyIntro struct {
Title string `json:"title"`
Show int `json:"show"`
URL string `json:"url"`
}
// ActIntro str
type ActIntro struct {
Title string `json:"title"`
Show int `json:"show"`
URL string `json:"url"`
}
//Portal for app portal
type Portal struct {
ID int64 `json:"id"`
Icon string `json:"icon"`
Title string `json:"title"`
Pos int8 `json:"position"`
URL string `json:"url"`
New int8 `json:"new"`
More int8 `json:"more"`
SubTitle string `json:"subtitle"`
MTime time.Time `json:"mtime"`
}
//Up verify author.
type Up struct {
Arc int `json:"archive"`
Art int `json:"article"`
}
// BuildExp str
type BuildExp struct {
Condition int8 `json:"conditions"`
Build int `json:"build"`
}
// WhiteExp str
type WhiteExp struct {
TP int8 `json:"type"`
Value int64 `json:"value"`
}
//PortalMeta for app.
type PortalMeta struct {
ID int64 `json:"id"`
Build int `json:"build"`
Platform int8 `json:"platform"` ////0-全平台,1-android,2-ios,3-ipad,4-ipod
Compare int8 `json:"compare"` //比较版本号符号类型,0-等于,1-小于,2-大于,3-不等于,4-小于等于,5-大于等于
State int8 `json:"state"` //状态,0-关闭,1-打开
Pos int8 `json:"pos"`
Mark int8 `json:"mark"` //是否为新的标记,0-否,1-是
Type int8 `json:"type"` //业务类型,0-创作中心,1-主站APP个人中心配置
Title string `json:"title"`
Icon string `json:"icon"`
URL string `json:"url"`
CTime time.Time `json:"ctime"`
MTime time.Time `json:"mtime"`
PTime time.Time `json:"ptime"`
More int8 `json:"more"`
BuildExps []*BuildExp `json:"-"`
// add from app 537
SubTitle string `json:"subtitle"`
WhiteExps []*WhiteExp `json:"-"`
}
//PlatFormMap for platform from int to string map.
func PlatFormMap(pf int8) (res string) {
switch pf {
case 1:
res = "android"
case 2:
res = "ios"
}
return
}
//EarningsCopyWriter for creator earnings copywriter.
type EarningsCopyWriter struct {
Elec string `json:"elec"`
Growth string `json:"growth"`
Oasis string `json:"oasis"`
}
//BuildMap for build from int to string map.
func BuildMap(pf int8) (res string) { //比较版本号符号类型,0-等于,1-小于,2-大于,3-不等于,4-小于等于,5-大于等于
switch pf {
case 0:
res = "="
case 1:
res = "<"
case 2:
res = ">"
case 3:
res = "!="
case 4:
res = "<="
case 5:
res = ">="
}
return
}
// AllowPlatForm fn
func AllowPlatForm(platStr string, plat int8) bool {
if plat == 0 || platStr == PlatFormMap(plat) {
return true
}
return false
}
// AllowBuild fn
func AllowBuild(buildParam int, compare int8, build int) (res bool) {
switch BuildMap(compare) {
case "=":
if buildParam == build {
res = true
}
case "<":
if buildParam < build {
res = true
}
case ">":
if buildParam > build {
res = true
}
case "!=":
if buildParam != build {
res = true
}
case "<=":
if buildParam <= build {
res = true
}
case ">=":
if buildParam >= build {
res = true
}
}
return
}

View File

@@ -0,0 +1,132 @@
package app
import "fmt"
// EditorData str
type EditorData struct {
AID int64
CID int64
Type int8
Data string
}
// 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拍摄贴纸
VStickers 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"` //摄像头翻转
}
// ParseThemes fn
func (e *Editor) ParseThemes() (valStr string) {
Themes, ok := e.Themes.(float64)
if ok {
valStr = fmt.Sprintf("%d", int64(Themes))
} else if e.Themes != nil {
valStr = fmt.Sprintf("%v", e.Themes)
}
return
}
// ParseCooperates fn
func (e *Editor) ParseCooperates() (valStr string) {
Cooperates, ok := e.Cooperates.(float64)
if ok {
valStr = fmt.Sprintf("%d", int64(Cooperates))
} else if e.Cooperates != nil {
valStr = fmt.Sprintf("%v", e.Cooperates)
}
return
}
// ParseFilters fn
func (e *Editor) ParseFilters() (valStr string) {
Filters, ok := e.Filters.(float64)
if ok {
valStr = fmt.Sprintf("%d", int64(Filters))
} else if e.Filters != nil {
valStr = fmt.Sprintf("%v", e.Filters)
}
return
}
// ParseFonts fn
func (e *Editor) ParseFonts() (valStr string) {
Fonts, ok := e.Fonts.(float64)
if ok {
valStr = fmt.Sprintf("%d", int64(Fonts))
} else if e.Fonts != nil {
valStr = fmt.Sprintf("%v", e.Fonts)
}
return
}
// ParseSubtitles fn
func (e *Editor) ParseSubtitles() (valStr string) {
Subtitles, ok := e.Subtitles.(float64)
if ok {
valStr = fmt.Sprintf("%d", int64(Subtitles))
} else if e.Subtitles != nil {
valStr = fmt.Sprintf("%v", e.Subtitles)
}
return
}
// ParseBgms fn
func (e *Editor) ParseBgms() (valStr string) {
Bgms, ok := e.Bgms.(float64)
if ok {
valStr = fmt.Sprintf("%d", int64(Bgms))
} else if e.Bgms != nil {
valStr = fmt.Sprintf("%v", e.Bgms)
}
return
}
// ParseStickers fn
func (e *Editor) ParseStickers() (valStr string) {
Stickers, ok := e.Stickers.(float64)
if ok {
valStr = fmt.Sprintf("%d", int64(Stickers))
} else if e.Stickers != nil {
valStr = fmt.Sprintf("%v", e.Stickers)
}
return
}
// ParseVStickers fn
func (e *Editor) ParseVStickers() (valStr string) {
VStickers, ok := e.VStickers.(float64)
if ok {
valStr = fmt.Sprintf("%d", int64(VStickers))
} else if e.VStickers != nil {
valStr = fmt.Sprintf("%v", e.VStickers)
}
return
}
// ParseTransitions fn
func (e *Editor) ParseTransitions() (valStr string) {
Transitions, ok := e.Transitions.(float64)
if ok {
valStr = fmt.Sprintf("%d", int64(Transitions))
} else if e.Transitions != nil {
valStr = fmt.Sprintf("%v", e.Transitions)
}
return
}

View File

@@ -0,0 +1,32 @@
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = ["appeal.go"],
importpath = "go-common/app/interface/main/creative/model/appeal",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = [
"//app/service/main/archive/api:go_default_library",
"//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,175 @@
package appeal
import (
"go-common/app/service/main/archive/api"
"go-common/library/time"
)
// Appeal state
const (
// StateCreate 用户刚创建申诉
StateCreate = 1
// StateReply 管理员回复,并且用户已读
StateReply = 2
// StateAdminClose 管理员关闭申诉
StateAdminClose = 3
// StateUserFinished 用户已解决申诉(评分)
StateUserFinished = 4
// StateTimeoutClose 超时关闭申诉
StateTimeoutClose = 5
// StateNoRead 管理员回复,用户未读
StateNoRead = 6
// StateUserClosed 用户直接关闭申诉
StateUserClosed = 7
// StateAdminFinished 管理员已通过申诉
StateAdminFinished = 8
// EventStateAdminReply 管理员回复
EventStateAdminReply = 1
// EventStateAdminNote 管理员回复并记录
EventStateAdminNote = 2
// EventStateUserReply 用户回复
EventStateUserReply = 3
// EventStateSystem 系统回复
EventStateSystem = 4
// Business appeal business
Business = 2
// ReplyMsg appeal auto reply msg
ReplyMsg = "您好,您的反馈我们已收到,会尽快核实处理,请您稍等。"
//ReplyEvent 1管理员回复2管理员备注3用户回复4系统回复
ReplyUserEvent = 3
ReplySystemEvent = 4
)
// AppealMeta for appeal detail.
type AppealMeta struct {
ID int64 `gorm:"column:id" json:"id"`
Tid int32 `gorm:"column:tid" json:"tid"`
Gid int32 `gorm:"column:gid" json:"gid"`
Oid int64 `gorm:"column:oid" json:"oid"`
Mid int64 `gorm:"column:mid" json:"mid"`
State int8 `gorm:"column:state" json:"state"`
Business int8 `gorm:"column:business" json:"business"`
BusinessState int8 `gorm:"column:business_state" json:"business_state"`
Assignee int32 `gorm:"column:assignee_adminid" json:"assignee_adminid"`
Adminid int32 `gorm:"column:adminid" json:"adminid"`
MetaData string `gorm:"column:metadata" json:"metadata"`
Desc string `gorm:"column:description" json:"description"`
Attachments []*Attachment `gorm:"-" json:"attachments"`
Events []*EventNew `gorm:"-" json:"events"`
CTime time.Time `json:"ctime"`
MTime time.Time `json:"mtime"`
}
//EventNew for new.
type EventNew struct {
ID int64 `gorm:"column:id" json:"id"`
Cid int64 `gorm:"column:cid" json:"cid"`
Event int64 `gorm:"column:event" json:"event"`
Adminid int64 `gorm:"column:adminid" json:"adminid"`
Content string `gorm:"column:content" json:"content"`
Attachments string `gorm:"column:attachments" json:"attachments"`
CTime time.Time `gorm:"column:ctime" json:"ctime"`
MTime time.Time `gorm:"column:mtime" json:"mtime"`
}
// Appeal info.
type Appeal struct {
ID int64 `json:"id"`
Oid int64 `json:"oid"`
Cid int64 `json:"cid"`
Mid int64 `json:"mid"`
Aid int64 `json:"aid"`
Tid int8 `json:"tid"`
Title string `json:"title"`
State int8 `json:"state"`
Visit int8 `json:"visit"`
QQ string `json:"qq"`
Email string `json:"email"`
Phone string `json:"phone"`
Pics string `json:"pics"`
Content string `json:"content"`
Description string `json:"description"`
Star int8 `json:"star"`
CTime time.Time `json:"ctime"`
MTime time.Time `json:"mtime"`
Attachments []*Attachment `json:"attachments"`
// event
Events []*Event `json:"events"`
// archive
Archive *api.Arc `json:"archive,omitempty"`
UserInfo *UserInfo `json:"userinfo"`
}
type UserInfo struct {
MID int64 `json:"mid"`
Name string `json:"name"`
Sex string `json:"sex"`
Face string `json:"face"`
Rank int32 `json:"rank"`
Level int32 `json:"level"`
}
// Event appeal work order deal.
type Event struct {
ID int64 `json:"id"`
AdminID int64 `json:"adminid"`
Content string `json:"content"`
ApID int64 `json:"apid"`
Pics string `json:"pics"`
Event int64 `json:"event"`
Attachments string `json:"attachments"`
CTime time.Time `json:"ctime"`
MTime time.Time `json:"mtime"`
}
// Attachment is appeal attachment.
type Attachment struct {
ID int64 `json:"id"`
Cid int64 `json:"cid"`
Path string `json:"path"`
}
// Contact user contacts.
type Contact struct {
Mid int64 `json:"mid"`
Uname string `json:"uname"`
TelPhone string `json:"telPhone"`
Email string `json:"email"`
}
// BusinessAppeal for new arc add appeal.
type BusinessAppeal struct {
BusinessTypeID int64 `json:"business_typeid"`
BusinessMID int64 `json:"business_mid"`
BusinessTitle string `json:"business_title"`
BusinessContent string `json:"business_content "`
}
// IsOpen appeal open state.
func IsOpen(state int8) bool {
return state == StateCreate || state == StateReply || state == StateNoRead
}
// OpenedStates open get appeal
func OpenedStates() (states []int64) {
return []int64{StateCreate, StateReply, StateNoRead}
}
// ClosedStates get appeal
func ClosedStates() (states []int64) {
return []int64{StateAdminClose, StateUserFinished, StateTimeoutClose, StateUserClosed, StateAdminFinished}
}
// IsClosed appeal is close.
func IsClosed(state int8) (is bool) {
if state == StateAdminClose || state == StateUserFinished || state == StateTimeoutClose || state == StateUserClosed || state == StateAdminFinished {
is = true
}
return
}
// Allow archive state in (-2,-4) can add appeal.
func Allow(state int8) bool {
return state == -2 || state == -4
}

View File

@@ -0,0 +1,43 @@
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = [
"archive.go",
"biz.go",
"desc.go",
"history.go",
"poi.go",
"type.go",
"view.go",
"viewpoint.go",
"whitelist.go",
],
importpath = "go-common/app/interface/main/creative/model/archive",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = [
"//app/service/main/archive/api:go_default_library",
"//app/service/main/archive/model/archive:go_default_library",
"//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,231 @@
package archive
import (
"go-common/app/service/main/archive/api"
a "go-common/app/service/main/archive/model/archive"
"go-common/library/time"
)
var (
// VjInfo 审核当前拥挤状态的数据映射
VjInfo = map[int8]*VideoJam{
0: {
Level: 0,
State: "状态正在计算中",
Comment: "状态正在计算中",
},
1: {
Level: 1,
State: "畅通",
Comment: "预计稿件过审时间小于20分钟剧集、活动投稿除外",
},
2: {
Level: 2,
State: "繁忙",
Comment: "预计稿件过审时间小于40分钟剧集、活动投稿除外",
},
3: {
Level: 3,
State: "拥挤",
Comment: "预计稿件过审时间小于60分钟剧集、活动投稿除外",
},
4: {
Level: 4,
State: "爆满",
Comment: "预计稿件过审时间小于120分钟剧集、活动投稿除外",
},
5: {
Level: 5,
State: "阻塞",
Comment: "预计稿件过审时间大于120分钟剧集、活动投稿除外",
},
}
)
const (
// CopyrightOrigin 自制
CopyrightOrigin = int64(1)
// CopyrightReprint 转载
CopyrightReprint = int64(2)
// TagPredictFromWeb web tag推荐
TagPredictFromWeb = int8(0)
// TagPredictFromAPP app tag推荐
TagPredictFromAPP = int8(1)
// TagPredictFromWindows windows tag推荐
TagPredictFromWindows = int8(2)
)
// Const State
const (
// 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) // TODO: delete
AttrBitJumpURL = uint(16)
AttrBitIsMovie = uint(17)
AttrBitBadgepay = uint(18)
AttrBitIsJapan = uint(19) //日文稿件
AttrBitNoPushBplus = uint(20) //是否动态禁止
AttrBitParentMode = uint(21) //家长模式
AttrBitUGCPay = uint(22) //UGC付费
AttrBitHasBGM = uint(23) //稿件带有BGM
AttrBitIsCoop = uint(24) //联合投稿
)
// OldArchiveVideoAudit archive with audit.
// NOTE: old struct, will delete!!!
type OldArchiveVideoAudit struct {
*api.Arc
RejectReson string `json:"reject,omitempty"`
Dtime time.Time `json:"dtime,omitempty"`
VideoAudits []*OldVideoAudit `json:"video_audit,omitempty"`
StateDesc string `json:"state_desc"`
StatePanel int `json:"state_panel"`
ParentTName string `json:"parent_tname"`
Attrs *Attrs `json:"attrs"`
UgcPay int8 `json:"ugcpay"`
}
// OldVideoAudit video audit.
// NOTE: old struct, will delete!!!
type OldVideoAudit struct {
Reason string `json:"reason,omitempty"`
Eptitle string `json:"eptitle,omitempty"`
IndexOrder int `json:"index_order"`
}
// ArcVideoAudit archive video audit.
type ArcVideoAudit struct {
*ArcVideo
Stat *api.Stat `json:"stat"`
StatePanel int `json:"state_panel"`
ParentTName string `json:"parent_tname"`
TypeName string `json:"typename"`
OpenAppeal int64 `json:"open_appeal"`
}
// Flow type
type Flow struct {
ID uint `json:"id"`
Remark string `json:"remark"`
}
// Porder type
type Porder struct {
ID int64 `json:"id"`
AID int64 `json:"aid"`
IndustryID int64 `json:"industry_id"`
BrandID int64 `json:"brand_id"`
BrandName string `json:"brand_name"`
Official int8 `json:"is_official"`
ShowType string `json:"show_type"`
Advertiser string `json:"advertiser"`
Agent string `json:"agent"`
Ctime time.Time `json:"ctime,omitempty"`
Mtime time.Time `json:"mtime,omitempty"`
}
// Staff type
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"`
}
// StaffApply type
type StaffApply struct {
ID int64 `json:"id"`
Type int8 `json:"apply_type"`
ASID int64 `json:"apply_as_id"`
ApplyAID int64 `json:"apply_aid"`
ApplyUpMID int64 `json:"apply_up_mid"`
ApplyStaffMID int64 `json:"apply_staff_mid"`
ApplyTitle string `json:"apply_title"`
ApplyTitleID int64 `json:"apply_title_id"`
State int8 `json:"apply_state"`
StaffState int8 `json:"staff_state"`
StaffTitle string `json:"staff_title"`
}
// Commercial type
type Commercial struct {
AID int64 `json:"aid"`
POrderID int64 `json:"porder_id"` // 私
OrderID int64 `json:"order_id"` // 商
GameID int64 `json:"game_id"`
//IndustryID int64 `json:"industry_id"` // open after mall
//BrandID int64 `json:"brand_id"`
}
// InMovieType judge type for pubdate
func InMovieType(tid int16) bool {
return tid == 83 || tid == 145 || tid == 146 || tid == 147
}
// StatePanel judge archive state for app panel.
func StatePanel(s int8) (st int) {
if s == a.StateForbidWait ||
s == a.StateForbidFixed ||
s == a.StateForbidLater ||
s == a.StateForbidAdminDelay ||
s == a.StateForbidSubmit ||
s == a.StateForbidUserDelay {
st = 1 //处理中
} else if s == a.StateForbidRecicle {
st = 2 //退回可编辑
} else if s == a.StateForbidPolice || s == a.StateForbidLock {
st = 3 //退回全部不可编辑
} else if s == a.StateForbidXcodeFail {
st = 4 //退回分区不可编辑
} else {
st = 0 //正常开放
}
return
}
// IsCloseState judge arc state.
func IsCloseState(s int) bool {
return s == -2 || s == -4 || s == -5 || s == -14
}
// ShortDesc cut down to short desc for adapter app and windows clients
func ShortDesc(desc string) string {
rs := []rune(desc)
length := len(rs)
max := 250
if length < max {
max = length
}
return string(rs[:max])
}
// AttrVal get attribute.
func (a *ArcVideoAudit) AttrVal(bit uint) int32 {
return (a.Archive.Attribute >> bit) & int32(1)
}
// IsOwner fn
func (a *ArcVideoAudit) IsOwner(mid int64) int8 {
if a.Archive.Mid == mid {
return 1
}
return 0
}

View File

@@ -0,0 +1,19 @@
package archive
import "go-common/library/time"
// VoteType 投票业务
const VoteType int8 = 2
// BIZ business
type BIZ struct {
ID int64 `json:"id"`
Type int32 `json:"type"`
Aid int64 `json:"aid"`
Uid int64 `json:"uid"`
State int8 `json:"state"`
Remark string `json:"remark"`
Data string `json:"data"`
Ctime time.Time `json:"ctime"`
Mtime time.Time `json:"mtime"`
}

View File

@@ -0,0 +1,33 @@
package archive
// DescFormat is archive type.
type DescFormat struct {
ID int64 `json:"id"`
Copyright int8 `json:"copyright"`
TypeID int64 `json:"typeid"`
Components string `json:"components"`
Lang int8 `json:"lang"`
}
// AppFormat app format.
type AppFormat struct {
ID int64 `json:"id"`
Copyright int8 `json:"copyright"`
TypeID int64 `json:"typeid"`
}
//ToLang str to int8.
func ToLang(langStr string) (lang int8) {
if langStr == "" {
langStr = "ch"
}
switch langStr {
case "ch":
lang = 0
case "en":
lang = 1
case "jp":
lang = 2
}
return
}

View File

@@ -0,0 +1,18 @@
package archive
import (
"go-common/library/time"
)
// ArcHistory archive of history
type ArcHistory struct {
ID int64 `json:"id,omitempty"`
Aid int64 `json:"aid,omitempty"`
Mid int64 `json:"mid,omitempty"`
Tag string `json:"tag,omitempty"`
Title string `json:"title,omitempty"`
Content string `json:"content,omitempty"`
Cover string `json:"cover,omitempty"`
CTime time.Time `json:"ctime,omitempty"`
Video []*Video `json:"videos,omitempty"`
}

View File

@@ -0,0 +1,56 @@
package archive
// 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"`
}
// NeedPoi fn
func NeedPoi(s string) (needPOI int) {
if (s == PlatformAndroid) ||
(s == PlatformIOS) ||
(s == PlatformH5) {
needPOI = 1
}
return
}
// NeedVote fn
func NeedVote(s string) (needVote int) {
if (s == PlatformAndroid) ||
(s == PlatformIOS) ||
(s == PlatformWeb) ||
(s == PlatformH5) {
needVote = 1
}
return
}

View File

@@ -0,0 +1,116 @@
package archive
import (
"sort"
)
// RulesForApp var
var RulesForApp = map[int16]int16{
160: 1, // 生活
4: 2, // 游戏
129: 3, // 舞蹈
3: 4, // 音乐
155: 5, // 时尚
5: 6, // 娱乐
36: 7, // 科技
188: 8, // 数码
1: 9, // 动画
181: 10, // 影视
119: 11, // 鬼畜
167: 12, // 国创
165: 13, // 广告
177: 14, // 纪录片
11: 15, // 电视剧
13: 16, // 番剧
23: 17, // 电影
}
// RulesForWeb var
var RulesForWeb = map[int16]int16{
4: 1, // 游戏
160: 2, // 生活
5: 3, // 娱乐
181: 4, // 影视
3: 5, // 音乐
36: 6, // 科技
188: 7, // 数码
1: 8, // 动画
155: 9, // 时尚
129: 10, // 舞蹈
13: 11, // 番剧
177: 12, // 纪录片
119: 13, // 鬼畜
165: 14, // 广告
167: 15, // 国创
11: 16, // 电视剧
23: 17, // 电影
}
// const client type values
const (
WebType = int8(1)
AppType = int8(2)
)
// Type is archive type.
type Type struct {
ID int16 `json:"id"`
Lang string `json:"-"`
Parent int16 `json:"parent"`
Name string `json:"name"`
Desc string `json:"description"`
Descapp string `json:"desc"`
Count int64 `json:"-"` // top type count
Original string `json:"intro_original"` // second type original
IntroCopy string `json:"intro_copy"` // second type copy
Notice string `json:"notice"` // second type notice
AppNotice string `json:"-"` // app notice
CopyRight int8 `json:"copy_right"`
Show bool `json:"show"`
Rank int16 `json:"-"`
Children []*Type `json:"children,omitempty"`
}
// ForbidSubTypesForAppAdd fn
// 不允许投稿的分区: 连载剧集->15,完结剧集->34,电视剧相关->128,电影相关->82
// 原不能投多P的分区创作姬统一不允许投稿: 欧美电影->145,日本电影->146,国产电影->147,其他国家->83
func ForbidSubTypesForAppAdd(tid int16) bool {
return tid == 15 || tid == 34 || tid == 128 || tid == 82 || tid == 145 || tid == 146 || tid == 147 || tid == 83
}
// ForbidTopTypesForAll fn 175=>ASMR
func ForbidTopTypesForAll(tid int16) bool {
return tid == 175
}
// ForbidTopTypesForAppAdd fn
// 不允许APP投稿顶级分区: 纪录片->177,电视剧->11,番剧->13
func ForbidTopTypesForAppAdd(tid int16) bool {
return tid == 177 || tid == 11 || tid == 13
}
// CopyrightForCreatorAdd fn 0,不限制1,只允许自制2,只允许转载
// 音乐-OP/ED/OST 54 番剧-完结动画 32 番剧-连载动画 33 番剧-资讯 51 电影-其他国家 83 电影-欧美电影 145 电影-日本电影 146 电影-国产电影 147 纪录片-人文历史 37
func CopyrightForCreatorAdd(tid int16) bool {
return tid == 54 || tid == 32 || tid == 33 || tid == 51 || tid == 83 || tid == 145 || tid == 146 || tid == 147 || tid == 37
}
// SortRulesForTopTypes fn
func SortRulesForTopTypes(types []*Type, clientType int8) {
var rules map[int16]int16
if clientType == WebType {
rules = RulesForWeb
} else if clientType == AppType {
rules = RulesForApp
}
for _, t := range types {
if rank, ok := rules[t.ID]; ok {
t.Rank = rank
} else {
t.Rank = 32767
}
}
sort.Slice(types, func(i, j int) bool {
return types[i].Rank < types[j].Rank
})
}

View File

@@ -0,0 +1,237 @@
package archive
import (
"go-common/library/time"
)
//Platform const
const (
PlatformWeb = "web"
PlatformWindows = "windows"
PlatformH5 = "h5"
PlatformAndroid = "android"
PlatformIOS = "ios"
)
// 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"`
RejectReason string `json:"reject_reason"`
Tag string `json:"tag"`
Duration int64 `json:"duration"`
Copyright int8 `json:"copyright"`
NoReprint int8 `json:"no_reprint"`
UgcPay int8 `json:"ugcpay"`
OrderID int64 `json:"order_id"`
OrderName string `json:"order_name"`
Desc string `json:"desc"`
MissionID int64 `json:"mission_id"`
MissionName string `json:"mission_name"`
Round int8 `json:"-"`
Forward int64 `json:"-"`
Attribute int32 `json:"attribute"`
Access int16 `json:"-"`
State int8 `json:"state"`
StateDesc string `json:"state_desc"`
StatePanel int `json:"state_panel"`
Source string `json:"source"`
DescFormatID int64 `json:"desc_format_id"`
Attrs *Attrs `json:"attrs"`
// feature: private orders
Porder *ArcPorder `json:"porder"`
Dynamic string `json:"dynamic"`
PoiObj *PoiObj `json:"poi_object"`
// time
DTime time.Time `json:"dtime"`
PTime time.Time `json:"ptime"`
CTime time.Time `json:"ctime"`
MTime time.Time `json:"-"`
UgcPayInfo *UgcPayInfo `json:"ugcpay_info"`
Staffs []*StaffView `json:"staffs"`
Vote *Vote `json:"vote"`
}
// Attrs str
type Attrs struct {
IsCoop int8 `json:"is_coop"`
IsOwner int8 `json:"is_owner"`
}
// Vote str
type Vote struct {
VoteID int64 `json:"vote_id"`
VoteTitle string `json:"vote_title"`
}
// PayAct str
type PayAct struct {
Reason string `json:"reason"`
State int8 `json:"state"`
}
// PayAsset str
type PayAsset struct {
Price int `json:"price"`
PlatformPrice map[string]int `json:"platform_price"`
}
// UgcPayInfo str
type UgcPayInfo struct {
Acts map[string]*PayAct `json:"acts"`
Asset *PayAsset `json:"asset"`
}
// NilPoiObj fn 防止非APP端的地理位置信息泄露
func (arc *Archive) NilPoiObj(platform string) {
if (platform != PlatformAndroid) &&
(platform != PlatformIOS) &&
(platform != PlatformH5) {
arc.PoiObj = nil
}
}
// NilVote fn
func (arc *Archive) NilVote() {
if arc.Vote != nil && arc.Vote.VoteID == 0 {
arc.Vote = nil
}
}
// ArcPorder str
type ArcPorder struct {
FlowID int64 `json:"flow_id"`
IndustryID int64 `json:"industry_id"`
BrandID int64 `json:"brand_id"`
BrandName string `json:"brand_name"`
Official int8 `json:"official"`
ShowType string `json:"show_type"`
// for admin operation
Advertiser string `json:"advertiser"`
Agent string `json:"agent"`
//state 0 自首 1 审核添加
State int8 `json:"state"`
}
// Video is videos 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:"cid"`
Duration int64 `json:"duration"`
Filesize int64 `json:"-"`
Resolutions string `json:"-"`
Index int `json:"index"`
Playurl string `json:"-"`
Status int16 `json:"status"`
StatusDesc string `json:"status_desc"`
RejectReason string `json:"reject_reason"`
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:"-"`
}
// ArcVideo str
type ArcVideo struct {
Archive *Archive
Videos []*Video
}
// StaffView Archive staff
type StaffView struct {
ID int64 `json:"id"`
ApMID int64 `json:"apply_staff_mid"`
ApName string `json:"apply_staff_name"`
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"`
}
// ViewBGM bgm view
type ViewBGM struct {
SID int64 `json:"sid"`
MID int64 `json:"mid"`
Title string `json:"title"`
Author string `json:"author"`
JumpURL string `json:"jump_url"`
}
// Vcover muti cover for video.
type Vcover struct {
Filename string `json:"filename"`
BFSPath string `json:"bfs_path"`
}
// SimpleArchive is simple model for videos
type SimpleArchive struct {
Aid int64 `json:"aid"`
Title string `json:"title"`
}
// SimpleVideo is simple model for videos
type SimpleVideo struct {
Cid int64 `json:"cid"`
Index int `json:"index"`
Title string `json:"title"`
}
// RecoArch is simple archive information for recommend
type RecoArch struct {
Aid int64 `json:"aid"`
Title string `json:"title"`
Owner string `json:"owner"`
}
// SpVideo is a simple model with danmu status
type SpVideo struct {
Cid int64 `json:"cid"`
Index int `json:"part_id"`
Title string `json:"part_name"`
Status int16 `json:"status"`
DmActive int `json:"dm_active"`
DmModified time.Time `json:"dm_modified"`
}
// SpArchive str
type SpArchive struct {
Aid int64 `json:"aid"`
Title string `json:"title"`
Mid int64 `json:"mid,omitempty"`
}
// SimpleArchiveVideos str
type SimpleArchiveVideos struct {
Archive *SpArchive `json:"archive"`
SpVideos []*SpVideo `json:"part_list"`
AcceptAss bool `json:"accept_ass"`
}
// VideoJam is video traffic jam info for frontend
type VideoJam struct {
Level int8 `json:"level"`
State string `json:"state"`
Comment string `json:"comment"`
}
// Dpub str
type Dpub struct {
Deftime time.Time `json:"deftime"`
DeftimeEnd time.Time `json:"deftime_end"`
DeftimeMsg string `json:"deftime_msg"`
}

View File

@@ -0,0 +1,21 @@
package archive
// ViewPointRow video highlight viewpoint
type ViewPointRow struct {
ID int64 `json:"id"`
AID int64 `json:"aid"`
CID int64 `json:"cid"`
Points []*ViewPoint `json:"points"`
State int32 `json:"state"`
CTime string `json:"ctime"`
MTime string `json:"mtime"`
}
// ViewPoint viewpoint struct
type ViewPoint struct {
Type int8 `json:"type"`
From int `json:"from"`
To int `json:"to"`
Content string `json:"content"`
State int8 `json:"state"`
}

View File

@@ -0,0 +1,7 @@
package archive
// WhiteList str
type WhiteList struct {
Mid int64 `json:"mid"`
Tp int `json:"type"`
}

View File

@@ -0,0 +1,32 @@
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = ["article.go"],
importpath = "go-common/app/interface/main/creative/model/article",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = [
"//app/interface/openplatform/article/model:go_default_library",
"//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,68 @@
package article
import (
model "go-common/app/interface/openplatform/article/model"
"go-common/library/time"
)
// ArtParam param for article info input.
type ArtParam struct {
AID int64 `json:"aid"`
MID int64 `json:"mid"`
Category int64 `json:"category"`
State int32 `json:"state"`
Reprint int32 `json:"reprint"`
TemplateID int32 `json:"tid"`
Title string `json:"title"`
BannerURL string `json:"banner_url"`
Content string `json:"content"`
Summary string `json:"summary"`
Tags string `json:"tags"`
ImageURLs []string `json:"image_urls"`
OriginImageURLs []string `json:"origin_image_urls"`
RealIP string `json:"-"`
Action int `json:"action"`
Words int64 `json:"words"`
DynamicIntro string `json:"dynamic_intro"`
ActivityID int64 `json:"activity_id"`
}
// Meta article detail.
type Meta struct {
ID int64 `json:"id"`
Title string `json:"title"`
Content string `json:"content"`
Summary string `json:"summary"`
BannerURL string `json:"banner_url"`
Reason string `json:"reason"`
TemplateID int32 `json:"template_id"`
State int32 `json:"state"`
Reprint int32 `json:"reprint"`
ImageURLs []string `json:"image_urls"`
OriginImageURLs []string `json:"origin_image_urls"`
Tags []string `json:"tags"`
Category *model.Category `json:"category"`
Author *model.Author `json:"author"`
Stats *model.Stats `json:"stats"`
PTime time.Time `json:"publish_time"`
CTime time.Time `json:"ctime"`
MTime time.Time `json:"mtime"`
ViewURL string `json:"view_url"`
EditURL string `json:"edit_url"`
IsPreview int `json:"is_preview"`
DynamicIntro string `json:"dynamic_intro"`
}
// ArtList article for list.
type ArtList struct {
Articles []*Meta `json:"articles"`
Type *model.CreationArtsType `json:"type"`
Page *model.ArtPage `json:"page"`
}
// DraftList draft list.
type DraftList struct {
Drafts []*Meta `json:"drafts"`
Page *model.ArtPage `json:"page"`
DraftURL string `json:"draft_url"`
}

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 = ["assist.go"],
importpath = "go-common/app/interface/main/creative/model/assist",
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,64 @@
package assist
import "go-common/library/time"
var (
// ActEnum action enum
ActEnum = map[int8]map[int8]string{
1: {
1: "删除评论",
2: "隐藏评论",
},
2: {
1: "删除弹幕",
2: "屏蔽弹幕",
3: "保护弹幕",
4: "拉黑用户",
5: "移动弹幕到字幕池",
6: "忽略字幕池的弹幕",
7: "取消拉黑用户",
},
}
)
// Assist is Assists model.
type Assist struct {
AssistMid int64 `json:"assist_mid"`
Banned int8 `json:"banned"`
AssistAvatar string `json:"assist_avatar"`
AssistName string `json:"assist_name"`
Rights *Rights `json:"rights"`
CTime time.Time `json:"ctime"`
MTime time.Time `json:"mtime"`
Total map[int8]map[int8]int `json:"total"`
}
// AssistLog is single record for assist done
type AssistLog struct {
ID int64 `json:"id"`
Mid int64 `json:"mid"`
AssistMid int64 `json:"assist_mid"`
AssistAvatar string `json:"assist_avatar"`
AssistName string `json:"assist_name"`
Type int8 `json:"type"`
Action int8 `json:"action"`
SubjectID int64 `json:"subject_id"`
ObjectID string `json:"object_id"`
Detail string `json:"detail"`
State int8 `json:"state"`
CTime time.Time `json:"ctime"`
}
// LiveAssist is single record for assist done
type LiveAssist struct {
AssistMid int64 `json:"uid"`
RoomID int64 `json:"roomid"`
CTime time.Time `json:"-"`
Datetime string `json:"ctime"`
}
// Rights main and live status
type Rights struct {
Main int8 `json:"main"`
Live int8 `json:"live"`
}

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 = ["danmu.go"],
importpath = "go-common/app/interface/main/creative/model/danmu",
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,203 @@
package danmu
import (
"go-common/library/time"
)
// AdvanceDanmu str
type AdvanceDanmu struct {
ID int64 `json:"id"`
Cid int64 `json:"cid"`
Mid int64 `json:"mid"`
Aid int64 `json:"aid"`
Type string `json:"type"`
Mode string `json:"mode"`
UName string `json:"uname"`
Title string `json:"title"`
Cover string `json:"cover"`
Timestamp int64 `json:"timestamp"`
}
// DmList str
type DmList struct {
List []*MemberDM `json:"list"`
Page int64 `json:"page"`
Size int64 `json:"page_size"`
TotalItems int64 `json:"total_items"`
TotalPages int `json:"TotalPages"`
NormalCount int `json:"normal_count"`
SubCount int `json:"sub_count"`
SpecCount int `json:"spec_count"`
}
// MemberDM str
type MemberDM struct {
ID int64 `json:"id"`
FontSize int32 `json:"fontsize"`
Color string `json:"color"`
Mode int32 `json:"mode"`
Msg string `json:"msg"`
VTitle string `json:"vtitle"`
Oid int64 `json:"oid"`
Aid int64 `json:"aid"`
ArcTitle string `json:"atitle"`
Cover string `json:"cover"`
Attrs string `json:"attrs"`
Mid int64 `json:"mid"`
Playtime float64 `json:"playtime"`
Pool int32 `json:"pool"`
State int32 `json:"state"`
Ctime time.Time `json:"ctime"`
Uname string `json:"uname"`
Uface string `json:"uface"`
Relation int `json:"relation"`
IsElec int `json:"is_elec"`
}
// Recent str
type Recent struct {
ID int64 `json:"id"`
Aid int64 `json:"aid"`
Type int32 `json:"type"`
Oid int64 `json:"oid"`
Mid int64 `json:"mid"`
Msg string `json:"msg"`
Cover string `json:"cover"`
FontSize int32 `json:"font_size"`
Color string `json:"color"`
Attrs string `json:"attrs"`
Mode int32 `json:"mode"`
Playtime float64 `json:"playtime"`
Pool int32 `json:"pool"`
State int32 `json:"state"`
Title string `json:"title"` // oid所对应的稿件的标题
Ctime time.Time `json:"ctime"`
Mtime time.Time `json:"mtime"`
Uname string `json:"uname"`
Uface string `json:"uface"`
Relation int `json:"relation"`
IsElec int `json:"is_elec"`
}
// DmRecent str
type DmRecent struct {
List []*Recent `json:"list"`
Page int64 `json:"page"`
Size int64 `json:"page_size"`
TotalItems int64 `json:"total_items"`
TotalPages int `json:"TotalPages"`
NormalCount int `json:"normal_count"`
SubCount int `json:"sub_count"`
SpecCount int `json:"spec_count"`
}
// DmReport str
type DmReport struct {
RpID int64 `json:"rp_id"`
DmInID int64 `json:"dm_inid"`
AID int64 `json:"aid"`
Pic string `json:"pic"`
ReportTime int64 `json:"reporttime"`
Title string `json:"title"`
Reason string `json:"reason"`
DmID int64 `json:"dmid"`
DmIDStr string `json:"dmid_str"`
UpUID int64 `json:"up_uid"`
Content string `json:"content"`
UID int64 `json:"uid"`
UserName string `json:"username"`
}
// DmArc str
type DmArc struct {
Aid int64 `json:"aid"`
Title string `json:"title"`
}
// Pager str
type Pager struct {
Total int `json:"total"`
Current int `json:"current"`
Size int `json:"size"`
TotalCount int `json:"total_count"`
}
// Apply str
type Apply struct {
ID int64 `json:"id"`
IDStr string `json:"id_str"`
AID int64 `json:"aid"`
CID int64 `json:"cid"`
Title string `json:"title"`
ApplyUID int64 `json:"-"`
Pic string `json:"pic"`
Uname string `json:"uname"`
Msg string `json:"msg"`
Playtime float32 `json:"playtime"`
Ctime string `json:"ctime"`
}
// ApplyListFromDM str
type ApplyListFromDM struct {
Pager *Pager
List []*Apply
}
// ApplyList str
type ApplyList struct {
Pager *Pager `json:"pager"`
List []*Apply `json:"list"`
}
// ------------------- danmu2 upgrade -------------------//
// DMMember str
type DMMember struct {
ID int64 `json:"id"`
Type int32 `json:"type"`
Aid int64 `json:"aid"`
Oid int64 `json:"oid"`
Mid int64 `json:"mid"`
MidHash string `json:"mid_hash"`
Pool int32 `json:"pool"`
Attrs string `json:"attrs"`
Progress int32 `json:"progress"`
Mode int32 `json:"mode"`
Msg string `json:"msg"`
State int32 `json:"state"`
FontSize int32 `json:"fontsize"`
Color string `json:"color"`
Ctime time.Time `json:"ctime"`
Uname string `json:"uname"`
Title string `json:"title"`
}
// RecentPage str
type RecentPage struct {
Pn int64 `json:"num"`
Ps int64 `json:"size"`
Total int64 `json:"total"`
}
// ResNewRecent str
type ResNewRecent struct {
Result []*DMMember `json:"result"`
Page *RecentPage `json:"page"`
}
//SearchDMResult dm list
type SearchDMResult struct {
Page struct {
Num int64 `json:"num"`
Size int64 `json:"size"`
Total int64 `json:"total"`
} `json:"page"`
Result []*DMMember `json:"result"`
}
// SubtitleSubjectReply str
type SubtitleSubjectReply struct {
AllowSubmit bool `json:"allow"`
Lan string `json:"lan"`
LanDoc string `json:"lan_doc"`
}

View File

@@ -0,0 +1,37 @@
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = [
"archive.go",
"article.go",
"data.go",
],
importpath = "go-common/app/interface/main/creative/model/data",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = [
"//app/interface/main/creative/model/archive:go_default_library",
"//app/interface/main/creative/model/medal:go_default_library",
"//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,159 @@
package data
import "go-common/app/interface/main/creative/model/archive"
// ArchiveStat for archive stat.
type ArchiveStat struct {
Play int64 `json:"play"`
Dm int64 `json:"dm"`
Reply int64 `json:"reply"`
Like int64 `json:"like"`
Coin int64 `json:"coin"`
Elec int64 `json:"elec"`
Fav int64 `json:"fav"`
Share int64 `json:"share"`
}
// ArchiveSource for archive source
type ArchiveSource struct {
Mainsite int64 `json:"mainsite"`
Outsite int64 `json:"outsite"`
Mobile int64 `json:"mobile"`
Others int64 `json:"others"`
WebPC int64 `json:"-"`
WebH5 int64 `json:"-"`
IOS int64 `json:"-"`
Android int64 `json:"-"`
}
// ArchiveGroup for archive group.
type ArchiveGroup struct {
Fans int64 `json:"fans"`
Guest int64 `json:"guest"`
}
// ArchiveArea for archive area.
type ArchiveArea struct {
Location string `json:"location"`
Count int64 `json:"count"`
}
// ArchiveData for single archive stats.
type ArchiveData struct {
ArchiveStat *ArchiveStat `json:"stat"`
ArchiveSource *ArchiveSource `json:"source"`
ArchiveGroup *ArchiveGroup `json:"group"`
ArchivePlay *ArchivePlay `json:"play"`
ArchiveAreas []*ArchiveArea `json:"area"`
Videos []*archive.SimpleVideo `json:"videos,omitempty"`
}
// UpBaseStat for up base.
type UpBaseStat struct {
View int64 `json:"view"`
Reply int64 `json:"reply"`
Dm int64 `json:"dm"`
Fans int64 `json:"fans"`
Fav int64 `json:"fav"`
Like int64 `json:"like"`
Share int64 `json:"share"`
Coin int64 `json:"coin"`
Elec int64 `json:"elec"`
}
// ViewerBase for up base data analysis.
type ViewerBase struct {
Male int64 `json:"male"`
Female int64 `json:"female"`
AgeOne int64 `json:"age_one"`
AgeTwo int64 `json:"age_two"`
AgeThree int64 `json:"age_three"`
AgeFour int64 `json:"age_four"`
PlatPC int64 `json:"plat_pc"`
PlatH5 int64 `json:"plat_h5"`
PlatOut int64 `json:"plat_out"`
PlatIOS int64 `json:"plat_ios"`
PlatAndroid int64 `json:"plat_android"`
PlatOtherApp int64 `json:"plat_other_app"`
}
// ViewerActionHour for up action data analysis.
type ViewerActionHour struct {
View map[int]int `json:"view"`
Reply map[int]int `json:"reply"`
Dm map[int]int `json:"danmu"`
Elec map[int]int `json:"elec"`
Contract map[int]int `json:"contract"`
}
// Trend for up trend data analysis.
type Trend struct {
Ty map[int]int64
Tag map[int]int64
}
// UpDataIncrMeta for Play/Dm/Reply/Fav/Share/Elec/Coin incr.
type UpDataIncrMeta struct {
Incr int `json:"-"`
TopAIDList map[int]int64 `json:"-"`
TopIncrList map[int]int `json:"-"`
Rank map[int]int `json:"-"`
TyRank map[string]int `json:"-"`
}
const (
//Play 播放相关.
Play = int8(1)
//Dm 弹幕相关.
Dm = int8(2)
//Reply 评论相关.
Reply = int8(3)
//Share 分享相关.
Share = int8(4)
//Coin 投币相关.
Coin = int8(5)
//Fav 收藏相关.
Fav = int8(6)
//Elec 充电相关.
Elec = int8(7)
//Like 点赞相关.
Like = int8(8)
)
var (
typeNameMap = map[int8]string{
Play: "play",
Dm: "dm",
Reply: "reply",
Share: "share",
Coin: "coin",
Fav: "fav",
Elec: "elec",
Like: "like",
}
)
//IncrTy return incr data type.
func IncrTy(ty int8) (val string, ok bool) {
val, ok = typeNameMap[ty]
return
}
// ArchiveMaxStat 获取单个稿件最多播放、评论、弹幕。。。
type ArchiveMaxStat struct {
PlayV int64 `family:"f" qualifier:"play_v" json:"play_v"`
PlayA int64 `family:"f" qualifier:"play_a" json:"play_a"`
CoinV int64 `family:"f" qualifier:"coin_v" json:"coin_v"`
CoinA int64 `family:"f" qualifier:"coin_a" json:"coin_a"`
LikeV int64 `family:"f" qualifier:"like_v" json:"like_v"`
LikeA int64 `family:"f" qualifier:"like_a" json:"like_a"`
ReplyV int64 `family:"f" qualifier:"reply_v" json:"reply_v"`
ReplyA int64 `family:"f" qualifier:"reply_a" json:"reply_a"`
ShareV int64 `family:"f" qualifier:"share_v" json:"share_v"`
ShareA int64 `family:"f" qualifier:"share_a" json:"share_a"`
FavV int64 `family:"f" qualifier:"fav_v" json:"fav_v"`
FavA int64 `family:"f" qualifier:"fav_a" json:"fav_a"`
DmV int64 `family:"f" qualifier:"dm_v" json:"dm_v"`
DmA int64 `family:"f" qualifier:"dm_a" json:"dm_a"`
FromPhoneNum int64 `family:"f" qualifier:"from_phone_num" json:"from_phone_num"`
}

View File

@@ -0,0 +1,66 @@
package data
import xtime "go-common/library/time"
const (
_ byte = iota
//ArtView 阅读
ArtView
//ArtReply 评论
ArtReply
//ArtShare 分享
ArtShare
//ArtCoin 硬币
ArtCoin
//ArtFavTBL 收藏
ArtFavTBL
//ArtLikeTBL 喜欢
ArtLikeTBL
)
var (
artTypeMap = map[byte]struct{}{
ArtView: {},
ArtReply: {},
ArtShare: {},
ArtCoin: {},
ArtFavTBL: {},
ArtLikeTBL: {},
}
)
//CheckType check article data type.
func CheckType(ty byte) bool {
_, ok := artTypeMap[ty]
return ok
}
// ArtTrend for article trend.
type ArtTrend struct {
DateKey int64 `json:"date_key"`
TotalIncr int64 `json:"total_inc"`
}
// ArtRankMap for article rank source.
type ArtRankMap struct {
AIDs map[int]int64
Incrs map[int]int
}
// ArtRankList for article top 10 list.
type ArtRankList struct {
Arts []*ArtMeta `json:"art_rank"`
}
// ArtMeta for article rank meta data.
type ArtMeta struct {
AID int64 `json:"aid"`
Incr int `json:"incr"`
Title string `json:"title"`
PTime xtime.Time `json:"ptime"`
}
// ArtRead for article read source.
type ArtRead struct {
Source map[string]int `family:"f" json:"source"`
}

View File

@@ -0,0 +1,276 @@
package data
import (
xtime "go-common/library/time"
"go-common/app/interface/main/creative/model/medal"
)
// Stat info
type Stat struct {
FanLast int64 `json:"fan_last"`
Fan int64 `json:"fan"`
DmLast int64 `json:"dm_last"`
Dm int64 `json:"dm"`
CommentLast int64 `json:"comment_last"`
Comment int64 `json:"comment"`
Play int64 `json:"play"`
PlayLast int64 `json:"play_last"`
Fav int64 `json:"fav"`
FavLast int64 `json:"fav_last"`
Like int64 `json:"like"`
LikeLast int64 `json:"like_last"`
Share int64 `json:"share"`
ShareLast int64 `json:"share_last"`
Elec int64 `json:"elec"`
ElecLast int64 `json:"elec_last"`
Coin int64 `json:"coin"`
CoinLast int64 `json:"coin_last"`
Day30 map[string]int `json:"30,omitempty"`
Arcs map[string][]*Arc `json:"arcs"`
}
// Arc Arcs info.
type Arc struct {
Aid int64 `json:"aid"`
Title string `json:"title"`
Click int64 `json:"click"`
}
// Tags Arcs info
type Tags struct {
Tags []string `json:"tags"`
}
// CheckedTag tags with checked
type CheckedTag struct {
Tag string `json:"tag"`
Checked int `json:"checked"`
}
// AppStat arc stat.
type AppStat struct {
Date string `json:"date"`
Num int64 `json:"num"`
}
// AppStatList for arc stat list.
type AppStatList struct {
Danmu []*AppStat `json:"danmu"`
View []*AppStat `json:"view"`
Fans []*AppStat `json:"fans"`
Comment []*AppStat `json:"comment"`
Show int8 `json:"show"`
}
// ViewerTrend for up trend data.
type ViewerTrend struct {
Tag map[int]string `json:"tag"`
Ty map[string]int64 `json:"ty"`
}
// ViewerIncr for up increment data.
type ViewerIncr struct {
Arcs []*ArcInc `json:"arc_inc"`
TotalIncr int `json:"total_inc"`
TyRank map[string]int `json:"type_rank"`
}
// ArcInc for archive increment data.
type ArcInc struct {
AID int64 `json:"aid"`
Incr int `json:"incr"`
Title string `json:"title"`
DayTime int64 `json:"daytime"`
PTime xtime.Time `json:"ptime"`
}
// PeriodTip period tip for data.
type PeriodTip struct {
ModuleOne string `json:"module_one"`
ModuleTwo string `json:"module_two"`
ModuleThree string `json:"module_three"`
ModuleFour string `json:"module_four"`
}
// AppViewerIncr for up increment data.
type AppViewerIncr struct {
DateKey int64 `json:"date_key"`
Arcs []*ArcInc `json:"arc_inc"`
TotalIncr int `json:"total_inc"`
TyRank []*Rank `json:"type_rank"`
}
// ThirtyDay for 30 days data.
type ThirtyDay struct {
DateKey int64 `json:"date_key"`
TotalIncr int64 `json:"total_inc"`
}
// Rank type rank for up data.
type Rank struct {
Name string `json:"name"`
Rank int `json:"rank"`
}
// CreatorDataShow for display archive/article data module.
type CreatorDataShow struct {
Archive int `json:"archive"`
Article int `json:"article"`
}
// AppFan for stat.
type AppFan struct {
Summary map[string]int64 `json:"summary"`
RankMap map[string]map[string]int32 `json:"-"`
TypeList map[string]int64 `json:"type_list"`
TagList []*Rank `json:"tag_list"`
ViewerArea map[string]int64 `json:"viewer_area"`
ViewerBase *ViewerBase `json:"viewer_base"`
}
//AppOverView for data overview.
type AppOverView struct {
Stat *Stat `json:"stat"`
AllArcIncr []*ThirtyDay `json:"all_arc_inc"`
SingleArcInc []*ArcInc `json:"single_arc_inc"`
}
//VideoQuit customer play Retention Rate
type VideoQuit struct {
Point []int64 `json:"point"`
Duration []int64 `json:"duration"`
}
//for fan manager top mids.
const (
//Total 粉丝管理-累计数据
Total = iota
//Seven 粉丝管理-7日数据
Seven
//Thirty 粉丝管理-30日数据
Thirty
//Ninety 粉丝管理-90日数据
Ninety
//PlayDuration 播放时长
PlayDuration = "video_play"
//VideoAct 视频互动
VideoAct = "video_act"
//DynamicAct 动态互动
DynamicAct = "dynamic_act"
)
// WebFan for stat.
type WebFan struct {
RankMap map[string]map[string]int32 `json:"-"`
Summary map[string]int32 `json:"summary"`
RankList map[string][]*RankInfo `json:"rank_list"`
RankMedal map[string][]*medal.FansRank `json:"rank_medal"`
Source map[string]int32 `json:"source"`
}
// FansAnalysis for medal fans.
type FansAnalysis struct {
F map[string]int32 `family:"f"`
T map[string]int32 `family:"t"`
S map[string]int32 `family:"s"`
}
//FansAnalysisByF for f family
type FansAnalysisByF struct {
All int32 `family:"f" qualifier:"all" json:"total"` //总粉丝
Inc int32 `family:"f" qualifier:"inc" json:"inc"` //新增粉丝
Act int32 `family:"f" qualifier:"act" json:"active"` //活跃粉丝
Mdl int32 `family:"f" qualifier:"mdl" json:"medal"` //领取勋章粉丝
Elec int32 `family:"f" qualifier:"elec" json:"elec"` //充电粉丝
ActDiff int32 `family:"f" qualifier:"act_diff" json:"act_diff"` //活跃粉丝(增量)
MdlDiff int32 `family:"f" qualifier:"mdl_diff" json:"mdl_diff"` //领取勋章粉丝(增量)
ElecDiff int32 `family:"f" qualifier:"elec_diff" json:"elec_diff"` //领取勋章粉丝(增量)
Play int32 `family:"f" qualifier:"v" json:"v"` //播放粉丝占比*10000
Dm int32 `family:"f" qualifier:"dm" json:"dm"` //弹幕粉丝占比*10000
Reply int32 `family:"f" qualifier:"r" json:"r"` //评论粉丝占比*10000
Coin int32 `family:"f" qualifier:"c" json:"c"` //投币粉丝占比*10000
//粉丝活跃占比
InterRatio int32 `family:"f" qualifier:"inter" json:"inter"` //互动活跃度*10000
PlayRatio int32 `family:"f" qualifier:"vv" json:"vv"` //观看活跃度*10000
DanmuRatio int32 `family:"f" qualifier:"da" json:"da"` //弹幕活跃度占比*10000
ReplyRatio int32 `family:"f" qualifier:"re" json:"re"` //评论活跃度占比*10000
CoinRatio int32 `family:"f" qualifier:"co" json:"co"` //投币活跃度占比*10000
FavRatio int32 `family:"f" qualifier:"fv" json:"fv"` //收藏活跃度占比*10000
ShareRatio int32 `family:"f" qualifier:"sh" json:"sh"` //投币活跃度占比*10000
LikeRatio int32 `family:"f" qualifier:"lk" json:"lk"` //收藏活跃度占比*10000
//3.4需求
NewAct int32 `family:"f" qualifier:"new_act" json:"new_act"` //活跃粉丝数字段
NewInter int32 `family:"f" qualifier:"new_inter" json:"new_inter"` //互动活跃度字段
NewReply int32 `family:"f" qualifier:"new_re" json:"new_re"` //评论
NewDanmu int32 `family:"f" qualifier:"new_da" json:"new_da"` //弹幕
NewCoin int32 `family:"f" qualifier:"new_co" json:"new_co"` //投币
NewLike int32 `family:"f" qualifier:"new_lk" json:"new_lk"` //投币
NewFav int32 `family:"f" qualifier:"new_fv" json:"new_fv"` //投币
NewShare int32 `family:"f" qualifier:"new_sh" json:"new_sh"` //投币
LiveDanmu int32 `family:"f" qualifier:"live_dm" json:"live_dm"` //直播弹幕
LiveCoin int32 `family:"f" qualifier:"live_coin" json:"live_coin"` //直播送礼
}
//FansAnalysisByT for family t
type FansAnalysisByT struct {
PlayDuration map[string]int32 `family:"t" qualifier:"dr" json:"dr"` //播放时长排行
VidoeAction map[string]int32 `family:"t" qualifier:"act" json:"act"` //视频互动量排行
DynamicAction map[string]int32 `family:"t" qualifier:"dy" json:"dy"` //动态互动量排行
}
//FansAnalysisByS for family s
type FansAnalysisByS struct { //粉丝来源页面占比
Space int32 `family:"s" qualifier:"pf1" json:"space"` //视频互动量排行
Main int32 `family:"s" qualifier:"pf2" json:"main"` //主站播放页
Live int32 `family:"s" qualifier:"pf4" json:"live"` //直播
Audio int32 `family:"s" qualifier:"pf5" json:"audio"` // 音乐
Article int32 `family:"s" qualifier:"pf6" json:"article"` // 文章
}
// RankInfo str
type RankInfo struct {
MID int64 `json:"mid"`
Uname string `json:"uname"`
Photo string `json:"photo"`
Relation int `json:"relation"`
}
// PlaySource for play soucre.
type PlaySource struct {
PlayProportion map[string]int32 `json:"play_proportion"`
PageSource map[string]int32 `json:"page_source"`
}
// ArchivePlay for archive play.
type ArchivePlay struct {
AID int64 `json:"aid"`
View int32 `json:"view"`
Rate int32 `json:"rate"`
CTime int32 `json:"ctime"`
Duration int64 `json:"duration"`
AvgDuration int64 `json:"avg_duration"`
Title string `json:"title"`
}
//ArchivePlayList for arc play list.
type ArchivePlayList struct {
ArcPlayList []*ArchivePlay `json:"arc_play_list"`
}
// UpFansMedal for medal fans.
type UpFansMedal struct {
MedalFans int32 `family:"f" qualifier:"medal_fans" json:"medal_fans"` //领取勋章数
WearMedalFans int32 `family:"f" qualifier:"wear_medal_fans" json:"wear_medal_fans"` //佩戴勋章数
}
// Tip for base survey.
func Tip() (pt *PeriodTip) {
pt = &PeriodTip{
ModuleOne: "各维度每日12:00 a.m. 更新前一日数据",
ModuleTwo: "每日12:00 a.m. 更新前一日数据",
ModuleThree: "每周二12:00 a.m. 更新前一周数据",
ModuleFour: "各维度每日12:00 a.m. 更新前一日数据",
}
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 = ["elec.go"],
importpath = "go-common/app/interface/main/creative/model/elec",
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,211 @@
package elec
import (
"encoding/json"
"time"
xtime "go-common/library/time"
)
// UserState user elec state.
type UserState struct {
ID string `json:"-"`
Mid string `json:"mid"`
State string `json:"state"`
Reason string `json:"reason"`
Count string `json:"-"`
CTime string `json:"-"`
MTime string `json:"-"`
}
// UserInfo user elec info.
type UserInfo struct {
ID int64 `json:"-"`
Mid int64 `json:"mid"`
State int16 `json:"state"`
Reason string `json:"reason"`
Count int16 `json:"-"`
CTime xtime.Time `json:"-"`
MTime xtime.Time `json:"-"`
}
// ArcState arc elec info.
type ArcState struct {
Show bool `json:"show"`
State int16 `json:"state"`
Total int `json:"total"`
Count int `json:"count"`
Reason string `json:"reason"`
List json.RawMessage `json:"list,omitempty"`
User json.RawMessage `json:"user,omitempty"`
}
// Notify up-to-date info to user
type Notify struct {
Content string `json:"content"`
}
// EleRelation get elec relation.
type EleRelation struct {
RetList []struct {
Mid int64 `json:"mid"`
IsElec bool `json:"is_elec"`
} `json:"ret_list"`
}
// Status elec setting.
type Status struct {
Specialday int8 `json:"display_specialday"`
}
// Rank up rank.
type Rank struct {
MID int64 `json:"mid"`
PayMID int64 `json:"pay_mid"`
Rank int64 `json:"rank"`
Uname string `json:"uname"`
Avatar string `json:"avatar"`
IsFriend bool `json:"isfriend"`
MTime string `json:"mtime"`
}
// BillList daily bill list.
type BillList struct {
List []*Bill `json:"list"`
TotalCount int `json:"totalCount"`
Pn int `json:"pn"`
Ps int `json:"ps"`
}
// Bill bill detail.
type Bill struct {
ID int64 `json:"id"`
MID int64 `json:"mid"`
ChannelType int8 `json:"channelType"`
ChannelTyName string `json:"channelTypeName"`
AddNum float32 `json:"addNum"`
ReduceNum float32 `json:"reduceNum"`
WalletBalance float32 `json:"walletBalance"`
DateVersion string `json:"dateVersion"`
Weekday string `json:"weekday"`
Remark string `json:"remark"`
MonthBillResp *MonthBill `json:"monthBillResp"`
}
// MonthBill month bill.
type MonthBill struct {
LastMonthNum float32 `json:"last_month_num"`
ServiceNum float32 `json:"service_num"`
BkNum float32 `json:"bk_num"`
}
// Balance get battery balance.
type Balance struct {
Ts string `json:"ts"`
BrokerageAudit int8 `json:"brokerage_audit"`
BpayAcc *BpayAccount `json:"bpay_account"`
Wallet *Wall `json:"wallet"`
}
// BpayAccount shell detail.
type BpayAccount struct {
Brokerage float32 `json:"brokerage"`
DefaultBp float32 `json:"default_bp"`
}
// Wall wallet detail.
type Wall struct {
MID int64 `json:"mid"`
Balance float32 `json:"balance"`
SponsorBalance float32 `json:"sponsorBalance"`
Ver int32 `json:"-"`
}
// ChargeBill daily bill for app charge.
type ChargeBill struct {
List []*Bill `json:"list"`
Pager struct {
Current int `json:"current"`
Size int `json:"size"`
Total int `json:"total"`
} `json:"pager"`
}
// RecentElec recent detail for app.
type RecentElec struct {
AID int64 `json:"aid"`
MID int64 `json:"mid"`
ElecNum float32 `json:"elec_num"`
Title string `json:"title"`
Uname string `json:"uname"`
Avatar string `json:"avatar"`
OrderNO string `json:"-"`
CTime string `json:"ctime"`
}
// RecentElecList recent list for app.
type RecentElecList struct {
List []*RecentElec `json:"list"`
Pager struct {
Current int `json:"current"`
Size int `json:"size"`
Total int `json:"total"`
} `json:"pager"`
}
// RemarkList remark list.
type RemarkList struct {
List []*Remark `json:"list"`
Pager struct {
Current int `json:"current"`
Size int `json:"size"`
Total int `json:"total"`
} `json:"pager"`
}
// Remark remark detail.
type Remark struct {
ID int64 `json:"id"`
AID int64 `json:"aid"`
MID int64 `json:"mid"`
ReplyMID int64 `json:"reply_mid"`
ElecNum int64 `json:"elec_num"`
State int8 `json:"state"`
Msg string `json:"msg"`
ArcName string `json:"aname"`
Uname string `json:"uname"`
Avator string `json:"avator"`
ReplyName string `json:"reply_name"`
ReplyAvator string `json:"reply_avator"`
ReplyMsg string `json:"reply_msg"`
CTime xtime.Time `json:"ctime"`
ReplyTime xtime.Time `json:"reply_time"`
}
// Earnings for elec.
type Earnings struct {
State int8 `json:"state"`
Balance float32 `json:"balance"`
Brokerage float32 `json:"brokerage"`
}
// Weekday get day.
func Weekday(t time.Time) (w string) {
switch t.Weekday().String() {
case "Monday":
w = "周一"
case "Tuesday":
w = "周二"
case "Wednesday":
w = "周三"
case "Thursday":
w = "周四"
case "Friday":
w = "周五"
case "Saturday":
w = "周六"
case "Sunday":
w = "周日"
}
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 = ["faq.go"],
importpath = "go-common/app/interface/main/creative/model/faq",
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,45 @@
package faq
import "go-common/library/time"
// PhoneFaqName const
const (
PhoneFaqName = "手机投稿FAQ"
PhoneFaqQuesTypeID = "7e8eb6dca628490b9f2c089c8c751329"
PadFaqName = "iPad投稿FAQ"
PadFaqQuesTypeID = "ffd32371f3b94e95ad41e5c387ea62a0"
FaqUgcProtocolName = "UGC付费最新协议内容"
FaqUgcProtocolQuesTypeID = "b899fa132d9c4070b458d5898448f5e3"
)
// Faq str
type Faq struct {
State bool `json:"state"`
QuestionTypeID string `json:"questionTypeId"`
QuestionTypeName string `json:"questionTypeName"`
URL string `json:"url"`
}
// Detail help detail and search
type Detail struct {
AllTypeName string `json:"allTypeName"`
AnswerDesc string `json:"answerDesc"`
AnswerFlag int `json:"answerFlag"`
AnswerID string `json:"answerId"`
AnswerImg string `json:"answerImg"`
AnswerTxt string `json:"answerTxt"`
AuditStatus int `json:"auditStatus"`
CompanyID string `json:"companyId"`
CreateID string `json:"createId"`
CreateTime time.Time `json:"createTime"`
DocID string `json:"docId"`
LinkFlag int `json:"linkFlag"`
MatchFlag int `json:"matchFlag"`
QuestionID string `json:"questionId"`
QuestionTitle string `json:"questionTitle"`
QuestionTypeID string `json:"questionTypeId"`
QuestionTypeName string `json:"questionTypeName"`
UpdateID string `json:"updateId"`
UpdateTime time.Time `json:"updateTime"`
UsedFlag int `json:"usedFlag"`
}

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 = ["feedback.go"],
importpath = "go-common/app/interface/main/creative/model/feedback",
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,47 @@
package feedback
import "go-common/library/time"
// Feedback feedback session.
type Feedback struct {
Session *Session `json:"session"`
Tag *Tag `json:"tag"`
}
// Reply feedback reply.
type Reply struct {
ReplyID string `json:"reply_id"`
Type int8 `json:"type"`
Content string `json:"content"`
ImgURL string `json:"img_url"`
CTime time.Time `json:"ctime"`
}
// Tag feedback tags.
type Tag struct {
ID int64 `json:"id"`
Name string `json:"name"`
Platform string `json:"-"`
}
// Session for Feedback.
type Session struct {
SessionID int64 `json:"id"`
Content string `json:"content"`
ImgURL string `json:"img_url"`
State int8 `json:"state"`
CTime time.Time `json:"ctime"`
}
// TagList list tag.
type TagList struct {
Platforms []*Platform `json:"platforms"`
Limit int `json:"limit"`
}
// Platform for tag info.
type Platform struct {
EN string `json:"en"`
ZH string `json:"zh"`
Tags []*Tag `json:"tags"`
}

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 = ["game.go"],
importpath = "go-common/app/interface/main/creative/model/game",
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,32 @@
package game
import (
xtime "go-common/library/time"
)
// ListItem str
type ListItem struct {
GameBaseID int64 `json:"game_base_id"`
GameName string `json:"game_name"`
Source int8 `json:"source"`
Letter string `json:"letter"`
}
// ListWithPager fn
type ListWithPager struct {
List []*ListItem `json:"list"`
Pn int `json:"pn"`
Ps int `json:"ps"`
Total int `json:"total"`
}
// Info str
type Info struct {
IsOnline bool `json:"is_online"`
BaseID int64 `json:"game_base_id"`
Name string `json:"game_name"`
Icon string `json:"game_icon"`
Link string `json:"game_link"`
Status int `json:"game_status"`
BeginDate xtime.Time `json:"begin_date"`
}

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/creative/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,15 @@
package geetest
// ProcessRes str
type ProcessRes struct {
Success int8 `json:"success"`
CaptchaID string `json:"gt"`
Challenge string `json:"challenge"`
NewCaptcha int `json:"new_captcha"`
Limit map[string]bool `json:"limit"`
}
// ValidateRes str
type ValidateRes struct {
Seccode string `json:"seccode"`
}

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 = ["growup.go"],
importpath = "go-common/app/interface/main/creative/model/growup",
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,88 @@
package growup
import "go-common/library/time"
//UpInfo get up state info
type UpInfo struct {
MID int64 `json:"mid"`
Fans int64 `json:"fans"` //粉丝数量
NickName string `json:"nickname"` //用户昵称
OriginalArcCount int `json:"original_archive_count"` //UP主原创投稿数
MainCategory int `json:"main_category"` //UP主主要投稿区ID
AccountState int `json:"account_state"` //账号状态; 1: 未申请; 2: 待审核; 3: 已签约; 4.已驳回; 5.主动退出; 6:被动退出; 7:封禁
SignType int8 `json:"sign_type"` //签约类型; 0: 基础, 1: 首发
QuitType int `json:"quit_type"` //退出类型: 0: 主动退出 1: 封禁; 2: 平台清退
ApplyAt time.Time `json:"apply_at"` //申请时间
CTime time.Time `json:"ctime"`
MTime time.Time `json:"mtime"`
}
//UpStatus get up status info
type UpStatus struct {
Blocked bool `json:"blocked"`
AccountType int `json:"account_type"` //账号类型 1-UGC 2- PGC
AccountState int `json:"account_state"` //账号状态; 1: 未申请; 2: 待审核; 3: 已签约; 4.已驳回; 5.主动退出; 6:被动退出; 7:封禁
ExpiredIn int64 `json:"expired_in"` //冷却过期天数
Reason string `json:"reason"` //封禁/驳回/清退(被动退出)理由
InWhiteList bool `json:"in_white_list"` //是否在白名单中blocked字段在第一期中被忽略第二期会去掉该字段
ArchiveType []int `json:"archive_type"` //投稿类型1视频2音频3专栏
ShowPanel bool `json:"show_panel"`
ShowPanelMsg string `json:"show_panel_msg"`
}
//Summary get summary income.
type Summary struct {
BreachMoney float64 `json:"breachMoney"` //违反金额
Income float64 `json:"income"` //当月收入
TotalIncome float64 `json:"totalIncome"` //累计收入
WaitWithdraw float64 `json:"waitWithdraw"` //带提现
Date string `json:"date"`
DayIncome float64 `json:"dayIncome"`
}
//Stat get statistic income.
type Stat struct {
ProportionDraw map[string]float64 `json:"proportionDraw"` //比例图
LineDraw []*LineDraw `json:"lineDraw"`
Tops []*TopArc `json:"tops"`
Desc string `json:"desc"`
}
//LineDraw for income data.
type LineDraw struct {
DateKey int64 `json:"dateKey"`
Income float64 `json:"income"`
}
//TopArc get top archive.
type TopArc struct {
AID int64 `json:"aid"`
Title string `json:"title"`
TypeName string `json:"typeName"` //type类型
TotalIncome float64 `json:"totalIncome"` //累计收入
}
//IncomeList get income list.
type IncomeList struct {
Page int `json:"page"`
TotalCount int `json:"total_count"`
Data []*struct {
AID int64 `json:"aid"`
Title string `json:"title"`
Income float64 `json:"income"` //当月收入
TotalIncome float64 `json:"totalIncome"` //累计收入
} `json:"data"`
}
//BreachList get reach list.
type BreachList struct {
Page int `json:"page"`
TotalCount int `json:"total_count"`
Data []*struct {
AID int64 `json:"aid"`
BreachTime int64 `json:"breachTime"` //时间戳
Money float64 `json:"money"` //扣除金额
Reason string `json:"reason"` //原因
Title string `json:"title"` //稿件标题
} `json:"data"`
}

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 = ["lottery.go"],
importpath = "go-common/app/interface/main/creative/model/lottery",
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,7 @@
package lottery
//Notice str
type Notice struct {
BizID int64 `json:"business_id"`
Status int `json:"status"`
}

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 = ["medal.go"],
importpath = "go-common/app/interface/main/creative/model/medal",
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,43 @@
package medal
// Status for medal status
type Status struct {
Enable bool `json:"enable"`
MedalID int64 `json:"medal_id"`
}
// Medal for fan medal
type Medal struct {
UID string `json:"uid"`
MedalName string `json:"medal_name"`
LiveStatus string `json:"live_status"`
MasterStatus string `json:"master_status"`
TimeToChange int64 `json:"time_able_change"`
RenameStatus int8 `json:"rename_status"`
Status string `json:"status"`
Reason string `json:"reason"`
Elec int64 `json:"charge_num"`
Coin int64 `json:"coin_num"`
}
// RecentFans for recent list
type RecentFans struct {
FansID int `json:"fans_id"`
FansName string `json:"fans_name"`
HeadURL string `json:"head_url"`
CTime string `json:"ctime"`
ReceiveTime string `json:"receive_time"`
}
// FansRank for fans rank
type FansRank struct {
UID int64 `json:"uid"`
Rank int64 `json:"rank"`
Score int64 `json:"score"`
Level int64 `json:"level"`
Uname string `json:"uname"`
MedalName string `json:"medal_name"`
Special string `json:"special"`
MedalColor int64 `json:"medal_color"`
Face string `json:"face"`
}

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 = ["message.go"],
importpath = "go-common/app/interface/main/creative/model/message",
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,10 @@
package message
// Message str
type Message struct {
ID int64 `json:"id"`
TimeStamp int64 `json:"timestamp"`
TimeAt string `json:"time_at"`
Title string `json:"title"`
Content string `json:"content"`
}

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 = ["monitor.go"],
importpath = "go-common/app/interface/main/creative/model/monitor",
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,6 @@
package monitor
// Tels my tel
const (
Tels = "18221167541,15757172528,13867305116"
)

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 = ["music.go"],
importpath = "go-common/app/interface/main/creative/model/music",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = [
"//app/interface/main/creative/model/activity:go_default_library",
"//app/interface/main/creative/model/app:go_default_library",
"//app/service/main/account/model:go_default_library",
"//app/service/main/archive/api:go_default_library",
"//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,339 @@
package music
import (
"encoding/json"
"go-common/app/interface/main/creative/model/activity"
"go-common/app/interface/main/creative/model/app"
accMdl "go-common/app/service/main/account/model"
"go-common/app/service/main/archive/api"
"go-common/library/time"
)
var (
platMap = map[string][]int{
"android": {0, 1},
"ios": {0, 2},
}
// ViewTpMap map
ViewTpMap = map[int8]string{
0: "subtitle",
1: "font",
2: "filter",
5: "sticker",
7: "videoup_sticker",
8: "transition",
9: "cooperate",
10: "theme",
}
)
// BuildComp str
type BuildComp struct {
Condition int8 `json:"conditions"`
Build int `json:"build"`
}
// AllowMaterial fn
// 1:platform first; 2:build alg; 3:user whitelist
func (v *Material) AllowMaterial(m Material, platStr string, buildParam int, white bool) (ret bool) {
if v.White == 1 && !white {
return false
}
if v.Platform == 0 {
return true
}
platOK := false
for _, num := range platMap[platStr] {
if m.Platform == num {
platOK = true
}
}
buildOK := true
for _, v := range m.BuildComps {
if !app.AllowBuild(buildParam, v.Condition, v.Build) {
buildOK = false
}
}
return buildOK && platOK
}
// Music str
type Music struct {
ID int64 `json:"id"`
TID int `json:"tid"`
Index int `json:"index"`
SID int64 `json:"sid"`
Name string `json:"name"`
Musicians string `json:"musicians"`
UpMID int64 `json:"mid"`
Cover string `json:"cover"`
Stat string `json:"stat"`
Playurl string `json:"playurl"`
State int `json:"state"`
Duration int `json:"duration"`
FileSize int `json:"filesize"`
CTime time.Time `json:"ctime"`
Pubtime time.Time `json:"pubtime"`
MTime time.Time `json:"mtime"`
TagsStr string `json:"-"`
Tags []string `json:"tags"`
Timeline json.RawMessage `json:"-"`
Tl []*TimePoint `json:"timeline"`
RecommendPoint int64 `json:"recommend_point"`
Cooperate int8 `json:"cooperate"`
CooperateURL string `json:"cooperate_url"`
New int8 `json:"new"`
Hotval int `json:"hotval"`
}
// BgmExt str
type BgmExt struct {
Msc *Music `json:"msc"`
ExtMscs []*Music `json:"ext_mscs"`
ExtArcs []*api.Arc `json:"ext_arcs"`
UpProfile *accMdl.Profile `json:"up_profile"`
ShouldFollow bool `json:"show_follow"`
}
// TimePoint str
type TimePoint struct {
Point int64 `json:"point"`
Comment string `json:"comment"`
Recommend int `json:"recommend"`
}
// Category str
type Category struct {
ID int `json:"id"`
PID int `json:"pid"`
Name string `json:"name"`
Index int `json:"index"`
CameraIndex int `json:"camera_index"`
Children []*Music `json:"children"`
}
// Mcategory str
type Mcategory struct {
ID int64 `json:"id"`
SID int64 `json:"sid"`
Tid int `json:"tid"`
Index int `json:"index"`
CTime time.Time `json:"ctime"`
New int8 `json:"new"`
}
// Audio str
type Audio struct {
Title string `json:"title"`
Cover string `json:"cover_url"`
}
// Material str
type Material struct {
Type int8 `json:"type"`
Platform int `json:"platform"`
Build json.RawMessage `json:"build"`
BuildComps []*BuildComp `json:"build_comps"`
White int8 `json:"white"`
New int8 `json:"new"`
}
// Basic str
type Basic struct {
ID int64 `json:"id"`
Name string `json:"name"`
Cover string `json:"cover"`
DownloadURL string `json:"download_url"`
Rank int `json:"rank"`
Max int `json:"max"`
Extra json.RawMessage `json:"-"`
Material `json:"-"`
MTime time.Time `json:"mtime"`
Tags []string `json:"tags"`
}
// Cooperate str db+search+api
type Cooperate struct {
ID int64 `json:"id"`
Name string `json:"name"`
Cover string `json:"cover"`
Rank int `json:"rank"`
Extra json.RawMessage `json:"-"`
Material `json:"-"`
MTime time.Time `json:"mtime"`
New int8 `json:"new"`
Tags []string `json:"tags"`
// special extra column for cooperate
MaterialAID int64 `json:"material_aid"`
MaterialCID int64 `json:"material_cid"`
DemoAID int64 `json:"demo_aid"`
DemoCID int64 `json:"demo_cid"`
MissionID int64 `json:"mission_id"`
SubType int `json:"sub_type"`
Style int `json:"style"`
Mission *activity.Activity `json:"mission_info"`
HotVal int `json:"hotval"`
ArcCnt int `json:"-"`
DownloadURL string `json:"download_url"`
}
// Subtitle str
type Subtitle struct {
ID int64 `json:"id"`
Name string `json:"name"`
Cover string `json:"cover"`
DownloadURL string `json:"download_url"`
Rank int `json:"rank"`
Max int `json:"max"`
Extra json.RawMessage `json:"-"`
Material `json:"-"`
MTime time.Time `json:"mtime"`
New int8 `json:"new"`
Tags []string `json:"tags"`
}
// Font str
type Font struct {
ID int64 `json:"id"`
Name string `json:"name"`
Cover string `json:"cover"`
DownloadURL string `json:"download_url"`
Rank int `json:"rank"`
Extra json.RawMessage `json:"-"`
Material `json:"-"`
MTime time.Time `json:"mtime"`
New int8 `json:"new"`
Tags []string `json:"tags"`
}
// Filter str
type Filter struct {
ID int64 `json:"id"`
Name string `json:"name"`
Cover string `json:"cover"`
DownloadURL string `json:"download_url"`
Rank int `json:"rank"`
Extra json.RawMessage `json:"-"`
Material `json:"-"`
MTime time.Time `json:"mtime"`
New int8 `json:"new"`
Tags []string `json:"tags"`
FilterType int8 `json:"filter_type"`
}
// VSticker str
type VSticker struct {
ID int64 `json:"id"`
Name string `json:"name"`
Cover string `json:"cover"`
DownloadURL string `json:"download_url"`
Rank int `json:"rank"`
Extra json.RawMessage `json:"-"`
Material `json:"-"`
MTime time.Time `json:"mtime"`
New int8 `json:"new"`
Tags []string `json:"tags"`
}
// Transition str
type Transition struct {
ID int64 `json:"id"`
Name string `json:"name"`
Cover string `json:"cover"`
DownloadURL string `json:"download_url"`
Rank int `json:"rank"`
Extra json.RawMessage `json:"-"`
Material `json:"-"`
MTime time.Time `json:"mtime"`
New int8 `json:"new"`
Tags []string `json:"tags"`
}
// Theme str
type Theme struct {
ID int64 `json:"id"`
Name string `json:"name"`
Cover string `json:"cover"`
DownloadURL string `json:"download_url"`
Rank int `json:"rank"`
Extra json.RawMessage `json:"-"`
Material `json:"-"`
MTime time.Time `json:"mtime"`
New int8 `json:"new"`
Tags []string `json:"tags"`
}
// Sticker str
type Sticker struct {
ID int64 `json:"id"`
Name string `json:"name"`
Cover string `json:"cover"`
DownloadURL string `json:"download_url"`
Rank int `json:"rank"`
Extra json.RawMessage `json:"-"`
Material `json:"-"`
SubType int64 `json:"sub_type"`
Tip string `json:"tip"`
MTime time.Time `json:"mtime"`
New int8 `json:"new"`
Tags []string `json:"tags"`
}
// Hotword str
type Hotword struct {
ID int64 `json:"id"`
Name string `json:"name"`
Cover string `json:"cover"`
DownloadURL string `json:"download_url"`
Rank int `json:"rank"`
Extra json.RawMessage `json:"-"`
Material `json:"-"`
MTime time.Time `json:"mtime"`
New int8 `json:"new"`
Tags []string `json:"tags"`
}
// Intro str
type Intro struct {
ID int64 `json:"id"`
Name string `json:"name"`
Cover string `json:"cover"`
DownloadURL string `json:"download_url"`
Rank int `json:"rank"`
Extra json.RawMessage `json:"-"`
Material `json:"-"`
MTime time.Time `json:"mtime"`
New int8 `json:"new"`
Tags []string `json:"tags"`
}
// MaterialBind str
type MaterialBind struct {
CID int64
MID int64
CName string
CRank int
BRank int
Tp int
New int
}
// FilterCategory str
type FilterCategory struct {
ID int64 `json:"id"`
Name string `json:"name"`
Rank int `json:"rank"`
Tp int `json:"type"`
Children []*Filter `json:"children"`
New int `json:"new"`
}
// VstickerCategory str
type VstickerCategory struct {
ID int64 `json:"id"`
Name string `json:"name"`
Rank int `json:"rank"`
Tp int `json:"type"`
Children []*VSticker `json:"children"`
New int `json:"new"`
}

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 = ["task.go"],
importpath = "go-common/app/interface/main/creative/model/newcomer",
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,636 @@
package newcomer
import (
"go-common/library/time"
)
const (
//RewardCanActivate reward receive state 0-可激活 >1-已激活不可点击>2-已过期不可点击
RewardCanActivate int8 = iota
//RewardActivatedNotClick reward activated state 1-已激活不可点击
RewardActivatedNotClick
//RewardExpireNotClick reward activated state 2-已过期不可点击
RewardExpireNotClick
)
const (
//DefualtTaskType 0-默认任务
DefualtTaskType int8 = iota
// NewcomerTaskType 1-新手任务
NewcomerTaskType
// AdvancedTaskType 2-进阶任务
AdvancedTaskType
// MonthTaskType 3-月常任务
MonthTaskType
)
const (
_ int8 = iota
// Bcoin 1-B币券
Bcoin
// BigMember 2-大会员服务
BigMember
// MemberBuy 3-会员购
MemberBuy
// IncentivePlan 4-激励计划
IncentivePlan
// PersonalCenter 5-个人中心
PersonalCenter
)
const (
//UserTaskLevel0 未解锁任务
UserTaskLevel0 int8 = iota
//UserTaskLevel01 只解锁新手任务
UserTaskLevel01
//UserTaskLevel02 解锁新手与进阶任务
UserTaskLevel02
)
const (
//FreezeState 任务或奖励被冻结状态
FreezeState = -1
//NormalState 任务或奖励正常状态
NormalState = 0
//HiddenState 任务或奖励隐藏状态
HiddenState = 1
//RewardBaseType 基础奖励
RewardBaseType = 0
//RewardGiftType 礼包奖励
RewardGiftType = 1
//NoBindTask 用户未绑定任务
NoBindTask = -1
//BindTask 用户已绑定任务
BindTask = 0
//TaskIncomplete 任务未完成
TaskIncomplete = -1
//TaskCompleted 任务完成
TaskCompleted = 0
//RewardNotAvailable 奖励不可领取
RewardNotAvailable = -1
//RewardAvailable 奖励可领取
RewardAvailable = 0
//RewardReceived 奖励已领取
RewardReceived = 1
//RewardUnlock 奖励未解锁
RewardUnlock = 2
//RewardNeedActivate 奖励可激活
RewardNeedActivate = 1
//RewardNoneedActivate 奖励不可激活
RewardNoneedActivate = 0
//FromWeb web端
FromWeb = 1
//FromH5 h5端
FromH5 = 2
)
const (
_ int8 = iota
//TargetType001 该UID下开放浏览的稿件≥1
TargetType001
//TargetType002 该UID分享自己视频的次数≥1
TargetType002
//TargetType003 该UID在创作学院的观看记录≥1
TargetType003
//TargetType004 该UID下所有avid的获得评论数≥3
TargetType004
//TargetType005 该UID下所有avid获得分享数≥3
TargetType005
//TargetType006 该UID的所有avid的获得收藏数≥5
TargetType006
//TargetType007 该UID下所有avid的获得硬币数≥5
TargetType007
//TargetType008 该UID下所有avid获得点赞数≥5
TargetType008
//TargetType009 该UID下所有avid的获得弹幕数≥5
TargetType009
//TargetType010 该UID的粉丝数≥10
TargetType010
//TargetType011 任务完成期间该UID的水印开关为打开状态
TargetType011
//TargetType012 该UID的关注列表含有“哔哩哔哩创作中心”
TargetType012
//TargetType013 用手机投稿上传视频
TargetType013
//TargetType014 该UID下开放浏览的稿件≥5
TargetType014
//TargetType015 该UID下任意avid的获得点击量≥1000
TargetType015
//TargetType016 该UID下任意avid的评论≥30
TargetType016
//TargetType017 该UID下任意avid的获得分享数≥10
TargetType017
//TargetType018 该UID下任意avid的获得收藏数≥30
TargetType018
//TargetType019 该UID下任意avid的获得硬币数≥50
TargetType019
//TargetType020 该UID下任意avid的获得点赞数≥50
TargetType020
//TargetType021 该UID下任意avid的获得弹幕数≥50
TargetType021
//TargetType022 该UID的粉丝数≥1000
TargetType022
//TargetType023 该UID的激励计划状态为已开通
TargetType023
//TargetType024 该UID粉丝勋章为开启状态
TargetType024
)
const (
_ int8 = iota
//ArcUpCount UpCount get archives count
ArcUpCount
//AcaPlayCount get all play achive count.
AcaPlayCount
//DataUpStat get up stat from hbase
DataUpStat
//AccProfileWithStat get account
AccProfileWithStat
//WmWaterMark get watermark.
WmWaterMark
//AccRelation get all relation state.
AccRelation
//DataUpArchiveStat 获取最高播放/评论/弹幕/...数
DataUpArchiveStat
//OrderGrowAccountState 获取up主状态 type 类型 0 视频 2 专栏 3 素材.
OrderGrowAccountState
//MedalCheckMedal get medal
MedalCheckMedal
)
const (
//MsgFinishedCount 发送未完成任务状态
MsgFinishedCount = 1
//MsgForWaterMark 发送用户设置水印消息
MsgForWaterMark = 1
//MsgForAcademyFavVideo 发送用户已在创作学院观看过自己喜欢的视频的消息
MsgForAcademyFavVideo = 2
//MsgForGrowAccount 发送用户已在参加激励计划的消息
MsgForGrowAccount = 3
//MsgForOpenFansMedal 成功开通粉丝勋章
MsgForOpenFansMedal = 4
)
var (
// TaskRedirectMap task map for app
TaskRedirectMap = map[string]map[int8][]string{
"android": {
TargetType001: []string{"去投稿", "bilibili://uper/user_center/add_archive/"},
TargetType002: []string{"去分享", "activity://uper/manuscript-list/"},
TargetType003: []string{"前往", "https://member.bilibili.com/college?from=task"},
TargetType004: []string{"前往", "activity://uper/manuscript-list/"},
TargetType005: []string{"前往", "activity://uper/manuscript-list/"},
TargetType006: []string{"前往", "activity://uper/manuscript-list/"},
TargetType007: []string{"前往", "activity://uper/manuscript-list/"},
TargetType008: []string{"前往", "activity://uper/manuscript-list/"},
TargetType009: []string{"前往", "activity://uper/manuscript-list/"},
TargetType010: []string{"前往", "activity://uper/manuscript-list/"},
TargetType011: []string{"去设置", "https://member.bilibili.com/studio/gabriel/watermark"},
TargetType012: []string{"去关注", ""},
TargetType013: []string{"去投稿", "bilibili://uper/user_center/add_archive/"},
TargetType014: []string{"去投稿", "bilibili://uper/user_center/add_archive/"},
TargetType015: []string{"前往", "activity://uper/manuscript-list/"},
TargetType016: []string{"前往", "activity://uper/manuscript-list/"},
TargetType017: []string{"前往", "activity://uper/manuscript-list/"},
TargetType018: []string{"前往", "activity://uper/manuscript-list/"},
TargetType019: []string{"前往", "activity://uper/manuscript-list/"},
TargetType020: []string{"前往", "activity://uper/manuscript-list/"},
TargetType021: []string{"前往", "activity://uper/manuscript-list/"},
TargetType022: []string{"前往", "https://member.bilibili.com/studio/gabriel/fans-manage/overview"},
TargetType023: []string{"去加入", "https://member.bilibili.com/studio/up-allowance-h5#/"},
TargetType024: []string{"去开通", "https://member.bilibili.com/studio/gabriel/fans-manage/medal"},
},
"ios": {TargetType001: []string{"去投稿", "/uper/user_center/add_archive/"},
TargetType002: []string{"去分享", "/uper/user_center/archive_list"},
TargetType003: []string{"前往", "https://member.bilibili.com/college?from=task"},
TargetType004: []string{"前往", "/uper/user_center/archive_list"},
TargetType005: []string{"前往", "/uper/user_center/archive_list"},
TargetType006: []string{"前往", "/uper/user_center/archive_list"},
TargetType007: []string{"前往", "/uper/user_center/archive_list"},
TargetType008: []string{"前往", "/uper/user_center/archive_list"},
TargetType009: []string{"前往", "/uper/user_center/archive_list"},
TargetType010: []string{"前往", "/uper/user_center/archive_list"},
TargetType011: []string{"去设置", "https://member.bilibili.com/studio/gabriel/watermark"},
TargetType012: []string{"去关注", ""},
TargetType013: []string{"去投稿", "/uper/user_center/add_archive/"},
TargetType014: []string{"去投稿", "/uper/user_center/add_archive/"},
TargetType015: []string{"前往", "/uper/user_center/archive_list"},
TargetType016: []string{"前往", "/uper/user_center/archive_list"},
TargetType017: []string{"前往", "/uper/user_center/archive_list"},
TargetType018: []string{"前往", "/uper/user_center/archive_list"},
TargetType019: []string{"前往", "/uper/user_center/archive_list"},
TargetType020: []string{"前往", "/uper/user_center/archive_list"},
TargetType021: []string{"前往", "/uper/user_center/archive_list"},
TargetType022: []string{"前往", "https://member.bilibili.com/studio/gabriel/fans-manage/overview"},
TargetType023: []string{"去加入", "https://member.bilibili.com/studio/up-allowance-h5#/"},
TargetType024: []string{"去开通", "https://member.bilibili.com/studio/gabriel/fans-manage/medal"},
},
}
// H5RedirectMap task map for app
H5RedirectMap = map[string]map[int8][]string{
"android": {
TargetType001: []string{"去投稿", "bilibili://uper/user_center/add_archive/"},
TargetType002: []string{"去分享", "bilibili://uper/user_center/manuscript-list/"},
TargetType003: []string{"前往", "https://member.bilibili.com/college?from=task"},
TargetType004: []string{"前往", "bilibili://uper/user_center/manuscript-list/"},
TargetType005: []string{"前往", "bilibili://uper/user_center/manuscript-list/"},
TargetType006: []string{"前往", "bilibili://uper/user_center/manuscript-list/"},
TargetType007: []string{"前往", "bilibili://uper/user_center/manuscript-list/"},
TargetType008: []string{"前往", "bilibili://uper/user_center/manuscript-list/"},
TargetType009: []string{"前往", "bilibili://uper/user_center/manuscript-list/"},
TargetType010: []string{"前往", "bilibili://uper/user_center/manuscript-list/"},
TargetType011: []string{"去设置", "https://member.bilibili.com/studio/gabriel/watermark"},
TargetType012: []string{"去关注", "去关注"},
TargetType013: []string{"去投稿", "bilibili://uper/user_center/add_archive/"},
TargetType014: []string{"去投稿", "bilibili://uper/user_center/add_archive/"},
TargetType015: []string{"前往", "bilibili://uper/user_center/manuscript-list/"},
TargetType016: []string{"前往", "bilibili://uper/user_center/manuscript-list/"},
TargetType017: []string{"前往", "bilibili://uper/user_center/manuscript-list/"},
TargetType018: []string{"前往", "bilibili://uper/user_center/manuscript-list/"},
TargetType019: []string{"前往", "bilibili://uper/user_center/manuscript-list/"},
TargetType020: []string{"前往", "bilibili://uper/user_center/manuscript-list/"},
TargetType021: []string{"前往", "bilibili://uper/user_center/manuscript-list/"},
TargetType022: []string{"前往", "https://member.bilibili.com/studio/gabriel/fans-manage/overview"},
TargetType023: []string{"去加入", "https://member.bilibili.com/studio/up-allowance-h5#/"},
TargetType024: []string{"去开通", "https://member.bilibili.com/studio/gabriel/fans-manage/medal"},
},
"ios": {TargetType001: []string{"去投稿", "/uper/user_center/add_archive/"},
TargetType002: []string{"去分享", "/uper/user_center/archive_list"},
TargetType003: []string{"前往", "https://member.bilibili.com/college?from=task"},
TargetType004: []string{"前往", "/uper/user_center/archive_list"},
TargetType005: []string{"前往", "/uper/user_center/archive_list"},
TargetType006: []string{"前往", "/uper/user_center/archive_list"},
TargetType007: []string{"前往", "/uper/user_center/archive_list"},
TargetType008: []string{"前往", "/uper/user_center/archive_list"},
TargetType009: []string{"前往", "/uper/user_center/archive_list"},
TargetType010: []string{"前往", "/uper/user_center/archive_list"},
TargetType011: []string{"去设置", "https://member.bilibili.com/studio/gabriel/watermark"},
TargetType012: []string{"去关注", "去关注"},
TargetType013: []string{"去投稿", "/uper/user_center/add_archive/"},
TargetType014: []string{"去投稿", "/uper/user_center/add_archive/"},
TargetType015: []string{"前往", "/uper/user_center/archive_list"},
TargetType016: []string{"前往", "/uper/user_center/archive_list"},
TargetType017: []string{"前往", "/uper/user_center/archive_list"},
TargetType018: []string{"前往", "/uper/user_center/archive_list"},
TargetType019: []string{"前往", "/uper/user_center/archive_list"},
TargetType020: []string{"前往", "/uper/user_center/archive_list"},
TargetType021: []string{"前往", "/uper/user_center/archive_list"},
TargetType022: []string{"前往", "https://member.bilibili.com/studio/gabriel/fans-manage/overview"},
TargetType023: []string{"去加入", "https://member.bilibili.com/studio/up-allowance-h5#/"},
TargetType024: []string{"去开通", "https://member.bilibili.com/studio/gabriel/fans-manage/medal"},
},
}
// TaskGroupTipMap taskGroup tips for h5
TaskGroupTipMap = map[int8]map[int64]string{
RewardNotAvailable: {
1: "快迈出你的第一步吧~~",
2: "数据会在完成任务的第二天上午12:00进行核实哦。",
3: "数据会在完成任务的第二天上午12:00进行核实哦。",
4: "完成全部新手任务就可以解锁大礼包哦~",
5: "数据会在完成任务的第二天上午12:00进行核实哦。",
6: "数据会在完成任务的第二天上午12:00进行核实哦。",
7: "数据会在完成任务的第二天上午12:00进行核实哦。",
8: "完成全部任务就可以解锁大礼包哦~",
},
RewardAvailable: {
1: "会员购优惠券领取后就即时生效了哦~",
2: "B币券领取后就即时生效了哦",
3: "大会员代金券领取后就即时生效了哦~",
4: "会员购优惠券领取后就即时生效了哦~",
5: "会员购优惠券领取后就即时生效了哦~",
6: "大会员代金券领取后就即时生效了哦~",
7: "B币券领取后就即时生效了哦",
8: "双倍激励卡领取后需激活才可使用哦~",
},
RewardReceived: {
1: "可以在我的奖品查看领奖记录哦~",
2: "可以在我的奖品查看领奖记录哦~",
3: "可以在我的奖品查看领奖记录哦~",
4: "可以在我的奖品查看领奖记录哦~",
5: "可以在我的奖品查看领奖记录哦~",
6: "可以在我的奖品查看领奖记录哦~",
7: "可以在我的奖品查看领奖记录哦~",
8: "可以在我的奖品查看领奖记录哦~",
},
RewardUnlock: {
1: "完成全部新手任务就可以解锁大礼包哦~",
2: "完成全部新手任务就可以解锁大礼包哦~",
3: "完成全部新手任务就可以解锁大礼包哦~",
4: "完成全部新手任务就可以解锁大礼包哦~",
5: "完成全部新手任务就可以解锁大礼包哦~",
6: "完成全部新手任务就可以解锁大礼包哦~",
7: "完成全部新手任务就可以解锁大礼包哦~",
8: "完成全部新手任务就可以解锁大礼包哦~",
},
}
// GiftTipMap gift tips for h5
GiftTipMap = map[int8]map[int8]string{
RewardNotAvailable: {
1: "完成全部新手任务马上就能领头像挂件了呢~",
2: "完成全部进阶任务马上就能领头像挂件了呢~",
},
RewardAvailable: {
1: "头像挂件领取后即时生效哦~",
2: "头像挂件领取后即时生效哦~",
},
RewardReceived: {
1: "可以去我的奖品查看领奖记录哦~",
2: "可以去我的奖品查看领奖记录哦~",
},
//RewardUnlock:{
// 1:"",
// 2:"再完成n个任务就能领取了呢",
//},
}
)
// Task for def task struct.
type Task struct {
ID int64 `json:"id"`
GroupID int64 `json:"-"`
Type int8 `json:"type"`
State int8 `json:"-"`
Title string `json:"title"`
Desc string `json:"desc"`
Comment string `json:"-"`
TargetType int8 `json:"-"`
TargetValue int `json:"-"`
CompleteSate int8 `json:"complete_state"`
Label string `json:"label,omitempty"`
Redirect string `json:"redirect,omitempty"`
Rank int64 `json:"-"`
Extra string `json:"extra"`
FanRange string `json:"-"`
UpTime time.Time `json:"-"`
DownTime time.Time `json:"-"`
Online int8 `json:"-"`
CTime time.Time `json:"-"`
MTime time.Time `json:"-"`
}
// AppTasks for def task struct.
type AppTasks struct {
ID int64 `json:"id"`
Type int8 `json:"type"`
Title string `json:"title"`
Label string `json:"label"`
Redirect string `json:"redirect"`
}
//TaskGroup for newcomer & advanced tasks
type TaskGroup struct {
Tasks []*Task `json:"tasks"`
GroupID int64 `json:"group_id"`
RewardID []int64 `json:"reward_id"`
Completed int64 `json:"completed"`
Incomplete int64 `json:"incomplete"`
}
// TaskList for def task list.
type TaskList struct {
TaskGroups []*TaskGroup `json:"task_groups"`
TotalCompleted int64 `json:"total_completed"`
TotalIncomplete int64 `json:"total_incomplete"`
}
// Reward for def reward struct
type Reward struct {
ID int64 `json:"id"`
ParentID int64 `json:"parent_id"`
Type int8 `json:"type"`
State int8 `json:"state"`
IsActive int8 `json:"is_active"`
PriceID string `json:"price_id"`
PrizeUnit int `json:"prize_unit"`
Expire int `json:"expire"`
Name string `json:"name"`
Logo string `json:"logo"`
Comment string `json:"comment"`
UnlockLogo string `json:"unlock_logo"`
NameExtra string `json:"name_extra"`
CTime time.Time `json:"-"`
MTime time.Time `json:"-"`
}
// TaskReward def to combine task and reward data structures
type TaskReward struct {
Mid int64
//task data
TaskID int64
TaskGroupID int64
TaskTitle string
TaskDesc string
TaskType int8
TaskState int8
TaskCompleteSate int8
Label string
Redirect string
//reward data
RewardID int64
RewardParentID int64
RewardName string
RewardLogo string
RewardType int8
RewardState int8
RewardPriceID string
}
// TaskKind for newcomer & advanced & monthly task classification
type TaskKind struct {
Type int8 `json:"type"`
State int8 `json:"state"`
Completed int64 `json:"completed"`
Total int64 `json:"total"`
}
//TaskRewardGroup for newcomer & advanced tasks
type TaskRewardGroup struct {
GroupID int64 `json:"group_id"`
Tasks []*Task `json:"tasks"`
Rewards []*Reward `json:"rewards"`
RewardState int8 `json:"reward_state"` // -1-不可领取 , 0-可领取 , 1-已领取
Completed int64 `json:"completed"`
Total int64 `json:"total"`
TaskType int8 `json:"task_type,omitempty"`
Tip string `json:"tip,omitempty"`
}
// TaskGift for def struct
type TaskGift struct {
State int8 `json:"state"` // -1-不可领取 0-可领取 , 1-已领取
Type int8 `json:"type,omitempty"`
Rewards []*Reward `json:"rewards"`
Tip string `json:"tip,omitempty"`
}
// TaskRewardList for def task list.
type TaskRewardList struct {
TaskReceived int8 `json:"task_received"` // -1-未领取任务0-已领取任务
TaskType int8 `json:"task_type"`
TaskKinds []*TaskKind `json:"task_kinds"`
TaskGroups []*TaskRewardGroup `json:"task_groups"`
TaskGift []*TaskGift `json:"task_gift"`
}
// RewardReceive for def reward receive records.
type RewardReceive struct {
ID int64 `json:"id"`
MID int64 `json:"mid"`
TaskGiftID int64 `json:"task_gift_id"`
TaskGroupID int64 `json:"task_group_id"`
RewardID int64 `json:"reward_id"`
RewardType int8 `json:"reward_type"`
State int8 `json:"state"`
ReceiveTime time.Time `json:"receive_time"`
CTime time.Time `json:"ctime"`
MTime time.Time `json:"mtime"`
ExpireTime time.Time `json:"expire_time"`
RewardName string `json:"reward_name"`
}
// RewardReceiveGroup for reward receive group
type RewardReceiveGroup struct {
Count int `json:"count"`
RewardType int8 `json:"reward_type"`
RewardTypeName string `json:"reward_type_name"`
RewardTypeLogo string `json:"reward_type_logo"`
Comment string `json:"comment"`
Items []*RewardReceive `json:"items"`
}
// UserTask for def user task struct.
type UserTask struct {
ID int64 `json:"id"`
MID int64 `json:"mid"`
TaskID int64 `json:"task_id"`
TaskGroupID int64 `json:"task_group_id"`
TaskType int8 `json:"task_type"`
State int8 `json:"state"`
TaskBindTime time.Time `json:"task_bind_time"`
CTime time.Time `json:"ctime"`
MTime time.Time `json:"mtime"`
}
// IndexNewcomer for index show
type IndexNewcomer struct {
TaskReceived int8 `json:"task_received"`
SubZero bool `json:"sub_zero"`
NoReceive int `json:"no_receive"`
Tasks []*Task `json:"tasks"`
}
// AppIndexNewcomer for index show
type AppIndexNewcomer struct {
TaskReceived int8 `json:"task_received"`
H5URL string `json:"h5_url"`
AppTasks []*AppTasks `json:"tasks"`
}
// CheckTaskStateReq check task state req by creative-job grpc client.
type CheckTaskStateReq struct {
MID int64
TaskID int64
}
// TaskGroupReward for def task-group-reward
type TaskGroupReward struct {
ID int64 `json:"id"`
TaskGroupID int64 `json:"task_group_id"`
RewardID int64 `json:"reward_id"`
State int8 `json:"state"`
Comment string `json:"comment"`
CTime time.Time `json:"ctime"`
MTime time.Time `json:"mtime"`
}
// GiftReward for gift reward
type GiftReward struct {
ID int64 `json:"id"`
RootType int8 `json:"root_type"`
TaskType int8 `json:"task_type"`
RewardID int64 `json:"reward_id"`
State int8 `json:"state"`
Comment string `json:"comment"`
CTime time.Time `json:"ctime"`
MTime time.Time `json:"mtime"`
}
//TaskMsg for newcomer task finish notify.
type TaskMsg struct {
MID int64 `json:"mid"`
Count int64 `json:"count"`
From int `json:"from"`
TimeStamp int64 `json:"timestamp"`
}
// H5TaskRewardList for def task list.
type H5TaskRewardList struct {
TaskReceived int8 `json:"task_received"` // -1-未领取任务0-已领取任务
TaskGroups []*TaskRewardGroup `json:"task_groups"`
TaskGift []*TaskGift `json:"task_gifts"`
}
//PubTask for def struct
type PubTask struct {
ID int64 `json:"id"`
Type int8 `json:"type"`
Title string `json:"title"`
Desc string `json:"desc"`
State int8 `json:"state"`
}
//PubTaskList for def struct
type PubTaskList struct {
TaskReceived int8 `json:"task_received"`
Tasks []*PubTask `json:"tasks"`
}
// TaskGroupEntity for def struct
type TaskGroupEntity struct {
ID int64 `json:"id"`
Rank int64 `json:"rank"`
State int8 `json:"state"`
RootType int8 `json:"root_type"`
Type int8 `json:"type"`
Online int8 `json:"online"`
CTime time.Time `json:"ctime"`
MTime time.Time `json:"mtime"`
}
// TaskRewardEntity for def struct
type TaskRewardEntity struct {
ID int64 `json:"id"`
TaskID int64 `json:"task_id"`
RewardID int64 `json:"reward_id"`
State int8 `json:"state"`
Type int8 `json:"type"`
Comment string `json:"comment"`
CTime time.Time `json:"ctime"`
MTime time.Time `json:"mtime"`
}
// RewardReceive2 for def reward receive records.
type RewardReceive2 struct {
ID int64 `json:"id"`
MID int64 `json:"mid"`
OID int64 `json:"oid"`
Type int8 `json:"type"`
RewardID int64 `json:"reward_id"`
RewardType int8 `json:"reward_type"`
State int8 `json:"state"`
ReceiveTime time.Time `json:"receive_time"`
CTime time.Time `json:"ctime"`
MTime time.Time `json:"mtime"`
RewardName string `json:"reward_name"`
}

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 = ["operation.go"],
importpath = "go-common/app/interface/main/creative/model/operation",
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,50 @@
package operation
// Operation tool.
type Operation struct {
ID int64 `json:"id"`
Ty string `json:"-"`
Rank string `json:"rank"`
Pic string `json:"pic"`
Link string `json:"link"`
Content string `json:"content"`
Remark string `json:"remark"`
Note string `json:"note"`
Stime string `json:"start_time"`
Etime string `json:"end_time"`
AppPic string `json:"-"`
Platform int8 `json:"-"`
}
// Banner for app index.
type Banner struct {
Ty string `json:"-"`
Rank string `json:"rank"`
Pic string `json:"pic"`
Link string `json:"link"`
Content string `json:"content"`
}
// BannerCreator for creator index.
type BannerCreator struct {
Ty string `json:"-"`
Rank int `json:"rank"`
Pic string `json:"pic"`
Link string `json:"link"`
Content string `json:"content"`
Stime int64 `json:"start_time"`
Etime int64 `json:"end_time"`
}
// BannerList for operation list.
type BannerList struct {
BannerCreator []*BannerCreator `json:"operations"`
Pn int `json:"pn"`
Ps int `json:"ps"`
Total int `json:"total"`
}
// FullTypes get full operations.
func FullTypes() (tys []string) {
return []string{"'play'", "'notice'", "'road'", "'creative'", "'collect_arc'"}
}

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 = ["order.go"],
importpath = "go-common/app/interface/main/creative/model/order",
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,44 @@
package order
// Order str
type Order struct {
ExeOdID int64 `json:"execute_order_id"`
BzOdName string `json:"business_order_name"`
IDCode int64 `json:"id_code"`
GameBaseID int64 `json:"game_base_id"`
GameName string `json:"game_name"`
}
// Oasis 绿洲计划
type Oasis struct {
State int `json:"state"`
RealeseOrder int64 `json:"running_execute_order_count"` //投放商单数
TotalOrder int64 `json:"total_execute_order_count"` //总商单数
}
// Growth for order.
type Growth struct {
State int `json:"state"`
YesterdayIncome float64 `json:"yesterday_income"` //昨日收入
MonthIncome float64 `json:"present_month_income"` //本月收入
}
// OasisEarnings for order.
type OasisEarnings struct {
State int `json:"state"`
Realese int64 `json:"release"` //投放商单数
Total int64 `json:"total"` //总商单数
}
// GrowthEarnings for order.
type GrowthEarnings struct {
State int `json:"state"`
Yesterday float64 `json:"yesterday"` //昨日收入
Month float64 `json:"month"` //本月收入
}
// UpValidate for up validate.
type UpValidate struct {
MID int64 `json:"mid"`
State int `json:"state"` //0:禁止1:允许
}

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 = ["porder.go"],
importpath = "go-common/app/interface/main/creative/model/porder",
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,15 @@
package porder
// Config str
type Config struct {
ID int64 `json:"id"`
Tp int8 `json:"type"`
Name string `json:"name"`
}
const (
// ConfigTypeIndustry const
ConfigTypeIndustry = 0
// ConfigTypeShow const
ConfigTypeShow = 1
)

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 = ["relation.go"],
importpath = "go-common/app/interface/main/creative/model/relation",
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,6 @@
package relation
type Relation struct {
Mid int64 `json:"mid"`
Attr uint8 `json:"attribute"`
}

View File

@@ -0,0 +1,44 @@
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
"go_test",
)
go_library(
name = "go_default_library",
srcs = [
"reply.go",
"xints.go",
],
importpath = "go-common/app/interface/main/creative/model/reply",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = [
"//app/interface/main/reply/model/reply:go_default_library",
"//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"],
)
go_test(
name = "go_default_test",
srcs = ["xints_test.go"],
embed = [":go_default_library"],
rundir = ".",
tags = ["automanaged"],
)

View File

@@ -0,0 +1,50 @@
package reply
import (
"go-common/app/interface/main/reply/model/reply"
xtime "go-common/library/time"
)
// Reply str
type Reply struct {
RpID int64 `json:"rpid"`
Oid int64 `json:"oid"`
Type int8 `json:"type"`
Mid int64 `json:"mid"`
Root int64 `json:"root"`
Parent int64 `json:"parent"`
Count int `json:"count"`
RCount int `json:"rcount"`
Floor int `json:"floor"`
State int8 `json:"state"`
Attr int8 `json:"attr"`
CTime xtime.Time `json:"ctime"`
MTime xtime.Time `json:"-"`
RpIDStr string `json:"rpid_str,omitempty"`
RootStr string `json:"root_str,omitempty"`
ParentStr string `json:"parent_str,omitempty"`
// action count, from ReplyAction count
Like int `json:"like"`
Hate int `json:"-"`
Action int8 `json:"action"`
// member info
Member *reply.Info `json:"member"`
// other
Content *CreativeReplyCont `json:"content"`
Replies []*Reply `json:"replies"`
}
// CreativeReplyCont str
type CreativeReplyCont struct {
RpID int64 `json:"-"`
Message string `json:"message"`
Ats Ints `json:"ats,omitempty"`
IP uint32 `json:"ipi,omitempty"`
Plat int8 `json:"plat"`
Device string `json:"device"`
Version string `json:"version,omitempty"`
CTime xtime.Time `json:"-"`
MTime xtime.Time `json:"-"`
// ats member info
Members []*reply.Info `json:"members"`
}

View File

@@ -0,0 +1,91 @@
package reply
import (
"database/sql/driver"
"encoding/binary"
)
//Ints be used to MySql\Protobuf varbinary converting.
type Ints []int64
// MarshalTo marshal int64 slice to bytes,each int64 will occupy Fixed 8 bytes.
//if the argument data not supplied with the full size,it will return the actual written size
func (is Ints) MarshalTo(data []byte) (int, error) {
for i, n := range is {
start := i * 8
end := (i + 1) * 8
if len(data) < end {
return start, nil
}
bs := data[start:end]
binary.BigEndian.PutUint64(bs, uint64(n))
}
return 8 * len(is), nil
}
// Size return the total size it will occupy in bytes
func (is Ints) Size() int {
return len(is) * 8
}
// Unmarshal parse the data into int64 slice
func (is *Ints) Unmarshal(data []byte) error {
return is.Scan(data)
}
// Scan parse the data into int64 slice
func (is *Ints) Scan(src interface{}) (err error) {
switch sc := src.(type) {
case []byte:
var res []int64
for i := 0; i < len(sc) && i+8 <= len(sc); i += 8 {
ui := binary.BigEndian.Uint64(sc[i : i+8])
res = append(res, int64(ui))
}
*is = res
}
return
}
// Value marshal int64 slice to driver.Value,each int64 will occupy Fixed 8 bytes
func (is Ints) Value() (driver.Value, error) {
return is.Bytes(), nil
}
// Bytes marshal int64 slice to bytes,each int64 will occupy Fixed 8 bytes
func (is Ints) Bytes() []byte {
res := make([]byte, 0, 8*len(is))
for _, i := range is {
bs := make([]byte, 8)
binary.BigEndian.PutUint64(bs, uint64(i))
res = append(res, bs...)
}
return res
}
// Evict get rid of the sepcified num from the slice
func (is *Ints) Evict(e int64) (ok bool) {
res := make([]int64, len(*is)-1)
for _, v := range *is {
if v != e {
res = append(res, v)
} else {
ok = true
}
}
*is = res
return
}
// Exist judge the sepcified num is in the slice or not
func (is Ints) Exist(i int64) (e bool) {
for _, v := range is {
if v == i {
e = true
return
}
}
return
}

View File

@@ -0,0 +1,74 @@
package reply
import (
"testing"
)
func TestMarshalAndUnmarshal(t *testing.T) {
var a = Ints{1, 2, 3}
data := make([]byte, a.Size())
n, err := a.MarshalTo(data)
if n != 24 {
t.Logf("marshal size must be 24")
t.FailNow()
}
if err != nil {
t.Fatalf("err:%v", err)
}
var b Ints
err = b.Unmarshal(data)
if err != nil {
t.Fatalf("err:%v", err)
}
if b[0] != 1 || b[1] != 2 || b[2] != 3 {
t.Logf("unmarshal failed!b:%v", b)
t.FailNow()
}
}
func TestUncompleteMarshal(t *testing.T) {
var a = Ints{1, 2, 3}
data := make([]byte, a.Size()-7)
n, err := a.MarshalTo(data)
if n != 16 {
t.Logf("marshal size must be 16")
t.FailNow()
}
if err != nil {
t.Fatalf("err:%v", err)
}
var b Ints
err = b.Unmarshal(data)
if err != nil {
t.Fatalf("err:%v", err)
}
if b[0] != 1 || b[1] != 2 {
t.Logf("unmarshal failed!b:%v", b)
t.FailNow()
}
}
func TestNilMarshal(t *testing.T) {
var a = Ints{1, 2, 3}
var data []byte
n, err := a.MarshalTo(data)
if n != 0 {
t.Logf("marshal size must be 0")
t.FailNow()
}
if err != nil {
t.Fatalf("err:%v", err)
}
var b Ints
err = b.Unmarshal(data)
if err != nil {
t.Fatalf("err:%v", err)
}
if b != nil {
t.Logf("unmarshal failed!b:%v", b)
t.FailNow()
}
}

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 = [
"banner.go",
"model.go",
],
importpath = "go-common/app/interface/main/creative/model/resource",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = [
"//app/service/main/resource/model:go_default_library",
"//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,89 @@
package source
import (
"encoding/json"
resource "go-common/app/service/main/resource/model"
xtime "go-common/library/time"
)
// Banner str
type Banner struct {
ID int `json:"id"`
ParentID int `json:"-"`
Plat int8 `json:"-"`
Module string `json:"-"`
Position string `json:"-"`
Title string `json:"title"`
Content string `json:"content"`
Image string `json:"image"`
Pic string `json:"pic"`
Hash string `json:"hash"`
URI string `json:"uri"`
Link string `json:"link"`
Goto string `json:"-"`
Value string `json:"-"`
Param string `json:"-"`
Channel string `json:"-"`
Build int `json:"-"`
Condition string `json:"-"`
Area string `json:"-"`
Rule string `json:"-"`
Type int8 `json:"-"`
Start xtime.Time `json:"-"`
End xtime.Time `json:"-"`
MTime xtime.Time `json:"-"`
ResourceID int `json:"resource_id"`
RequestId string `json:"request_id"`
CreativeId int `json:"creative_id"`
SrcId int `json:"src_id"`
IsAd bool `json:"is_ad"`
IsAdReplace bool `json:"-"`
IsAdLoc bool `json:"is_ad_loc"`
CmMark int `json:"cm_mark"`
AdCb string `json:"ad_cb"`
ShowUrl string `json:"show_url"`
ClickUrl string `json:"click_url"`
ClientIp string `json:"client_ip"`
Index int `json:"index"`
Rank int `json:"rank"`
ServerType int `json:"server_type"`
Extra json.RawMessage `json:"extra"`
CreativeType int `json:"creative_type"`
}
// ChangeBanner fn
func (b *Banner) ChangeBanner(banner *resource.Banner) {
b.ID = banner.ID
b.Rank = banner.Index
b.Title = banner.Title
b.Content = banner.Title
b.Image = banner.Image
b.Pic = banner.Image
b.Hash = banner.Hash
b.URI = banner.URI
b.Link = banner.URI
b.ResourceID = banner.ResourceID
b.RequestId = banner.RequestId
b.CreativeId = banner.CreativeId
b.SrcId = banner.SrcId
b.IsAd = banner.IsAd
b.IsAdLoc = banner.IsAdLoc
b.CmMark = banner.CmMark
b.AdCb = banner.AdCb
b.ShowUrl = banner.ShowUrl
b.ClickUrl = banner.ClickUrl
b.ClientIp = banner.ClientIp
b.Index = banner.Index
b.ServerType = banner.ServerType
b.Extra = banner.Extra
b.CreativeType = banner.CreativeType
b.CreativeId = banner.CreativeId
}
// BannerList for operation list.
type BannerList struct {
Banners []*Banner `json:"operations"`
Pn int `json:"pn"`
Ps int `json:"ps"`
Total int `json:"total"`
}

View File

@@ -0,0 +1,79 @@
package source
const (
// PlatAndroid is int8 for android.
PlatAndroid = int8(0)
// PlatIPhone is int8 for iphone.
PlatIPhone = int8(1)
// PlatIPad is int8 for ipad.
PlatIPad = int8(2)
// PlatWPhone is int8 for wphone.
PlatWPhone = int8(3)
// PlatAndroidG is int8 for Android Googleplay.
PlatAndroidG = int8(4)
// PlatIPhoneI is int8 for Iphone Global.
PlatIPhoneI = int8(5)
// PlatIPadI is int8 for IPAD Global.
PlatIPadI = int8(6)
// PlatAndroidTV is int8 for AndroidTV Global.
PlatAndroidTV = int8(7)
// PlatAndroidI is int8 for Android Global.
PlatAndroidI = int8(8)
// PlatIpadHD is int8 for IpadHD
PlatIpadHD = int8(9)
// PlatAndroidB is int8 for Android Blue.
PlatAndroidB = int8(10)
)
// IsAndroid check plat is android or ipad.
func IsAndroid(plat int8) bool {
return plat == PlatAndroid || plat == PlatAndroidG || plat == PlatAndroidI || plat == PlatAndroidB
}
// IsIOS check plat is iphone or ipad.
func IsIOS(plat int8) bool {
return plat == PlatIPad || plat == PlatIPhone || plat == PlatIPadI || plat == PlatIPhoneI
}
// IsIPhone check plat is iphone.
func IsIPhone(plat int8) bool {
return plat == PlatIPhone || plat == PlatIPhoneI
}
// IsIPad check plat is ipad.
func IsIPad(plat int8) bool {
return plat == PlatIPad
}
// Plat return plat by platStr or mobiApp
func Plat(mobiApp, device string) int8 {
switch mobiApp {
case "iphone":
if device == "pad" {
return PlatIPad
}
return PlatIPhone
case "white":
return PlatIPhone
case "ipad":
return PlatIPad
case "android", "android_b":
return PlatAndroid
case "win":
return PlatWPhone
case "android_G":
return PlatAndroidG
case "android_i":
return PlatAndroidI
case "iphone_i":
if device == "pad" {
return PlatIPadI
}
return PlatIPhoneI
case "ipad_i":
return PlatIPadI
case "android_tv":
return PlatAndroidTV
}
return PlatIPhone
}

View File

@@ -0,0 +1,33 @@
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = ["search.go"],
importpath = "go-common/app/interface/main/creative/model/search",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = [
"//app/interface/main/creative/model/archive:go_default_library",
"//app/interface/main/creative/model/music:go_default_library",
"//app/interface/main/creative/model/reply: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,292 @@
package search
import (
"go-common/app/interface/main/creative/model/archive"
"go-common/app/interface/main/creative/model/music"
"go-common/app/interface/main/creative/model/reply"
)
const (
//All for all of reply type.
All = 0
//Archive for reply type.
Archive = 1
//Article for reply type.
Article = 12
//Audio for reply type.
Audio = 14
//SmallVideo for reply type.
SmallVideo = 5
)
// Result search list.
type Result struct {
Class *ClassCount `json:"class"`
Applies *ApplyStateCount `json:"apply_count"`
Type map[int16]*TypeCount `json:"-"`
ArrType []*TypeCount `json:"type"`
OldArchives []*archive.OldArchiveVideoAudit `json:"archives"`
Archives []*archive.ArcVideoAudit `json:"arc_audits"`
Page struct {
Pn int `json:"pn"`
Ps int `json:"ps"`
Count int `json:"count"`
} `json:"page"`
Aids []int64 `json:"-"` // from search, call archiveRPC
Tip string `json:"tip"`
}
// StaffApplyResult search list.
type StaffApplyResult struct {
StateCount *ApplyStateCount `json:"state_count"`
Type map[int16]*TypeCount `json:"-"`
ArrType []*TypeCount `json:"type"`
Applies []*StaffApply `json:"applies"`
Page struct {
Pn int `json:"pn"`
Ps int `json:"ps"`
Count int `json:"count"`
} `json:"page"`
Aids []int64 `json:"-"` // from search, call archiveRPC
}
// StaffApply str
type StaffApply struct {
ID int64 `json:"id"`
Type int8 `json:"type"`
Mid int64 `json:"mid"`
Uname string `json:"uname"`
State int8 `json:"state"`
ApplyTitle string `json:"apply_title"`
ApplyState int8 `json:"apply_state"`
Archive *archive.ArcVideoAudit `json:"arc_audits"`
}
// ApplyStateCount pub count.
type ApplyStateCount struct {
Neglected int `json:"neglected"`
Pending int `json:"pending"`
Processed int `json:"processed"`
}
// ClassCount pub count.
type ClassCount struct {
Pubed int `json:"pubed"`
NotPubed int `json:"not_pubed"`
Pubing int `json:"is_pubing"`
}
// TypeCount archive count for a type.
type TypeCount struct {
Tid int16 `json:"tid"`
Name string `json:"name"`
Count int64 `json:"count"`
}
// Reply str
type Reply struct {
Message string `json:"message"`
ID int64 `json:"id"`
Floor int64 `json:"floor"`
Count int `json:"count"`
Root int64 `json:"root"`
Oid int64 `json:"oid"`
CTime string `json:"ctime"`
MTime string `json:"mtime"`
State int `json:"state"`
Parent int64 `json:"parent"`
Mid int64 `json:"mid"`
Like int `json:"like"`
Replier string `json:"replier"`
Uface string `json:"uface"`
Cover string `json:"cover"`
Title string `json:"title"`
Relation int `json:"relation"`
IsElec int `json:"is_elec"`
Type int `json:"type"`
RootInfo *reply.Reply `json:"root_info"`
ParentInfo *reply.Reply `json:"parent_info"`
}
//Replies for reply list.
type Replies struct {
SeID string `json:"seid"`
Order string `json:"order"`
Keyword string `json:"keyword"`
Total int `json:"total"`
PageCount int `json:"pagecount"`
Repliers []int64 `json:"repliers"`
DeriveOids []int64 `json:"-"`
DeriveIds []int64 `json:"-"`
Oids []int64 `json:"-"`
TyOids map[int][]int64 `json:"-"`
Result []*Reply `json:"result"`
}
//SimpleResult for archives simple result.
type SimpleResult struct {
ArchivesVideos []*SimpleArcVideos `json:"simple_arc_videos"`
Class *ClassCount `json:"class"`
Page struct {
Pn int `json:"pn"`
Ps int `json:"ps"`
Count int `json:"count"`
} `json:"page"`
}
//SimpleArcVideos for search archive & vidoes.
type SimpleArcVideos struct {
Archive *archive.SimpleArchive `json:"archive"`
Videos []*archive.SimpleVideo `json:"videos"`
}
// ArcParam for es search param.
type ArcParam struct {
MID int64
AID int64
TypeID int64
Pn int
Ps int
State string
Keyword string
Order string
}
// Arc for search archive.
type Arc struct {
ID int64 `json:"id"`
TypeID int64 `json:"typeid"`
PID int64 `json:"pid"`
State int64 `json:"state"`
Duration int64 `json:"duration"`
Title string `json:"title"`
Cover string `json:"cover"`
Desc string `json:"description"`
PubDate string `json:"pubdate"`
}
// Pager for es page.
type Pager struct {
Num int `json:"num"`
Size int `json:"size"`
Total int `json:"total"`
}
// DCount for state count.
type DCount struct {
Count int `json:"doc_count"`
}
// PList for state count list.
type PList struct {
IsPubing DCount `json:"is_pubing"`
NotPubed DCount `json:"not_pubed"`
Pubed DCount `json:"pubed"`
Pending DCount `json:"pending"`
}
// TList for type count list.
type TList struct {
DCount
Key string `json:"key"`
}
// ArcResult archive list from search.
type ArcResult struct {
Page *Pager `json:"page"`
Result struct {
Vlist []*Arc `json:"vlist"`
PList *PList `json:"plist"`
TList []*TList `json:"tlist"`
} `json:"result"`
}
// ReliesES str
type ReliesES struct {
Order string `json:"order"`
Sort string `json:"sort"`
Page *Pager `json:"page"`
Result []*ReplyES `json:"result"`
}
// ReplyES str
type ReplyES struct {
Count int `json:"count"`
CTime string `json:"ctime"`
Floor int64 `json:"floor"`
Hate int64 `json:"hate"`
ID int64 `json:"id"`
Like int `json:"like"`
Message string `json:"message"`
Mid int64 `json:"mid"`
MTime string `json:"mtime"`
OMid int64 `json:"o_mid"`
Oid int64 `json:"oid"`
Parent int64 `json:"parent"`
Rcount int64 `json:"rcount"`
Root int64 `json:"root"`
State int `json:"state"`
Type int `json:"type"`
}
//ReplyParam str
type ReplyParam struct {
Ak string
Ck string
OMID int64
OID int64
Pn int
Ps int
IsReport int8
Type int8
ResMdlPlat int8
FilterCtime string
Kw string
Order string
IP string
}
// Bgm str
type Bgm struct {
SID int64 `json:"sid"`
}
// BgmResult str
type BgmResult struct {
Page *Pager `json:"page"`
Result []*Bgm `json:"result"`
}
// MaterialRel str
type MaterialRel struct {
AID int64 `json:"aid"`
}
// BgmExtResult str
type BgmExtResult struct {
Page *Pager `json:"page"`
Result []*MaterialRel `json:"result"`
}
// BgmSearchRes str
type BgmSearchRes struct {
Pager *Pager `json:"pager"`
Bgms []*music.Music `json:"bgm"`
}
// ApplyResult apply list from search.
type ApplyResult struct {
Page *Pager `json:"page"`
Result struct {
Vlist []*Arc `json:"vlist"`
ApplyPList *ApplyPList `json:"plist"`
TList []*TList `json:"tlist"`
} `json:"result"`
}
// ApplyPList for apply state count list.
type ApplyPList struct {
Neglected DCount `json:"neglected"`
Pending DCount `json:"pending"`
Processed DCount `json:"processed"`
}

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 = ["tag.go"],
importpath = "go-common/app/interface/main/creative/model/tag",
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,42 @@
package tag
const (
// UserTag 普通tag
UserTag = int8(0)
// UpTag up主tag
UpTag = int8(1)
// OfficailClassifyTag 官方-分类tag
OfficailClassifyTag = int8(2)
// OfficailContentTag 官方-内容tag
OfficailContentTag = int8(3)
// OfficailActiveTag 官方-活动tag
OfficailActiveTag = int8(4)
// TagStateNormal normal
TagStateNormal = 0
// TagStateDel del
TagStateDel = 1
// TagStateHide hide
TagStateHide = 2
)
// Meta for tag info.
type Meta struct {
TagID int64 `json:"tag_id"`
TagName string `json:"tag_name"`
}
// Tag str
type Tag struct {
ID int64 `json:"tag_id"`
Name string `json:"tag_name"`
Cover string `json:"cover"`
Content string `json:"content"`
Type int8 `json:"type"`
State int8 `json:"state"`
}
// StaffTitle 联合投稿职能
type StaffTitle struct {
ID int64 `json:"id"`
Name string `json:"name"`
}

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 = ["template.go"],
importpath = "go-common/app/interface/main/creative/model/template",
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,36 @@
package template
import "go-common/library/time"
const (
// StateNormal 正常
StateNormal = 0
// StateDel 删除
StateDel = 1
)
// Template archive template.
type Template struct {
ID int64 `json:"tid"`
Name string `json:"name"`
// Arctype string `json:"-"`
TypeID int16 `json:"typeid"`
Title string `json:"title"`
Tag string `json:"tags"`
Content string `json:"description"`
Copyright int8 `json:"copyright"`
State int8 `json:"-"`
CTime time.Time `json:"-"`
MTime time.Time `json:"-"`
}
// Copyright get int8 val
func Copyright(cp string) int8 {
if cp == "Original" {
return 1
} else if cp == "Copy" {
return 2
} else {
return 0
}
}

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 = ["up.go"],
importpath = "go-common/app/interface/main/creative/model/up",
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,16 @@
package up
//Switch for up switch controll.
type Switch struct {
State int32 `json:"state"`
Show int `json:"show"`
Face string `json:"face"`
}
// SpecialGroup UP主分组关联关系
type SpecialGroup struct {
ID int64 `json:"id"`
MID int64 `json:"mid"`
GroupID int64 `json:"group_id"`
GroupName string `json:"group_name"`
}

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 = ["version.go"],
importpath = "go-common/app/interface/main/creative/model/version",
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,21 @@
package version
import (
xtime "go-common/library/time"
)
// Version str.
type Version struct {
ID int64 `json:"id"`
Ty string `json:"type"`
Title string `json:"title"`
Content string `json:"content"`
Link string `json:"link"`
Ctime xtime.Time `json:"-"`
Dateline xtime.Time `json:"dateline"`
}
// FullVersions fn 4=>Android;5:iPhone;6:PC
func FullVersions() (tys []int) {
return []int{4, 5, 6}
}

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 = ["watermark.go"],
importpath = "go-common/app/interface/main/creative/model/watermark",
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,97 @@
package watermark
import (
"time"
)
const (
// TypeName 带用户名的水印.
TypeName = 1
// TypeUID 带uid的水印.
TypeUID = 2
// TypeNewName 用户名和logo位置为上下的水印.
TypeNewName = 3
// StatClose 未开启水印.
StatClose = 0
// StatOpen 开启水印.
StatOpen = 1
// StatPreview 预览水印(不写入数据库).
StatPreview = 2
// PosLeftTop 水印位置左上角.
PosLeftTop = 1
// PosRightTop 水印位置右上角.
PosRightTop = 2
// PosLeftBottom 水印位置左下角.
PosLeftBottom = 3
// PosRightBottom 水印位置右下角.
PosRightBottom = 4
)
// Watermark watermark info.
type Watermark struct {
ID int64 `json:"id"`
MID int64 `json:"mid"`
Uname string `json:"uname"`
State int8 `json:"state"`
Ty int8 `json:"type"`
Pos int8 `json:"position"`
URL string `json:"url"`
MD5 string `json:"md5"`
Info string `json:"info"`
Tip string `json:"tip"`
CTime time.Time `json:"ctime"`
MTime time.Time `json:"mtime"`
}
//WatermarkParam set watermark param
type WatermarkParam struct {
MID int64
State int8
Ty int8
Pos int8
Sync int8
IP string
}
// Image image width & height.
type Image struct {
Width int `json:"width"`
Height int `json:"height"`
}
// IsState check state.
func IsState(st int8) bool {
return st == StatClose || st == StatOpen || st == StatPreview
}
// IsType check type.
func IsType(ty int8) bool {
return ty == TypeName || ty == TypeUID || ty == TypeNewName
}
// IsPos check position.
func IsPos(pos int8) bool {
return pos == PosLeftTop || pos == PosRightTop || pos == PosLeftBottom || pos == PosRightBottom
}
// Msg from passport.
type Msg struct {
Action string `json:"action"`
Old *UserInfo `json:"old"`
New *UserInfo `json:"new"`
}
// UserInfo user modify detail.
type UserInfo struct {
MID int64 `json:"mid"`
Uname string `json:"uname"`
UserID string `json:"userid"`
}
//GenWatermark for wm api.
type GenWatermark struct {
Location string `json:"location"`
MD5 string `json:"md5"` // 文件的hash值
Width int `json:"width"`
Height int `json:"height"`
}

View File

@@ -0,0 +1,34 @@
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = ["model.go"],
importpath = "go-common/app/interface/main/creative/model/weeklyhonor",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = [
"//app/service/main/account/model:go_default_library",
"//app/service/main/archive/api:go_default_library",
"//library/log:go_default_library",
"//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,574 @@
package weeklyhonor
import (
"math/rand"
"strconv"
"strings"
"sync"
"time"
accmdl "go-common/app/service/main/account/model"
"go-common/app/service/main/archive/api"
"go-common/library/log"
xtime "go-common/library/time"
)
const (
// HonorSub honor subscribe state subscribed
HonorSub uint8 = iota
// HonorUnSub honor subscribe state unsubscribed
HonorUnSub
layout = "20060102"
// when edit, add new line below the line you want edit and fill the end time field
// if Word changed,use new hid,else use the same.
hStr = `1|S|史诗级选手|本周上过全站排行榜前三名|SSR|20181019|
2|666|惊不惊喜意不意外|本周上过全站排行榜第%d名|SSR|20181019|
3|233|天选之人|本周上过全站排行榜前%d名|SSR|20181019|
4|牛|给大佬递茶|本周上过全站排行榜前%d名|SSR|20181019|
5|史|少年创造奇迹|本周累计总播放量达成了%s的小目标|SSR|20181019|
6|火|「%s」不火天理难容|本周总粉丝数达成%d百万的小目标|SSR|20181019|
7|光|一入动态深似海||SSR|20181019|
8|希|全村人的希望|本周上过全站%s区排行榜前%d名|SR|20181019|20181214
8|希|全村人的希望|本周上过%s区排行榜前%d名|R|20181214|
9|妥|定个小目标,破%d万+|本周累计总播放量达成%d万的小目标|SR|20181019|
10|强|你上辈子大概拯救过世界|本周总粉丝数达成%d万的小目标|SR|20181019|
11|Boom|请收下我的膝盖|本周新增播放量破百万|SR|20181019|
12|囍|此生无悔爱「%s」|本周新增粉丝数破万|SR|20181019|
13|心|给你我的小心心|本周稿件被点赞破五千|SR|20181019|
14|爆|我吹爆这个up主|本周稿件被转发破千|SR|20181019|
15|富|我要让世界知道此人被我承包|本周稿件收到硬币数破三千|SR|20181019|
16|爱|承包这个动态日更up主||SR|20181019|
17|妙|定个小目标,破%d万+|本周累计总播放量达成%d万的小目标|R|20181019|
18|撩|夭寿啦这个up好会撩人|本周总粉丝数达成%d万的小目标|R|20181019|
19|星|下一个巨星就是你|本周新增播放量破十万|R|20181019|
20|怦|糟了是心动的感觉|本周新增粉丝数破千|R|20181019|
21|赞|为你打call|本周稿件被点赞破千|R|20181019|
22|鸣|火钳刘明|本周稿件被转发破百|R|20181019|
23|劲|这个up主大概使用了洪荒之力|本周发布稿件数达五个以上|R|20181019|20181214
23|劲|这个up主大概使用了洪荒之力|本周发布稿件数达五个以上|A|20181214|
24|发|下一个大佬就是你|本周稿件收到硬币数破千|R|20181019|
25|call|今天也是可爱的动态up呢||R|20181019|
26|盯|确认过眼神是有潜力的up|本周累计总播放量达成%d千的小目标|A|20181019|
27|抱|大大,我是你的腿部挂件|本周总粉丝数达成%d千的小目标|A|20181019|
28|Wow|这只up主有点东西|本周新增播放量破万|A|20181019|
29|嗷|掐指一算,必成大事|本周新增粉丝数破百|A|20181019|
30|仙|给「%s」献上膝盖|本周稿件被点赞破五百|A|20181019|
31|转|前方“转发”高能预警|本周稿件被转发上五十|A|20181019|
32|肝|肝稿模式,启动!|本周发布稿件数达到三个及以上|A|20181019|20181214
32|肝|肝稿模式,启动!|本周发布稿件数达到三个及以上|B|20181214|
33|美|美滋滋,我有个大胆的想法|本周稿件收到硬币数破百|A|20181019|
34|和|本周优秀动态,安排上了!||A|20181019|
35|稳|获得粉丝稳稳的爱||B|20181019|
36|竞|播放1万+还会远吗?||B|20181019|
37|辛|只要有你们,再辛苦的时光都元气满满||B|20181019|
38|秀|加油打气你最棒||B|20181019|
39|A+|被大家的转发种草了||B|20181019|
40|更|爷爷你关注的up主更新了||B|20181019|
41|囤|囤着硬币干大事||B|20181019|
42|奋|秘技!左右横跳发动态||B|20181019|
43|粉|在世界中心呼唤粉丝||B|20181019|
44|进|向着播放破千的目标前进吧||B|20181019|
45|励|粉丝的鼓励你收到了嘛||B|20181019|
46|勤|业精于勤,积少成多||C|20181019|
47|冲|为了更多的赞冲鸭||C|20181019|
48|享|分享是走向世界第一步||C|20181019|
49|币|我也收到硬币啦||C|20181019|
50|等|和我签订契约成为动态区UP主吧||C|20181019|
51|孤|生活已经如此艰难,有些事情就不要揭穿了||D|20181019|
52|懵|我好像把我的播放量弄丢了……||D|20181019|
53|槑|呆呆,我的点赞去哪了||D|20181019|
54|空|我的转发空空荡荡…||D|20181019|
55|鸽|鸽了鸽了!投稿是不可能投稿——下周就投稿||D|20181019|
56|静|钱袋静静地躺着||D|20181019|
57|新|来吧!打破零动态惨案!||D|20181019|
58|迟|数据宝宝正在非常努力地奔跑——过会会儿再看啦||E|20181019|
59|炫|疯狂Pick你|本周上过全站排行榜前%d名|SR|20181214|`
)
// Honor weeklyhonor info.
type Honor struct {
HID int `json:"hid"`
MID int64 `json:"mid"`
HonorCount int64 `json:"honor_count"`
Uname string `json:"uname"`
Face string `json:"face"`
Word string `json:"word"`
Text string `json:"text"`
Desc string `json:"desc"`
Priority string `json:"priority"`
ShareToken string `json:"share_token"`
RiseStage *RiseStage `json:"rise_stage"`
SubState uint8 `json:"sub_state"`
LoveFans []*accmdl.Info `json:"love_fans"`
PlayFans []*accmdl.Info `json:"play_fans"`
NewArchive *api.Arc `json:"new_archive"`
HotArchive *api.Arc `json:"hot_archive"`
DateBegin xtime.Time `json:"date_begin"`
DateEnd xtime.Time `json:"date_end"`
}
// RiseStage .
type RiseStage struct {
Play int `json:"play"`
Like int `json:"like"`
Fans int `json:"fans"`
Coin int `json:"coin"`
Share int `json:"share"`
}
// HonorWord .
type HonorWord struct {
ID int `json:"id"`
Word string `json:"word"`
Text string `json:"text"`
Desc string `json:"desc"`
Priority string `json:"priority"`
Start xtime.Time `json:"start"`
End xtime.Time `json:"end"`
}
// HMap get hid-honorWord map
func HMap() map[int][]*HonorWord {
h := make(map[int][]*HonorWord)
sArr := strings.Split(hStr, "\n")
for _, v := range sArr {
ws := strings.Split(v, "|")
id, err := strconv.Atoi(ws[0])
if err != nil {
log.Error("strconv.Atoi(%s) error(%v)", ws[0], err)
}
wd := HonorWord{
ID: id,
Word: ws[1],
Text: ws[2],
Desc: ws[3],
Priority: ws[4],
}
h[id] = append(h[id], &wd)
start, err := time.ParseInLocation(layout, ws[5], time.Local)
if err != nil {
continue
}
wd.Start = xtime.Time(start.Unix())
end, err := time.ParseInLocation(layout, ws[6], time.Local)
if err != nil {
continue
}
wd.End = xtime.Time(end.Unix())
}
return h
}
// HonorStat up honor stats form hbase.
type HonorStat struct {
Play int32 `family:"f" qualifier:"play" json:"play"`
PlayLastW int32 `family:"f" qualifier:"play_last_w" json:"play_last_w"`
Fans int32 `family:"f" qualifier:"fans" json:"fans"`
FansLastW int32 `family:"f" qualifier:"fans_last_w" json:"fans_last_w"`
PlayInc int32 `family:"f" qualifier:"play_inc" json:"play_inc"`
FansInc int32 `family:"f" qualifier:"fans_inc" json:"fans_inc"`
LikeInc int32 `family:"f" qualifier:"like_inc" json:"like_inc"`
ShInc int32 `family:"f" qualifier:"sh_inc" json:"sh_inc"`
CoinInc int32 `family:"f" qualifier:"coin_inc" json:"coin_inc"`
AvsInc int32 `family:"f" qualifier:"avs_inc" json:"avs_inc"`
DyInc int32 `family:"f" qualifier:"dy_inc" json:"dy_inc"`
Act1 int32 `family:"f" qualifier:"act1" json:"act1"`
Act2 int32 `family:"f" qualifier:"act2" json:"act2"`
Act3 int32 `family:"f" qualifier:"act3" json:"act3"`
Dr1 int32 `family:"f" qualifier:"dr1" json:"dr1"`
Dr2 int32 `family:"f" qualifier:"dr2" json:"dr2"`
Dr3 int32 `family:"f" qualifier:"dr3" json:"dr3"`
HottestAvNew int32 `family:"f" qualifier:"hottest_av_new" json:"hottest_av_new"`
HottestAvInc int32 `family:"f" qualifier:"hottest_av_inc" json:"hottest_av_inc"`
HottestAvAll int32 `family:"f" qualifier:"hottest_av_all" json:"hottest_av_all"`
Rank0 int32 `family:"r" qualifier:"rank0" json:"rank0"`
Rank1 int32 `family:"r" qualifier:"rank1" json:"rank1"`
Rank3 int32 `family:"r" qualifier:"rank3" json:"rank3"`
Rank4 int32 `family:"r" qualifier:"rank4" json:"rank4"`
Rank5 int32 `family:"r" qualifier:"rank5" json:"rank5"`
Rank36 int32 `family:"r" qualifier:"rank36" json:"rank36"`
Rank119 int32 `family:"r" qualifier:"rank119" json:"rank119"`
Rank129 int32 `family:"r" qualifier:"rank129" json:"rank129"`
Rank155 int32 `family:"r" qualifier:"rank155" json:"rank155"`
Rank160 int32 `family:"r" qualifier:"rank160" json:"rank160"`
Rank168 int32 `family:"r" qualifier:"rank168" json:"rank168"`
Rank181 int32 `family:"r" qualifier:"rank181" json:"rank181"`
}
// HonorLog .
type HonorLog struct {
ID int64 `json:"id"`
MID int64 `json:"mid"`
HID int `json:"hid"`
Count int64 `json:"count"`
CTime xtime.Time `json:"ctime"`
MTime xtime.Time `json:"mtime"`
}
// GenHonor .
func (hs *HonorStat) GenHonor(mid int64, distinctID int) int {
ids := hs.priority()
log.Info("GenHonor mid(%d) ids(%v) lastid(%d)", mid, ids, distinctID)
if len(ids) == 1 {
return ids[0]
}
var hids []int
for _, id := range ids {
if id != distinctID {
hids = append(hids, id)
}
}
if len(hids) == 1 {
return hids[0]
}
if len(hids) > 1 {
rand.Seed(mid)
var mu sync.Mutex
mu.Lock()
rnd := rand.Intn(len(hids))
mu.Unlock()
return hids[rnd]
}
return 0
}
func (hs *HonorStat) priority() []int {
ids, _ := hs.PrioritySSR()
if len(ids) > 0 {
return ids
}
ids, _ = hs.PrioritySR()
if len(ids) > 0 {
return ids
}
ids, _ = hs.PriorityR()
if len(ids) > 0 {
return ids
}
ids, _ = hs.PriorityA()
if len(ids) > 0 {
return ids
}
ids, _ = hs.PriorityB()
if len(ids) > 0 {
return ids
}
ids, _ = hs.PriorityC()
if len(ids) > 0 {
return ids
}
ids, _ = hs.PriorityD()
return ids
}
// PrioritySSR .
func (hs *HonorStat) PrioritySSR() ([]int, *RiseStage) {
ids := make([]int, 0)
rs := new(RiseStage)
hid := 0
if hs.Rank0 > 0 {
switch {
case hs.Rank0 <= 3:
hid = 1
case hs.Rank0 == 6 || hs.Rank0 == 66:
hid = 2
case hs.Rank0 == 23:
hid = 3
case hs.Rank0 <= 10:
hid = 4
}
if hid != 0 {
ids = append(ids, hid)
}
}
if (hs.Play > 100000000 && hs.PlayLastW < 100000000) || (hs.Play > 10000000 && hs.PlayLastW < 10000000) {
ids = append(ids, 5)
}
if hs.Fans > 1000000 && hs.FansLastW < 1000000 {
ids = append(ids, 6)
}
if hs.DyInc >= 300000 {
ids = append(ids, 7)
}
return ids, rs
}
// PrioritySR .
func (hs *HonorStat) PrioritySR() ([]int, *RiseStage) {
ids := make([]int, 0)
stars := new(RiseStage)
if hs.Rank0 > 0 && hs.Rank0 <= 100 {
ids = append(ids, 59)
}
if hs.Play > 100000 && hs.PlayLastW < 100000 {
ids = append(ids, 9)
}
if hs.Fans > 100000 && hs.FansLastW < 100000 {
ids = append(ids, 10)
}
if hs.PlayInc >= 1000000 {
ids = append(ids, 11)
stars.Play = 5
}
if hs.FansInc >= 10000 {
ids = append(ids, 12)
stars.Fans = 5
}
if hs.LikeInc >= 5000 {
ids = append(ids, 13)
stars.Like = 5
}
if hs.ShInc >= 1000 {
ids = append(ids, 14)
stars.Share = 5
}
if hs.CoinInc >= 3000 {
ids = append(ids, 15)
stars.Coin = 5
}
if hs.DyInc >= 50000 && hs.DyInc < 299999 {
ids = append(ids, 16)
}
return ids, stars
}
// PriorityR .
func (hs *HonorStat) PriorityR() ([]int, *RiseStage) {
ids := make([]int, 0)
stars := new(RiseStage)
on, _, _ := hs.PartionRank()
if on {
ids = append(ids, 8)
}
if hs.Play > 10000 && hs.PlayLastW < 10000 {
ids = append(ids, 17)
}
if hs.Fans > 10000 && hs.FansLastW < 10000 {
ids = append(ids, 18)
}
if hs.PlayInc >= 100000 && hs.PlayInc < 1000000 {
ids = append(ids, 19)
stars.Play = 4
}
if hs.FansInc >= 1000 && hs.FansInc < 10000 {
ids = append(ids, 20)
stars.Fans = 4
}
if hs.LikeInc >= 1000 && hs.LikeInc < 5000 {
ids = append(ids, 21)
stars.Like = 4
}
if hs.ShInc >= 100 && hs.ShInc < 1000 {
ids = append(ids, 22)
stars.Share = 4
}
if hs.CoinInc >= 1000 && hs.CoinInc < 3000 {
ids = append(ids, 24)
stars.Coin = 4
}
if hs.DyInc >= 5000 && hs.DyInc < 49999 {
ids = append(ids, 25)
}
return ids, stars
}
// PriorityA .
func (hs *HonorStat) PriorityA() ([]int, *RiseStage) {
ids := make([]int, 0)
stars := new(RiseStage)
if hs.AvsInc >= 5 {
ids = append(ids, 23)
}
if hs.Play > 1000 && hs.PlayLastW < 1000 {
ids = append(ids, 26)
}
if hs.Fans >= 1000 && hs.FansLastW < 1000 {
ids = append(ids, 27)
}
if hs.PlayInc >= 10000 && hs.PlayInc < 100000 {
ids = append(ids, 28)
stars.Play = 3
}
if hs.FansInc >= 100 && hs.FansInc < 1000 {
ids = append(ids, 29)
stars.Fans = 3
}
if hs.LikeInc >= 500 && hs.LikeInc < 1000 {
ids = append(ids, 30)
stars.Like = 3
}
if hs.ShInc >= 50 && hs.ShInc < 100 {
ids = append(ids, 31)
stars.Share = 3
}
if hs.CoinInc >= 100 && hs.CoinInc < 1000 {
ids = append(ids, 33)
stars.Coin = 3
}
if hs.DyInc >= 500 && hs.DyInc < 4999 {
ids = append(ids, 34)
}
return ids, stars
}
// PriorityB .
func (hs *HonorStat) PriorityB() ([]int, *RiseStage) {
ids := make([]int, 0)
stars := new(RiseStage)
if hs.AvsInc >= 3 && hs.AvsInc <= 5 {
ids = append(ids, 32)
}
if (hs.Fans > 500 && hs.FansLastW < 500) || (hs.Fans > 600 && hs.FansLastW < 600) || (hs.Fans > 700 && hs.FansLastW < 700) || (hs.Fans > 800 && hs.FansLastW < 800) || (hs.Fans > 900 && hs.FansLastW < 900) {
ids = append(ids, 35)
}
if hs.PlayInc >= 1000 && hs.PlayInc < 10000 {
ids = append(ids, 36)
stars.Play = 2
}
if hs.FansInc >= 10 && hs.FansInc < 100 {
ids = append(ids, 37)
stars.Fans = 2
}
if hs.LikeInc >= 30 && hs.LikeInc < 500 {
ids = append(ids, 38)
stars.Like = 2
}
if hs.ShInc >= 10 && hs.ShInc < 50 {
ids = append(ids, 39)
stars.Share = 2
}
if hs.AvsInc >= 1 && hs.AvsInc <= 2 {
ids = append(ids, 40)
}
if hs.CoinInc >= 30 && hs.CoinInc < 100 {
ids = append(ids, 41)
stars.Coin = 2
}
if hs.DyInc >= 100 && hs.DyInc < 499 {
ids = append(ids, 42)
}
if hs.FansInc/10 > 2 && hs.FansLastW/10 < 2 {
ids = append(ids, 43)
}
if hs.PlayInc >= 100 && hs.PlayInc < 1000 {
ids = append(ids, 44)
stars.Play = 2
}
if hs.FansInc >= 1 && hs.FansInc < 10 {
ids = append(ids, 45)
stars.Fans = 2
}
return ids, stars
}
// PriorityC .
func (hs *HonorStat) PriorityC() ([]int, *RiseStage) {
ids := make([]int, 0)
stars := new(RiseStage)
if hs.PlayInc > 0 && hs.PlayInc < 100 {
ids = append(ids, 46)
stars.Play = 1
}
if hs.LikeInc > 0 && hs.LikeInc < 30 {
ids = append(ids, 47)
stars.Like = 1
}
if hs.ShInc > 0 && hs.ShInc < 10 {
ids = append(ids, 48)
stars.Share = 1
}
if hs.CoinInc >= 1 && hs.CoinInc < 30 {
ids = append(ids, 49)
stars.Coin = 1
}
if hs.DyInc >= 1 && hs.DyInc <= 99 {
ids = append(ids, 50)
}
return ids, stars
}
// PriorityD .
func (hs *HonorStat) PriorityD() ([]int, *RiseStage) {
ids := make([]int, 0)
stars := new(RiseStage)
if hs.FansInc <= 0 {
ids = append(ids, 51)
}
if hs.PlayInc == 0 {
ids = append(ids, 52)
}
if hs.LikeInc == 0 {
ids = append(ids, 53)
}
if hs.ShInc == 0 {
ids = append(ids, 54)
}
if hs.AvsInc == 0 {
ids = append(ids, 55)
}
if hs.CoinInc == 0 {
ids = append(ids, 56)
}
if hs.DyInc == 0 {
ids = append(ids, 57)
}
return ids, stars
}
// PartionRank .
func (hs *HonorStat) PartionRank() (bool, string, int32) {
partions := make(map[int]string)
partions[1] = "动画"
partions[168] = "国创相关"
partions[3] = "音乐"
partions[129] = "舞蹈"
partions[4] = "游戏"
partions[36] = "科技"
partions[160] = "生活"
partions[119] = "鬼畜"
partions[155] = "时尚"
partions[5] = "娱乐"
partions[181] = "影视"
if hs.Rank1 != 0 && hs.Rank1 <= 100 {
return true, partions[1], hs.Rank1
}
if hs.Rank168 != 0 && hs.Rank168 <= 100 {
return true, partions[168], hs.Rank168
}
if hs.Rank3 != 0 && hs.Rank3 <= 100 {
return true, partions[3], hs.Rank3
}
if hs.Rank129 != 0 && hs.Rank129 <= 100 {
return true, partions[129], hs.Rank129
}
if hs.Rank4 != 0 && hs.Rank4 <= 100 {
return true, partions[4], hs.Rank4
}
if hs.Rank36 != 0 && hs.Rank36 <= 100 {
return true, partions[36], hs.Rank36
}
if hs.Rank160 != 0 && hs.Rank160 <= 100 {
return true, partions[160], hs.Rank160
}
if hs.Rank119 != 0 && hs.Rank119 <= 100 {
return true, partions[119], hs.Rank119
}
if hs.Rank155 != 0 && hs.Rank155 <= 100 {
return true, partions[155], hs.Rank155
}
if hs.Rank5 != 0 && hs.Rank5 <= 100 {
return true, partions[5], hs.Rank5
}
if hs.Rank181 != 0 && hs.Rank181 <= 100 {
return true, partions[181], hs.Rank181
}
return false, "", 0
}
// LatestSunday when today=sunday,return today,else return last week's sunday
func LatestSunday() time.Time {
now := time.Now()
today, _ := time.ParseInLocation(layout, now.Format(layout), time.Local)
sunday := today.AddDate(0, 0, int(-now.Weekday()))
return sunday
}