Create & Init Project...

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

View File

@@ -0,0 +1,47 @@
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = ["const.go"],
importpath = "go-common/app/interface/main/app-view/model",
tags = ["automanaged"],
deps = [
"//app/service/main/archive/api:go_default_library",
"//app/service/main/archive/model/archive:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [
":package-srcs",
"//app/interface/main/app-view/model/act:all-srcs",
"//app/interface/main/app-view/model/ad:all-srcs",
"//app/interface/main/app-view/model/bangumi:all-srcs",
"//app/interface/main/app-view/model/creative:all-srcs",
"//app/interface/main/app-view/model/elec:all-srcs",
"//app/interface/main/app-view/model/game:all-srcs",
"//app/interface/main/app-view/model/live:all-srcs",
"//app/interface/main/app-view/model/manager:all-srcs",
"//app/interface/main/app-view/model/region:all-srcs",
"//app/interface/main/app-view/model/report:all-srcs",
"//app/interface/main/app-view/model/search:all-srcs",
"//app/interface/main/app-view/model/special:all-srcs",
"//app/interface/main/app-view/model/tag:all-srcs",
"//app/interface/main/app-view/model/view:all-srcs",
],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)

View File

@@ -0,0 +1,27 @@
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = ["act.go"],
importpath = "go-common/app/interface/main/app-view/model/act",
tags = ["automanaged"],
)
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 act
// Relate bnj Relate
type Relate struct {
URL string `json:"url"`
Img string `json:"img"`
}

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 = ["ad.go"],
importpath = "go-common/app/interface/main/app-view/model/ad",
tags = ["automanaged"],
deps = ["//app/interface/main/app-view/model: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,118 @@
package ad
import (
"encoding/json"
"strconv"
"go-common/app/interface/main/app-view/model"
)
type Ad struct {
RequestID string `json:"request_id,omitempty"`
AdsControl json.RawMessage `json:"ads_control,omitempty"`
AdsInfo map[int64]map[int64]*AdsInfo `json:"ads_info,omitempty"`
ClientIP string `json:"-"`
}
type AdsInfo struct {
Index int `json:"index,omitempty"`
AdInfo *AdInfo `json:"ad_info,omitempty"`
IsAd bool `json:"is_ad,omitempty"`
CmMark int `json:"cm_mark,omitempty"`
CardIndex int `json:"card_index,omitempty"`
}
type AdInfo struct {
CreativeID int64 `json:"creative_id,omitempty"`
CreativeType int64 `json:"creative_type,omitempty"`
CreativeContent *struct {
Title string `json:"title,omitempty"`
Desc string `json:"description,omitempty"`
ButtonTitle string `json:"button_title,omitempty"`
VideoID int64 `json:"video_id,omitempty"`
UserName string `json:"username,omitempty"`
ImageURL string `json:"image_url,omitempty"`
ImageMD5 string `json:"image_md5,omitempty"`
LogURL string `json:"log_url,omitempty"`
LogMD5 string `json:"log_md5,omitempty"`
URL string `json:"url,omitempty"`
ClickURL string `json:"click_url,omitempty"`
ShowURL string `json:"show_url,omitempty"`
} `json:"creative_content,omitempty"`
AdCb string `json:"ad_cb,omitempty"`
CardType int `json:"card_type,omitempty"`
Extra json.RawMessage `json:"extra,omitempty"`
Resource int64 `json:"-"`
Source int64 `json:"-"`
RequestID string `json:"-"`
IsAd bool `json:"-"`
CmMark int `json:"-"`
Index int `json:"-"`
IsAdLoc bool `json:"-"`
CardIndex int `json:"-"`
ClientIP string `json:"-"`
// ad
URI string `json:"-"`
Param string `json:"-"`
Goto string `json:"-"`
View int `json:"-"`
Danmaku int `json:"-"`
}
func (ad *Ad) Convert(resource int64) (ads []*AdInfo, aids []int64) {
if ad == nil {
return
}
if adsInfo, ok := ad.AdsInfo[resource]; ok {
ads = make([]*AdInfo, 0, len(adsInfo))
for source, info := range adsInfo {
var adInfo *AdInfo
if info != nil {
if info.AdInfo != nil {
adInfo = info.AdInfo
adInfo.RequestID = ad.RequestID
adInfo.Resource = resource
adInfo.Source = source
adInfo.IsAd = info.IsAd
adInfo.IsAdLoc = true
adInfo.CmMark = info.CmMark
adInfo.Index = info.Index
adInfo.CardIndex = info.CardIndex
adInfo.ClientIP = ad.ClientIP
// http://info.bilibili.co/pages/viewpage.action?pageId=6227100
switch adInfo.CardType {
case 6:
adInfo.Goto = model.GotoAv
if adInfo.CreativeContent != nil {
adInfo.Param = strconv.FormatInt(int64(adInfo.CreativeContent.VideoID), 10)
if adInfo.CreativeContent.VideoID > 0 {
aids = append(aids, adInfo.CreativeContent.VideoID)
}
} else {
adInfo.Param = "0"
}
adInfo.URI = model.FillURI(adInfo.Goto, adInfo.Param, nil)
default:
adInfo.Goto = model.GotoWeb
if adInfo.CreativeContent != nil {
adInfo.Param = adInfo.CreativeContent.URL
}
adInfo.URI = model.FillURI(adInfo.Goto, adInfo.Param, nil)
}
} else {
adInfo = &AdInfo{RequestID: ad.RequestID, Resource: resource, Source: source, IsAdLoc: true, IsAd: info.IsAd, CmMark: info.CmMark, Index: info.Index, CardIndex: info.CardIndex, ClientIP: ad.ClientIP}
}
}
if adInfo != nil {
ads = append(ads, adInfo)
}
}
}
return
}
type AdInfos []*AdInfo
func (a AdInfos) Len() int { return len(a) }
func (a AdInfos) Less(i, j int) bool { return int64(a[i].Index) < int64(a[j].Index) }
func (a AdInfos) Swap(i, j int) { a[i], a[j] = a[j], a[i] }

View File

@@ -0,0 +1,27 @@
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = ["bangumi.go"],
importpath = "go-common/app/interface/main/app-view/model/bangumi",
tags = ["automanaged"],
)
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,60 @@
package bangumi
import "encoding/json"
// Season struct
type Season struct {
AllowDownload string `json:"allow_download,omitempty"`
SeasonID string `json:"season_id,omitempty"`
IsJump int `json:"is_jump,omitempty"`
Title string `json:"title,omitempty"`
Cover string `json:"cover,omitempty"`
IsFinish string `json:"is_finish,omitempty"`
NewestEpID string `json:"newest_ep_id,omitempty"`
NewestEpIndex string `json:"newest_ep_index,omitempty"`
TotalCount string `json:"total_count,omitempty"`
Weekday string `json:"weekday,omitempty"`
UserSeason *struct {
Attention string `json:"attention,omitempty"`
} `json:"user_season,omitempty"`
Player *struct {
Aid int64 `json:"aid,omitempty"`
Vid string `json:"vid,omitempty"`
Cid int64 `json:"cid,omitempty"`
From string `json:"from,omitempty"`
} `json:"player,omitempty"`
}
// Movie struct
type Movie struct {
AllowDownload int8 `json:"allow_download,omitempty"`
MovieStatus int `json:"movie_status"`
PayUser *struct {
Status int `json:"status"`
} `json:"pay_user"`
Payment json.RawMessage `json:"payment,omitempty"`
Season *struct {
Actor json.RawMessage `json:"actor,omitempty"`
Area string `json:"area"`
Areas json.RawMessage `json:"areas,omitempty"`
Cover string `json:"cover"`
Evaluate string `json:"evaluate"`
PubTime string `json:"pub_time"`
SeasonID int `json:"season_id"`
Tags json.RawMessage `json:"tags,omitempty"`
Title string `json:"title"`
TotalDuration int `json:"total_duration"`
} `json:"season"`
TrailerAid int `json:"trailer_aid"`
VideoLength int `json:"video_length"`
VipQuality int `json:"vip_quality"`
Activity json.RawMessage `json:"activity,omitempty"`
List []struct {
Cid int64 `json:"cid"`
HasAlias bool `json:"has_alias"`
Page int `json:"page"`
Part string `json:"part"`
Type string `json:"type"`
Vid string `json:"vid"`
} `json:"list,omitempty"`
}

View File

@@ -0,0 +1,305 @@
package model
import (
"encoding/json"
"fmt"
"net/url"
"strings"
"go-common/app/service/main/archive/api"
"go-common/app/service/main/archive/model/archive"
)
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_b
PlatAndroidB = int8(10)
// PlatIPhoneB is int8 for iphone_b
PlatIPhoneB = int8(11)
// PlatAndroidTVYST is int8 for AndroidTV_YST Global.
PlatAndroidTVYST = int8(12)
GotoAv = "av"
GotoWeb = "web"
GotoBangumi = "bangumi"
GotoLive = "live"
GotoGame = "game"
GotoArticle = "article"
GotoSpecial = "special"
GotoCm = "cm"
GotoSearchUpper = "search_upper"
// for fill uri
GotoAudio = "audio"
GotoSong = "song"
GotoAudioTag = "audio_tag"
GotoAlbum = "album"
GotoClip = "clip"
GotoDaily = "daily"
// EnvPro is pro.
EnvPro = "pro"
EnvHK = "hk"
// EnvTest is env.
EnvTest = "test"
// EnvDev is env.
EnvDev = "dev"
// ForbidCode is forbid by law
ForbidCode = -110
StatusIng = 0
StatusPay = 1
StatusFree = 2
StatusVipFree = 3
StatusVipOnly = 4
StatusVipFirst = 5
CoverIng = "即将上映"
CoverPay = "付费观看"
CoverFree = "免费观看"
CoverVipFree = "付费观看"
CoverVipOnly = "专享"
CoverVipFirst = "抢先"
Hans = "hans"
Hant = "hant"
FromOrder = "order"
FromOperation = "operation"
FromRcmd = "recommend"
)
var (
OperateType = map[int]string{
0: GotoWeb,
1: GotoGame,
2: GotoAv,
3: GotoBangumi,
4: GotoLive,
6: GotoArticle,
7: GotoDaily,
8: GotoAudio,
9: GotoSong,
10: GotoAlbum,
11: GotoClip,
}
AvHandler = func(a *api.Arc, trackid string, ap *archive.PlayerInfo) func(uri string) string {
var player string
if ap != nil {
bs, _ := json.Marshal(ap)
player = url.QueryEscape(string(bs))
if strings.IndexByte(player, '+') > -1 {
player = strings.Replace(player, "+", "%20", -1)
}
}
return func(uri string) string {
if a == nil {
return uri
}
var uriStr string
if player != "" && (a.Dimension.Height != 0 || a.Dimension.Width != 0) {
uriStr = fmt.Sprintf("%s?page=1&player_preload=%s&player_width=%d&player_height=%d&player_rotate=%d", uri, player, a.Dimension.Width, a.Dimension.Height, a.Dimension.Rotate)
} else if player != "" {
uriStr = fmt.Sprintf("%s?page=1&player_preload=%s", uri, player)
} else if a.Dimension.Height != 0 || a.Dimension.Width != 0 {
uriStr = fmt.Sprintf("%s?player_width=%d&player_height=%d&player_rotate=%d", uri, a.Dimension.Width, a.Dimension.Height, a.Dimension.Rotate)
}
if trackid != "" {
if uriStr == "" {
uriStr = fmt.Sprintf("%s?trackid=%s", uri, trackid)
} else {
uriStr = fmt.Sprintf("%s&trackid=%s", uriStr, trackid)
}
}
if uriStr != "" {
return uriStr
}
return uri
}
}
LiveRoomHandler = func(broadcastType int) func(uri string) string {
return func(uri string) string {
return fmt.Sprintf("%s?broadcast_type=%d", uri, broadcastType)
}
}
)
// IsAndroid check plat is android or ipad.
func IsAndroid(plat int8) bool {
return plat == PlatAndroid || plat == PlatAndroidG || plat == PlatAndroidI
}
// IsIOS check plat is iphone or ipad.
func IsIOS(plat int8) bool {
return plat == PlatIPad || plat == PlatIPhone || plat == PlatIPadI || plat == PlatIPhoneI || plat == PlatIPhoneB
}
// IsIPhone check plat is iphone.
func IsIPhone(plat int8) bool {
return plat == PlatIPhone || plat == PlatIPhoneI || plat == PlatIPhoneB
}
// IsIPad check plat is pad.
func IsIPad(plat int8) bool {
return plat == PlatIPad || plat == PlatIPadI || plat == PlatIpadHD
}
// IsIOSNormal check plat is ios except iphone_b
func IsIOSNormal(plat int8) bool {
return plat == PlatIPad || plat == PlatIPhone || plat == PlatIPadI || plat == PlatIPhoneI
}
// IsIPhoneB check plat is iphone_b
func IsIPhoneB(plat int8) bool {
return plat == PlatIPhoneB
}
// 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 PlatIpadHD
case "android", "android_b":
return PlatAndroid
case "win", "winphone":
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
case "android_tv_yst":
return PlatAndroidTVYST
case "iphone_b":
return PlatIPhoneB
}
return PlatIPhone
}
// IsOverseas is overseas
func IsOverseas(plat int8) bool {
return plat == PlatAndroidI || plat == PlatIPhoneI || plat == PlatIPadI
}
// FillURI deal app schema.
func FillURI(gt, param string, f func(uri string) string) (uri string) {
if param == "" {
return
}
switch gt {
case GotoAv, "":
uri = "bilibili://video/" + param
case GotoLive:
uri = "bilibili://live/" + param
case GotoBangumi:
uri = "https://www.bilibili.com/bangumi/play/ss" + param
case GotoArticle:
uri = "bilibili://article/" + param
case GotoGame:
uri = param
case GotoAudio:
uri = "bilibili://music/menu/detail/" + param
case GotoSong:
uri = "bilibili://music/detail/" + param
case GotoAudioTag:
uri = "bilibili://music/categorydetail/" + param
case GotoDaily:
uri = "bilibili://pegasus/list/daily/" + param
case GotoAlbum:
uri = "bilibili://album/" + param
case GotoClip:
uri = "bilibili://clip/" + param
case GotoWeb:
uri = param
}
if f != nil {
uri = f(uri)
}
return
}
func StatusMark(status int) string {
if status == 0 {
return CoverIng
} else if status == 1 {
return CoverPay
} else if status == 2 {
return CoverFree
} else if status == 3 {
return CoverVipFree
} else if status == 4 {
return CoverVipOnly
} else if status == 5 {
return CoverVipFirst
}
return ""
}
// InvalidBuild check source build is not allow by config build and condition.
// eg: when condition is gt, means srcBuild must gt cfgBuild, otherwise is invalid srcBuild.
func InvalidBuild(srcBuild, cfgBuild int, cfgCond string) bool {
if cfgBuild != 0 && cfgCond != "" {
switch cfgCond {
case "gt":
if cfgBuild >= srcBuild {
return true
}
case "lt":
if cfgBuild <= srcBuild {
return true
}
case "eq":
if cfgBuild != srcBuild {
return true
}
case "ne":
if cfgBuild == srcBuild {
return true
}
}
}
return false
}
// Platform plat to platform
func Platform(plat int8) string {
if IsAndroid(plat) {
return "android"
} else {
return "ios"
}
}

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 = ["creative.go"],
importpath = "go-common/app/interface/main/app-view/model/creative",
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,27 @@
package creative
// FollowSwitch get auto follow switch from creative.
type FollowSwitch struct {
State int8 `json:"state"`
}
// PlayerFollow for player auto follow.
type PlayerFollow struct {
Show bool `json:"show"`
}
// Points is
type Points struct {
Type int `json:"type"`
From int64 `json:"from"`
To int64 `json:"to"`
Content string `json:"content"`
}
// Points is
type Bgm struct {
Sid int64 `json:"sid"`
Title string `json:"title"`
Author string `json:"author"`
JumpURL string `json:"jump_url"`
}

View File

@@ -0,0 +1,27 @@
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/app-view/model/elec",
tags = ["automanaged"],
)
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,14 @@
package elec
import "encoding/json"
type Info struct {
Start int64 `json:"start,omitempty"`
Show bool `json:"show"`
Total int `json:"total,omitempty"`
Count int `json:"count,omitempty"`
State int `json:"state,omitempty"`
List json.RawMessage `json:"list,omitempty"`
User json.RawMessage `json:"user,omitempty"`
ElecSet json.RawMessage `json:"elec_set,omitempty"`
}

View File

@@ -0,0 +1,27 @@
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/app-view/model/game",
tags = ["automanaged"],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)

View File

@@ -0,0 +1,13 @@
package game
type Info struct {
GameBaseID int64 `json:"game_base_id,omitempty"`
IsOnline bool `json:"is_online,omitempty"`
GameName string `json:"game_name,omitempty"`
GameIcon string `json:"game_icon,omitempty"`
GameStatus int `json:"game_status,omitempty"`
GameLink string `json:"game_link,omitempty"`
GradeStatus int `json:"grade_status,omitempty"`
Grade float64 `json:"grade,omitempty"`
BookNum int64 `json:"book_num,omitempty"`
}

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 = ["live.go"],
importpath = "go-common/app/interface/main/app-view/model/live",
tags = ["automanaged"],
deps = ["//app/interface/main/app-view/model: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,35 @@
package live
import (
"strconv"
"go-common/app/interface/main/app-view/model"
)
type Live struct {
Mid int64 `json:"mid"`
RoomID int64 `json:"roomid"`
Title string `json:"title"`
URI string `json:"uri,omitempty"`
}
type RoomInfo struct {
UID string `json:"uid"`
RoomID string `json:"roomid"`
Title string `json:"title"`
BroadcastType int `json:"broadcast_type"`
}
func (l *Live) LiveChange(r *RoomInfo) {
var (
err error
)
if l.Mid, err = strconv.ParseInt(r.UID, 10, 64); err != nil {
return
}
if l.RoomID, err = strconv.ParseInt(r.RoomID, 10, 64); err != nil {
return
}
l.Title = r.Title
l.URI = model.FillURI(model.GotoLive, strconv.FormatInt(l.RoomID, 10), model.LiveRoomHandler(r.BroadcastType))
}

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 = ["manager.go"],
importpath = "go-common/app/interface/main/app-view/model/manager",
tags = ["automanaged"],
deps = [
"//library/log:go_default_library",
"//library/time:go_default_library",
"//library/xstr: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,82 @@
package manager
import (
"encoding/json"
"go-common/library/log"
xtime "go-common/library/time"
"go-common/library/xstr"
)
type Relate struct {
ID int64 `json:"id,omitempty"`
Param int64 `json:"param,omitempty"`
Goto string `json:"goto,omitempty"`
Title string `json:"title,omitempty"`
ResourceIDs string `json:"resource_ids,omitempty"`
TagIDs string `json:"tag_ids,omitempty"`
ArchiveIDs string `json:"archive_ids,omitempty"`
RecReason string `json:"rec_reason,omitempty"`
Position int `json:"position,omitempty"`
STime xtime.Time `json:"stime,omitempty"`
ETime xtime.Time `json:"etime,omitempty"`
PlatVer json.RawMessage `json:"plat_ver,omitempty"`
Versions map[int8][]*Version `json:"versions,omitempty"`
Aids map[int64]struct{}
Tids map[int64]struct{}
Rids map[int64]struct{}
}
type Version struct {
Plat int8 `json:"plat,omitempty"`
Build int `json:"build,omitempty"`
Condition string `json:"conditions,omitempty"`
}
func (r *Relate) Change() {
var (
vs []*Version
err error
)
if r.ArchiveIDs != "" {
var aids []int64
if aids, err = xstr.SplitInts(r.ArchiveIDs); err != nil {
log.Error("xstr.SplitInts(%s) error(%v)", r.ArchiveIDs, err)
return
}
r.Aids = make(map[int64]struct{}, len(aids))
for _, aid := range aids {
r.Aids[aid] = struct{}{}
}
}
if r.TagIDs != "" {
var tids []int64
if tids, err = xstr.SplitInts(r.TagIDs); err != nil {
log.Error("xstr.SplitInts(%s) error(%v)", r.TagIDs, err)
return
}
r.Tids = make(map[int64]struct{}, len(tids))
for _, tid := range tids {
r.Tids[tid] = struct{}{}
}
}
if r.ResourceIDs != "" {
var rids []int64
if rids, err = xstr.SplitInts(r.ResourceIDs); err != nil {
log.Error("xstr.SplitInts(%s) error(%v)", r.ResourceIDs, err)
return
}
r.Rids = make(map[int64]struct{}, len(rids))
for _, rid := range rids {
r.Rids[rid] = struct{}{}
}
}
if err = json.Unmarshal(r.PlatVer, &vs); err != nil {
log.Error("json.Unmarshal(%s) error(%v)", r.PlatVer, err)
return
}
vm := make(map[int8][]*Version, len(vs))
for _, v := range vs {
vm[v.Plat] = append(vm[v.Plat], v)
}
r.Versions = vm
}

View File

@@ -0,0 +1,27 @@
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = ["region.go"],
importpath = "go-common/app/interface/main/app-view/model/region",
tags = ["automanaged"],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)

View File

@@ -0,0 +1,13 @@
package region
type Region struct {
Rid int `json:"tid"`
Reid int `json:"reid"`
Name string `json:"name"`
Logo string `json:"logo"`
Goto string `json:"goto"`
Param string `json:"param"`
Rank string `json:"-"`
Plat int8 `json:"-"`
Area string `json:"-"`
}

View File

@@ -0,0 +1,27 @@
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = ["report.go"],
importpath = "go-common/app/interface/main/app-view/model/report",
tags = ["automanaged"],
)
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,48 @@
package report
const (
ArchivePVR = 0 // 稿件存在色情、暴力、反动
ArchiveCopyWrite = 1 // 稿件存在版权内容
ArchiveCrash = 2 // 与站内其他视频撞车
ArchiveNotOwn = 3 // 不能参与充电计划:非自制作品
ArchiveBusiness = 4 // 不能参与充电计划:有商业推广内容
Other = 5 // 其他
// oversea
ArchivePVRG = 6
ArchiveCopyWriteG = 7
ArchiveHarmG = 8
OtherG = 9
Reason1 = "存在色情、暴力、反动内容"
Reason2 = "存在版权问题"
Reason3 = "与站内其他视频撞车"
Reason4 = "不能参与充电计划:非自制作品"
Reason5 = "不能参与充电计划:有商业推广内容"
Reason6 = "其他问题"
//
Reason7 = "存在色情、暴力血腥等內容"
Reason8 = "存在版權問題"
Reason9 = "存在有害或危險行為內容"
Reason10 = "其他問題"
Reason11 = "存在有害或危害行为内容"
Desc1 = "为帮助审核人员更快处理, 请补充 违规内容出现位置等详细信息"
Desc2 = "如果您认为这个稿件作品侵犯了您的相关权益, 请登录哔哩哔哩网页端 ,找到页面底部的「侵权投诉」入口,下载页面中的「侵权申诉表」,按照提示录入相关信息后以邮件的形式反馈我们。"
Desc3 = "为帮助审核人员更快处理, 请补充重复稿件av号等详细信息"
Desc4 = "为帮助审核人员更快处理, 请补充转载来源等详细信息"
Desc5 = "为帮助审核人员更快处理, 请补充商业元素出现位置等详细信息"
Desc6 = "为帮助审核人员更快处理, 请补充问题类型和出现位置等详细信息"
//
Desc7 = "為幫助稽核人員更快處理, 請補充違規內容出現位置等詳細資訊"
Desc8 = "如果您認為這個稿件作品侵犯了您的相關權益, 請登入嗶哩嗶哩網頁端 ,找到頁面底部的「侵權投訴」入口,下載頁面中的「侵權申訴表」,按照提示錄入相關資訊後以郵件的形式反饋我們。"
Desc9 = "為幫助稽核人員更快處理, 請補充違規內容出現位置等詳細資訊"
Desc10 = "為幫助稽核人員更快處理, 請補充問題型別和出現位置等詳細資訊"
Desc11 = "为帮助审核人员更快处理, 请补充违规内容出现位置等详细信息"
)
type CopyWriter struct {
Typ int `json:"type"`
Reason string `json:"reason"`
Desc string `json:"desc"`
AllowAdd bool `json:"allow_add"`
}

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 = ["search.go"],
importpath = "go-common/app/interface/main/app-view/model/search",
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 search
type Upper struct {
Mid int64 `json:"up_id"`
RecReason string `json:"rec_reason"`
}

View File

@@ -0,0 +1,27 @@
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = ["special.go"],
importpath = "go-common/app/interface/main/app-view/model/special",
tags = ["automanaged"],
)
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,11 @@
package special
type Card struct {
ID int64 `json:"id,omitempty"`
Title string `json:"title,omitempty"`
Desc string `json:"desc,omitempty"`
Cover string `json:"cover,omitempty"`
ReType int `json:"re_type,omitempty"`
ReValue string `json:"re_value,omitempty"`
Badge string `json:"badge,omitempty"`
}

View File

@@ -0,0 +1,27 @@
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/app-view/model/tag",
tags = ["automanaged"],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)

View File

@@ -0,0 +1,13 @@
package tag
type Tag struct {
TagID int64 `json:"tag_id"`
Name string `json:"tag_name"`
Cover string `json:"cover"`
Likes int64 `json:"likes"`
Hates int64 `json:"hates"`
Liked int8 `json:"liked"`
Hated int8 `json:"hated"`
Attribute int8 `json:"attribute"`
IsActivity int8 `json:"is_activity"`
}

View File

@@ -0,0 +1,49 @@
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = [
"bnj.go",
"view.go",
],
importpath = "go-common/app/interface/main/app-view/model/view",
tags = ["automanaged"],
deps = [
"//app/interface/main/app-view/model:go_default_library",
"//app/interface/main/app-view/model/act:go_default_library",
"//app/interface/main/app-view/model/ad:go_default_library",
"//app/interface/main/app-view/model/bangumi:go_default_library",
"//app/interface/main/app-view/model/creative:go_default_library",
"//app/interface/main/app-view/model/elec:go_default_library",
"//app/interface/main/app-view/model/game:go_default_library",
"//app/interface/main/app-view/model/live:go_default_library",
"//app/interface/main/app-view/model/manager:go_default_library",
"//app/interface/main/app-view/model/special:go_default_library",
"//app/interface/main/app-view/model/tag:go_default_library",
"//app/interface/main/dm2/model:go_default_library",
"//app/service/main/archive/api:go_default_library",
"//app/service/main/archive/model/archive:go_default_library",
"//app/service/main/resource/model:go_default_library",
"//app/service/openplatform/pgc-season/api/grpc/season/v1: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,46 @@
package view
import (
"go-common/app/interface/main/app-view/model/elec"
"go-common/app/service/main/archive/model/archive"
xtime "go-common/library/time"
)
// BnjMain is
type BnjMain struct {
*archive.Archive3
// now user
ReqUser *ReqUser `json:"req_user,omitempty"`
Pages []*Page `json:"pages,omitempty"`
Elec *elec.Info `json:"elec,omitempty"`
Relates []*BnjItem `json:"relates"`
// player_icon
PlayerIcon *PlayerIcon `json:"player_icon,omitempty"`
ElecBigText string `json:"elec_big_text"`
ElecSmallText string `json:"elec_small_text"`
}
// BnjList is
type BnjList struct {
Item []*BnjItem `json:"list"`
}
// BnjItem is
type BnjItem struct {
Aid int64 `json:"aid"`
Cid int64 `json:"cid"`
Tid int32 `json:"tid"`
Pic string `json:"pic"`
Copyright int32 `json:"copyright"`
PubDate xtime.Time `json:"pubdate"`
IsAd int `json:"is_ad"`
Title string `json:"title"`
Desc string `json:"desc,omitempty"`
Stat archive.Stat3 `json:"stat,omitempty"`
Duration int64 `json:"duration,omitempty"`
Author archive.Author3 `json:"owner,omitempty"`
Dimension archive.Dimension `json:"dimension,omitempty"`
ReqUser *ReqUser `json:"req_user,omitempty"`
Pages []*Page `json:"pages,omitempty"`
Rights archive.Rights3 `json:"rights"`
}

View File

@@ -0,0 +1,521 @@
package view
import (
"encoding/json"
"strconv"
"go-common/app/interface/main/app-view/model"
"go-common/app/interface/main/app-view/model/act"
"go-common/app/interface/main/app-view/model/ad"
"go-common/app/interface/main/app-view/model/bangumi"
"go-common/app/interface/main/app-view/model/creative"
"go-common/app/interface/main/app-view/model/elec"
"go-common/app/interface/main/app-view/model/game"
"go-common/app/interface/main/app-view/model/live"
"go-common/app/interface/main/app-view/model/manager"
"go-common/app/interface/main/app-view/model/special"
"go-common/app/interface/main/app-view/model/tag"
dm2 "go-common/app/interface/main/dm2/model"
"go-common/app/service/main/archive/api"
"go-common/app/service/main/archive/model/archive"
resmdl "go-common/app/service/main/resource/model"
"go-common/app/service/openplatform/pgc-season/api/grpc/season/v1"
xtime "go-common/library/time"
)
// BnjView 2018
type BnjView struct {
BeginTime int64 `json:"begin_time"`
*api.Arc
// owner_ext
OwnerExt OwnerExt `json:"owner_ext"`
// now user
ReqUser *ReqUser `json:"req_user,omitempty"`
LiveRoom struct {
ID int64 `json:"id"`
DmServer string `json:"dm_server"`
DmPort int64 `json:"dm_port"`
Title string `json:"title"`
Uname string `json:"uname"`
Cover string `json:"cover"`
} `json:"live_room"`
Pages []*Page `json:"pages,omitempty"`
Elec *elec.Info `json:"elec,omitempty"`
Stat *api.Stat `json:"stat,omitempty"`
Lottery struct {
ActID int64 `json:"act_id"`
Times int64 `json:"times"`
Rule string `json:"rule"`
List []string `json:"list"`
Winners []string `json:"winners"`
} `json:"lottery"`
Relates []*act.Relate `json:"relates"`
PastReviews []*BnjPastReview `json:"past_review"`
}
// BnjPastReview struct
type BnjPastReview struct {
AID int64 `json:"aid"`
Img string `json:"img"`
Title string `json:"title"`
}
// vip active subID.
const (
VIPActiveView = 1
VIPActivePGC = 2
VIPActiveCenter = 3
)
// View struct
type View struct {
*ViewStatic
// owner_ext
OwnerExt OwnerExt `json:"owner_ext"`
// now user
ReqUser *ReqUser `json:"req_user,omitempty"`
// tag info
Tag []*tag.Tag `json:"tag,omitempty"`
// movie
Movie *bangumi.Movie `json:"movie,omitempty"`
// bangumi
Season *bangumi.Season `json:"season,omitempty"`
// bp
Bp json.RawMessage `json:"bp,omitempty"`
// elec
Elec *elec.Info `json:"elec,omitempty"`
// history
History *History `json:"history,omitempty"`
// audio
Audio *Audio `json:"audio,omitempty"`
// contribute data
Contributions []*Contribution `json:"contributions,omitempty"`
// relate data
Relates []*Relate `json:"relates,omitempty"`
ReturnCode string `json:"-"`
UserFeature string `json:"-"`
IsRec int8 `json:"-"`
// dislike reason
Dislikes []*Dislike `json:"dislike_reasons,omitempty"`
// dm
DMSeg int `json:"dm_seg,omitempty"`
// paster
Paster *resmdl.Paster `json:"paster,omitempty"`
// player_icon
PlayerIcon *PlayerIcon `json:"player_icon,omitempty"`
// vip_active
VIPActive string `json:"vip_active,omitempty"`
// cm
CMs []*CM `json:"cms,omitempty"`
// cm config
CMConfig *CMConfig `json:"cm_config,omitempty"`
// asset
Asset *Asset `json:"asset,omitempty"`
ActivityURL string `json:"activity_url,omitempty"`
Bgm []*creative.Bgm `json:"bgm,omitempty"`
Staff []*Staff `json:"staff,omitempty"`
}
// Staff from cooperation
type Staff struct {
Mid int64 `json:"mid,omitempty"`
Title string `json:"title,omitempty"`
Face string `json:"face,omitempty"`
Name string `json:"name,omitempty"`
OfficialVerify struct {
Type int `json:"type"`
Desc string `json:"desc"`
} `json:"official_verify"`
Vip struct {
Type int `json:"vipType"`
DueDate int64 `json:"vipDueDate"`
DueRemark string `json:"dueRemark"`
AccessStatus int `json:"accessStatus"`
VipStatus int `json:"vipStatus"`
VipStatusWarn string `json:"vipStatusWarn"`
} `json:"vip"`
Attention int `json:"attention"`
}
// ViewStatic struct
type ViewStatic struct {
*archive.Archive3
Pages []*Page `json:"pages,omitempty"`
}
// ReqUser struct
type ReqUser struct {
Attention int `json:"attention"`
Favorite int8 `json:"favorite"`
Like int8 `json:"like"`
Dislike int8 `json:"dislike"`
Coin int8 `json:"coin"`
}
// Page struct
type Page struct {
*archive.Page3
Metas []*Meta `json:"metas"`
DMLink string `json:"dmlink"`
Audio *Audio `json:"audio,omitempty"`
DM *dm2.SubjectInfo `json:"dm,omitempty"`
}
// Meta struct
type Meta struct {
Quality int `json:"quality"`
Format string `json:"format"`
Size int64 `json:"size"`
}
// History struct
type History struct {
Cid int64 `json:"cid"`
Progress int64 `json:"progress"`
}
// CM struct
type CM struct {
RequestID string `json:"request_id,omitempty"`
RscID int64 `json:"rsc_id,omitempty"`
SrcID int64 `json:"src_id,omitempty"`
IsAdLoc bool `json:"is_ad_loc,omitempty"`
IsAd bool `json:"is_ad,omitempty"`
CmMark int `json:"cm_mark,omitempty"`
ClientIP string `json:"client_ip,omitempty"`
Index int `json:"index,omitempty"`
AdInfo *ad.AdInfo `json:"ad_info,omitempty"`
}
// CMConfig struct
type CMConfig struct {
AdsControl json.RawMessage `json:"ads_control,omitempty"`
MonitorInfo json.RawMessage `json:"monitor_info,omitempty"`
}
// Dislike struct
type Dislike struct {
ID int `json:"reason_id"`
Name string `json:"reason_name"`
}
// OwnerExt struct
type OwnerExt struct {
OfficialVerify struct {
Type int `json:"type"`
Desc string `json:"desc"`
} `json:"official_verify,omitempty"`
Live *live.Live `json:"live,omitempty"`
Vip struct {
Type int `json:"vipType"`
DueDate int64 `json:"vipDueDate"`
DueRemark string `json:"dueRemark"`
AccessStatus int `json:"accessStatus"`
VipStatus int `json:"vipStatus"`
VipStatusWarn string `json:"vipStatusWarn"`
} `json:"vip"`
Assists []int64 `json:"assists"`
Fans int `json:"fans"`
Archives int `json:"-"`
}
// Relate struct
type Relate struct {
Aid int64 `json:"aid,omitempty"`
Pic string `json:"pic,omitempty"`
Title string `json:"title,omitempty"`
Author *api.Author `json:"owner,omitempty"`
Stat api.Stat `json:"stat,omitempty"`
Duration int64 `json:"duration,omitempty"`
Goto string `json:"goto,omitempty"`
Param string `json:"param,omitempty"`
URI string `json:"uri,omitempty"`
Rating float64 `json:"rating,omitempty"`
Reserve string `json:"reserve,omitempty"`
From string `json:"from,omitempty"`
Desc string `json:"desc,omitempty"`
RcmdReason string `json:"rcmd_reason,omitempty"`
Badge string `json:"badge,omitempty"`
Cid int64 `json:"cid,omitempty"`
SeasonType int32 `json:"season_type,omitempty"`
RatingCount int32 `json:"rating_count,omitempty"`
// cm ad
AdIndex int `json:"ad_index,omitempty"`
CmMark int `json:"cm_mark,omitempty"`
SrcID int64 `json:"src_id,omitempty"`
RequestID string `json:"request_id,omitempty"`
CreativeID int64 `json:"creative_id,omitempty"`
CreativeType int64 `json:"creative_type,omitempty"`
Type int `json:"type,omitempty"`
Cover string `json:"cover,omitempty"`
ButtonTitle string `json:"button_title,omitempty"`
View int `json:"view,omitempty"`
Danmaku int `json:"danmaku,omitempty"`
IsAd bool `json:"is_ad,omitempty"`
IsAdLoc bool `json:"is_ad_loc,omitempty"`
AdCb string `json:"ad_cb,omitempty"`
ShowURL string `json:"show_url,omitempty"`
ClickURL string `json:"click_url,omitempty"`
ClientIP string `json:"client_ip,omitempty"`
Extra json.RawMessage `json:"extra,omitempty"`
Button *Button `json:"button,omitempty"`
CardIndex int `json:"card_index,omitempty"`
Source string `json:"-"`
AvFeature json.RawMessage `json:"-"`
TrackID string `json:"trackid"`
}
// Button struct
type Button struct {
Title string `json:"title,omitempty"`
URI string `json:"uri,omitempty"`
}
// Contribution struct
type Contribution struct {
Aid int64 `json:"aid,omitempty"`
Pic string `json:"pic,omitempty"`
Title string `json:"title,omitempty"`
Author api.Author `json:"owner,omitempty"`
Stat api.Stat `json:"stat,omitempty"`
CTime xtime.Time `json:"ctime,omitempty"`
}
// Audio struct
type Audio struct {
Title string `json:"title"`
Cover string `json:"cover_url"`
SongID int `json:"song_id"`
Play int `json:"play_count"`
Reply int `json:"reply_count"`
UpperID int `json:"upper_id"`
Entrance string `json:"entrance"`
SongAttr int `json:"song_attr"`
}
// PlayerIcon struct
type PlayerIcon struct {
URL1 string `json:"url1,omitempty"`
Hash1 string `json:"hash1,omitempty"`
URL2 string `json:"url2,omitempty"`
Hash2 string `json:"hash2,omitempty"`
CTime xtime.Time `json:"ctime,omitempty"`
}
// VipPlayURL playurl token struct.
type VipPlayURL struct {
From string `json:"from"`
Ts int64 `json:"ts"`
Aid int64 `json:"aid"`
Cid int64 `json:"cid"`
Mid int64 `json:"mid"`
VIP int `json:"vip"`
SVIP int `json:"svip"`
Owner int `json:"owner"`
Fcs string `json:"fcs"`
}
// NewRelateRec struct
type NewRelateRec struct {
TrackID string `json:"trackid"`
Oid int64 `json:"id"`
Source string `json:"source"`
AvFeature json.RawMessage `json:"av_feature"`
Goto string `json:"goto"`
Title string `json:"title"`
IsDalao int8 `json:"is_dalao"`
RcmdReason struct {
Content string `json:"content"`
} `json:"rcmd_reason"`
}
type Asset struct {
Paid int8 `json:"paid"`
Price int64 `json:"price"`
Msg struct {
Desc1 string `json:"desc1"`
Desc2 string `json:"desc2"`
} `json:"msg"`
}
// FromAv func
func (r *Relate) FromAv(a *api.Arc, from, trackid string, ap *archive.PlayerInfo, cooperation bool) {
r.Aid = a.Aid
r.Title = a.Title
r.Pic = a.Pic
r.Author = &a.Author
r.Stat = a.Stat
r.Duration = a.Duration
r.Cid = a.FirstCid
r.Goto = model.GotoAv
r.Param = strconv.FormatInt(a.Aid, 10)
r.URI = model.FillURI(r.Goto, r.Param, model.AvHandler(a, trackid, ap))
r.From = from
if a.AttrVal(archive.AttrBitIsCooperation) == archive.AttrYes && r.Author != nil && r.Author.Name != "" && cooperation {
r.Author.Name = r.Author.Name + " 等联合创作"
}
}
// FromGame func
func (r *Relate) FromGame(i *game.Info, from string) {
if i.GameLink == "" {
return
}
r.Title = "相关游戏:" + i.GameName
r.Pic = i.GameIcon
r.Rating = i.Grade
if i.GameStatus == 1 || i.GameStatus == 2 {
var reserve string
if i.BookNum < 10000 {
reserve = strconv.FormatInt(i.BookNum, 10) + "人预约"
} else {
reserve = strconv.FormatFloat(float64(i.BookNum)/10000, 'f', 1, 64) + "万人预约"
}
r.Reserve = reserve
}
r.Goto = model.GotoGame
r.URI = model.FillURI(r.Goto, i.GameLink, nil)
r.Param = strconv.FormatInt(i.GameBaseID, 10)
r.Button = &Button{Title: "进入", URI: r.URI}
r.From = from
}
// FromSpecial func
func (r *Relate) FromSpecial(sp *special.Card, from string) {
r.Title = sp.Title
r.Pic = sp.Cover
r.Goto = model.GotoSpecial
// TODO FUCK game
r.URI = model.FillURI(model.OperateType[sp.ReType], sp.ReValue, nil)
r.Desc = sp.Desc
r.Param = strconv.FormatInt(sp.ID, 10)
r.RcmdReason = sp.Badge
r.From = from
}
// FromOperate func
func (r *Relate) FromOperate(i *NewRelateRec, a *api.Arc, info *game.Info, sp *special.Card, from string, cooperation bool) {
switch i.Goto {
case model.GotoAv:
r.FromAv(a, from, "", nil, cooperation)
case model.GotoGame:
r.FromGame(info, from)
case model.GotoSpecial:
r.FromSpecial(sp, from)
}
if r.Title == "" {
r.Title = i.Title
}
if i.RcmdReason.Content != "" {
r.RcmdReason = i.RcmdReason.Content
}
}
// FromOperate func
func (r *Relate) FromOperateOld(i *manager.Relate, a *api.Arc, info *game.Info, sp *special.Card, from string, cooperation bool) {
switch i.Goto {
case model.GotoAv:
r.FromAv(a, from, "", nil, cooperation)
case model.GotoGame:
r.FromGame(info, from)
case model.GotoSpecial:
r.FromSpecial(sp, from)
}
if r.Title == "" {
r.Title = i.Title
}
if r.RcmdReason == "" {
r.RcmdReason = i.RecReason
}
}
// FromCM func
func (r *Relate) FromCM(ad *ad.AdInfo) {
r.AdIndex = ad.Index
r.CmMark = ad.CmMark
r.SrcID = ad.Source
r.RequestID = ad.RequestID
r.CreativeID = ad.CreativeID
r.CreativeType = ad.CreativeType
r.Type = ad.CardType
r.URI = ad.URI
r.Param = ad.Param
r.Goto = model.GotoCm
r.View = ad.View
r.Danmaku = ad.Danmaku
r.IsAd = ad.IsAd
r.IsAdLoc = ad.IsAdLoc
r.AdCb = ad.AdCb
r.ClientIP = ad.ClientIP
r.Extra = ad.Extra
r.CardIndex = ad.CardIndex
if ad.CreativeContent != nil {
r.Aid = ad.CreativeContent.VideoID
r.Cover = ad.CreativeContent.ImageURL
r.Title = ad.CreativeContent.Title
r.ButtonTitle = ad.CreativeContent.ButtonTitle
r.Desc = ad.CreativeContent.Desc
r.ShowURL = ad.CreativeContent.ShowURL
r.ClickURL = ad.CreativeContent.ClickURL
}
}
// FromCM func
func (c *CM) FromCM(ad *ad.AdInfo) {
c.RequestID = ad.RequestID
c.RscID = ad.Resource
c.SrcID = ad.Source
c.IsAd = ad.IsAd
c.IsAdLoc = ad.IsAdLoc
c.Index = ad.Index
c.CmMark = ad.CmMark
c.ClientIP = ad.ClientIP
c.AdInfo = ad
}
// FromBangumi func
func (r *Relate) FromBangumi(ban *v1.CardInfoProto) {
r.Title = ban.Title
r.Pic = ban.NewEp.Cover
r.Stat = api.Stat{
Danmaku: int32(ban.Stat.Danmaku),
View: int32(ban.Stat.View),
Fav: int32(ban.Stat.Follow),
}
r.Goto = model.GotoBangumi
r.Param = strconv.FormatInt(int64(ban.SeasonId), 10)
r.URI = model.FillURI(r.Goto, r.Param, nil)
r.SeasonType = ban.SeasonType
r.Badge = ban.SeasonTypeName
r.Desc = ban.NewEp.IndexShow
if ban.Rating != nil {
r.Rating = float64(ban.Rating.Score)
r.RatingCount = ban.Rating.Count
}
}
// TripleParam struct
type TripleParam struct {
MobiApp string `form:"mobi_app"`
Build string `form:"build"`
AID int64 `form:"aid"`
Ak string `form:"access_key"`
From string `form:"from"`
}
// TripleRes struct
type TripleRes struct {
Like bool `json:"like"`
Coin bool `json:"coin"`
Fav bool `json:"fav"`
Prompt bool `json:"prompt"`
Multiply int64 `json:"multiply"`
UpID int64 `json:"-"`
Anticheat bool `json:"-"`
}
// Videoshot videoshot
type Videoshot struct {
*archive.Videoshot
Points []*creative.Points `json:"points,omitempty"`
}