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,60 @@
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = [
"abserver.go",
"account.go",
"archive.go",
"article.go",
"baidu.go",
"bigdata.go",
"bnj.go",
"coin.go",
"elec.go",
"feedback.go",
"help.go",
"icon.go",
"nav.go",
"online.go",
"reply.go",
"search.go",
"shop.go",
"tag.go",
"web.go",
"wechat.go",
],
importpath = "go-common/app/interface/main/web/model",
tags = ["automanaged"],
deps = [
"//app/interface/main/dm2/model:go_default_library",
"//app/interface/main/reply/model/reply:go_default_library",
"//app/interface/main/tag/model:go_default_library",
"//app/interface/openplatform/article/model:go_default_library",
"//app/service/main/account/api:go_default_library",
"//app/service/main/account/model:go_default_library",
"//app/service/main/archive/api:go_default_library",
"//app/service/main/broadcast/api/grpc/v1:go_default_library",
"//app/service/main/ugcpay/api/grpc/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,10 @@
package model
import "encoding/json"
// AbServer .
type AbServer struct {
Hit json.RawMessage `json:"hit"`
Expire int `json:"expire"`
Vars json.RawMessage `json:"vars"`
}

View File

@@ -0,0 +1,120 @@
package model
import (
"strconv"
accmdl "go-common/app/service/main/account/api"
account "go-common/app/service/main/account/model"
)
// Space space top photo
type Space struct {
SImg string `json:"s_img"`
LImg string `json:"l_img"`
}
// Card Card and Space and Relation and Archive Count.
type Card struct {
Card *AccountCard `json:"card"`
Space *Space `json:"space,omitempty"`
Following bool `json:"following"`
ArchiveCount int `json:"archive_count"`
ArticleCount int `json:"article_count"`
Follower int64 `json:"follower"`
}
// AccountCard struct.
type AccountCard struct {
Mid string `json:"mid"`
Name string `json:"name"`
Approve bool `json:"approve"`
Sex string `json:"sex"`
Rank string `json:"rank"`
Face string `json:"face"`
DisplayRank string `json:"DisplayRank"`
Regtime int64 `json:"regtime"`
Spacesta int `json:"spacesta"`
Birthday string `json:"birthday"`
Place string `json:"place"`
Description string `json:"description"`
Article int `json:"article"`
Attentions []int64 `json:"attentions"`
Fans int `json:"fans"`
Friend int `json:"friend"`
Attention int `json:"attention"`
Sign string `json:"sign"`
LevelInfo struct {
Cur int `json:"current_level"`
Min int `json:"current_min"`
NowExp int `json:"current_exp"`
NextExp interface{} `json:"next_exp"`
} `json:"level_info"`
Pendant account.PendantInfo `json:"pendant"`
Nameplate account.NameplateInfo `json:"nameplate"`
Official accmdl.OfficialInfo
OfficialVerify struct {
Type int `json:"type"`
Desc string `json:"desc"`
} `json:"official_verify"`
Vip struct {
Type int `json:"vipType"`
DueRemark string `json:"dueRemark"`
AccessStatus int `json:"accessStatus"`
VipStatus int `json:"vipStatus"`
VipStatusWarn string `json:"vipStatusWarn"`
} `json:"vip"`
}
// FromCard from account catd.
func (ac *AccountCard) FromCard(c *account.Card) {
ac.Mid = strconv.FormatInt(c.Mid, 10)
ac.Name = c.Name
// ac.Approve =
ac.Sex = c.Sex
ac.Rank = strconv.FormatInt(int64(c.Rank), 10)
ac.DisplayRank = "0"
ac.Face = c.Face
// ac.Regtime =
if c.Silence == 1 {
ac.Spacesta = -2
}
// ac.Birthday =
// ac.Place =
// ac.Description =
// ac.Article =
// ac.Attentions = []int64{}
// ac.Fans =
// ac.Friend
// ac.Attention =
ac.Sign = c.Sign
ac.LevelInfo.Cur = int(c.Level)
ac.LevelInfo.NextExp = 0
// ac.LevelInfo.Min =
ac.Pendant = c.Pendant
ac.Nameplate = c.Nameplate
if c.Official.Role == 0 {
ac.OfficialVerify.Type = -1
} else {
if c.Official.Role <= 2 {
ac.OfficialVerify.Type = 0
ac.OfficialVerify.Desc = c.Official.Title
} else {
ac.OfficialVerify.Type = 1
ac.OfficialVerify.Desc = c.Official.Title
}
}
ac.Official = c.Official
ac.Vip.Type = int(c.Vip.Type)
ac.Vip.VipStatus = int(c.Vip.Status)
}
// DefaultProfile .
var DefaultProfile = &accmdl.ProfileStatReply{
Profile: &account.Profile{
Sex: "保密",
Rank: 10000,
Face: "https://static.hdslb.com/images/member/noface.gif",
Sign: "没签名",
},
LevelInfo: accmdl.LevelInfo{},
}

View File

@@ -0,0 +1,159 @@
package model
import (
"go-common/app/interface/main/dm2/model"
tagmdl "go-common/app/interface/main/tag/model"
accmdl "go-common/app/service/main/account/model"
arcmdl "go-common/app/service/main/archive/api"
ugcmdl "go-common/app/service/main/ugcpay/api/grpc/v1"
)
// View view data
type View struct {
// archive data
*arcmdl.Arc
NoCache bool `json:"no_cache"`
// video data pages
Pages []*arcmdl.Page `json:"pages,omitempty"`
Subtitle *Subtitle `json:"subtitle"`
Asset *ugcmdl.AssetQueryResp `json:"asset,omitempty"`
}
// AssetRelation .
type AssetRelation struct {
State int `json:"state"`
}
// Stat archive stat web struct
type Stat struct {
Aid int64 `json:"aid"`
View interface{} `json:"view"`
Danmaku int32 `json:"danmaku"`
Reply int32 `json:"reply"`
Fav int32 `json:"favorite"`
Coin int32 `json:"coin"`
Share int32 `json:"share"`
Like int32 `json:"like"`
NowRank int32 `json:"now_rank"`
HisRank int32 `json:"his_rank"`
NoReprint int32 `json:"no_reprint"`
Copyright int32 `json:"copyright"`
}
// Detail detail data
type Detail struct {
View *View
Card *Card
Tags []*tagmdl.Tag
Reply *ReplyHot
Related []*arcmdl.Arc
}
// ArchiveUserCoins .
type ArchiveUserCoins struct {
Multiply int64 `json:"multiply"`
}
// Subtitle dm subTitle.
type Subtitle struct {
AllowSubmit bool `json:"allow_submit"`
List []*SubtitleItem `json:"list"`
}
// SubtitleItem dm subTitle.
type SubtitleItem struct {
*model.VideoSubtitle
Author *accmdl.Info `json:"author"`
}
// TripleRes struct
type TripleRes struct {
Like bool `json:"like"`
Coin bool `json:"coin"`
Fav bool `json:"fav"`
Multiply int64 `json:"multiply"`
UpID int64 `json:"-"`
Anticheat bool `json:"-"`
}
var (
// StatAllowStates archive stat allow states
statAllowStates = []int32{-9, -15, -30}
)
// CheckAllowState check archive stat allow state
func CheckAllowState(arc *arcmdl.Arc) bool {
if arc.IsNormal() {
return true
}
for _, allow := range statAllowStates {
if arc.State == allow {
return true
}
}
return false
}
// FmtArc fmt grpc arc to archive3
func FmtArc(arc *arcmdl.Arc) (data *arcmdl.Arc) {
data = &arcmdl.Arc{
Aid: arc.Aid,
Videos: arc.Videos,
TypeID: arc.TypeID,
TypeName: arc.TypeName,
Copyright: arc.Copyright,
Pic: arc.Pic,
Title: arc.Title,
PubDate: arc.PubDate,
Ctime: arc.Ctime,
Desc: arc.Desc,
State: arc.State,
Access: arc.Access,
Attribute: arc.Attribute,
Tag: arc.Tag,
Tags: arc.Tags,
Duration: arc.Duration,
MissionID: arc.MissionID,
OrderID: arc.OrderID,
RedirectURL: arc.RedirectURL,
Forward: arc.Forward,
Rights: arcmdl.Rights{
Bp: arc.Rights.Bp,
Elec: arc.Rights.Elec,
Download: arc.Rights.Download,
Movie: arc.Rights.Movie,
Pay: arc.Rights.Pay,
HD5: arc.Rights.HD5,
NoReprint: arc.Rights.NoReprint,
Autoplay: arc.Rights.Autoplay,
UGCPay: arc.Rights.UGCPay,
},
Author: arcmdl.Author{
Mid: arc.Author.Mid,
Name: arc.Author.Name,
Face: arc.Author.Face,
},
Stat: arcmdl.Stat{
Aid: arc.Stat.Aid,
View: arc.Stat.View,
Danmaku: arc.Stat.Danmaku,
Reply: arc.Stat.Reply,
Fav: arc.Stat.Fav,
Coin: arc.Stat.Coin,
Share: arc.Stat.Share,
NowRank: arc.Stat.NowRank,
HisRank: arc.Stat.HisRank,
Like: arc.Stat.Like,
DisLike: arc.Stat.DisLike,
},
ReportResult: arc.ReportResult,
Dynamic: arc.Dynamic,
FirstCid: arc.FirstCid,
Dimension: arcmdl.Dimension{
Width: arc.Dimension.Width,
Height: arc.Dimension.Height,
Rotate: arc.Dimension.Rotate,
},
}
return
}

View File

@@ -0,0 +1,87 @@
package model
import (
artmdl "go-common/app/interface/openplatform/article/model"
accmdl "go-common/app/service/main/account/model"
"go-common/library/time"
"strconv"
)
// Info struct.
type Info struct {
Mid string `json:"mid"`
Name string `json:"uname"`
Sex string `json:"sex"`
Sign string `json:"sign"`
Avatar string `json:"avatar"`
Rank string `json:"rank"`
DisplayRank string `json:"DisplayRank"`
LevelInfo struct {
Cur int `json:"current_level"`
Min int `json:"current_min"`
NowExp int `json:"current_exp"`
NextExp interface{} `json:"next_exp"`
} `json:"level_info"`
Pendant accmdl.PendantInfo `json:"pendant"`
Nameplate accmdl.NameplateInfo `json:"nameplate"`
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"`
// article
ID int64 `json:"id"`
Title string `json:"title"`
PublishTime time.Time `json:"publish_time"`
Following bool `json:"following"`
}
// FromCard from card.
func (i *Info) FromCard(c *accmdl.Card) {
i.Mid = strconv.FormatInt(c.Mid, 10)
i.Name = c.Name
i.Sex = c.Sex
i.Sign = c.Sign
i.Avatar = c.Face
i.Rank = strconv.FormatInt(int64(c.Rank), 10)
i.DisplayRank = "0"
i.LevelInfo.Cur = int(c.Level)
i.LevelInfo.NextExp = 0
// i.LevelInfo.Min =
i.Pendant = c.Pendant
i.Nameplate = c.Nameplate
if c.Official.Role == 0 {
i.OfficialVerify.Type = -1
} else {
if c.Official.Role <= 2 {
i.OfficialVerify.Type = 0
i.OfficialVerify.Desc = c.Official.Title
} else {
i.OfficialVerify.Type = 1
i.OfficialVerify.Desc = c.Official.Title
}
}
i.Vip.Type = int(c.Vip.Type)
i.Vip.VipStatus = int(c.Vip.Status)
i.Vip.DueDate = c.Vip.DueDate
}
// Meta struct.
type Meta struct {
*artmdl.Meta
Like int `json:"like"`
}
// ArticleUpInfo struct.
type ArticleUpInfo struct {
ArtCount int `json:"art_count"`
Follower int64 `json:"follower"`
IsFollowing bool `json:"is_following"`
}

View File

@@ -0,0 +1,14 @@
package model
import xtime "go-common/library/time"
// Kv baidu kv struct.
type Kv struct {
ID int `json:"id"`
Name string `json:"name"`
Pic string `json:"pic"`
URL string `json:"url"`
ResID int `json:"resource_id"`
STime xtime.Time `json:"stime"`
ETime xtime.Time `json:"etime"`
}

View File

@@ -0,0 +1,179 @@
package model
import arcmdl "go-common/app/service/main/archive/api"
// Rank bigdata rank struct
type Rank struct {
Note string `json:"note"`
Code int `json:"code"`
Page int `json:"page"`
Num int `json:"num"`
List []*RankArchive `json:"list"`
}
// RankArchive bigdata rank archive struct
type RankArchive struct {
Aid interface{} `json:"aid"`
Author string `json:"author"`
Coins int32 `json:"coins"`
Duration string `json:"duration"`
Mid int64 `json:"mid"`
Pic string `json:"pic"`
Play interface{} `json:"play"`
Pts int `json:"pts"`
Title string `json:"title"`
Trend *int `json:"trend"`
VideoReview int32 `json:"video_review"`
Rights arcmdl.Rights `json:"rights"`
Others []*Other `json:"others,omitempty"`
}
// Other bigdata other rank struct
type Other struct {
Aid interface{} `json:"aid"`
Play interface{} `json:"play"`
VideoReview int32 `json:"video_review"`
Coins int32 `json:"coins"`
Pts int `json:"pts"`
Title string `json:"title"`
Pic string `json:"pic"`
Duration string `json:"duration"`
Rights arcmdl.Rights `json:"rights"`
}
// RankIndex rank index struct.
type RankIndex struct {
Code int `json:"code"`
Pages int `json:"pages"`
Num int `json:"num"`
List map[string]*IndexArchive `json:"list"`
}
// IndexArchive rank index archive struct.
type IndexArchive struct {
Aid string `json:"aid"`
Typename string `json:"typename"`
Title string `json:"title"`
Subtitle string `json:"subtitle"`
Play interface{} `json:"play"`
Review int32 `json:"review"`
VideoReview int32 `json:"video_review"`
Favorites int32 `json:"favorites"`
Mid int64 `json:"mid"`
Author string `json:"author"`
Description string `json:"description"`
Create string `json:"create"`
Pic string `json:"pic"`
Coins int32 `json:"coins"`
Duration string `json:"duration"`
Badgepay bool `json:"badgepay"`
Rights arcmdl.Rights `json:"rights"`
}
// RankRecommend rank recommend data struct
type RankRecommend struct {
Code int `json:"code"`
Pages int `json:"pages"`
Num int `json:"num"`
List []*IndexArchive `json:"list"`
}
// RankRegion rank region data struct
type RankRegion struct {
Hot *RankDetail `json:"hot"`
HotOriginal *RankDetail `json:"hot_original"`
}
// RankDetail rank region detail struct
type RankDetail struct {
Note string `json:"note"`
Code int `json:"code"`
Page int `json:"page"`
Num int `json:"num"`
List []*RegionArchive `json:"list"`
}
// RegionArchive bigdata region rank archive struct
type RegionArchive struct {
Aid string `json:"aid"`
Typename string `json:"typename"`
Title string `json:"title"`
Subtitle string `json:"subtitle"`
Play interface{} `json:"play"`
Review int32 `json:"review"`
VideoReview int32 `json:"video_review"`
Favorites int32 `json:"favorites"`
Mid int64 `json:"mid"`
Author string `json:"author"`
Description string `json:"description"`
Create string `json:"create"`
Pic string `json:"pic"`
Coins int32 `json:"coins"`
Duration string `json:"duration"`
Badgepay bool `json:"badgepay"`
Pts int `json:"pts"`
Rights arcmdl.Rights `json:"rights"`
}
// TagArchive bigdata region rank archive struct
type TagArchive struct {
Title string `json:"title"`
Author string `json:"author"`
Description string `json:"description"`
Pic string `json:"pic"`
Play string `json:"play"`
Favorites string `json:"favorites"`
Mid string `json:"mid"`
Review string `json:"review"`
CreatedAt string `json:"created_at"`
VideoReview string `json:"video_review"`
Coins string `json:"coins"`
Duration string `json:"duration"`
Aid int64 `json:"aid"`
Pts int `json:"pts"`
Trend int `json:"trend"`
Rights arcmdl.Rights `json:"rights"`
}
// RankData rank service return data
type RankData struct {
Note string `json:"note"`
List []*RankArchive `json:"list"`
}
// RankNewArchive rank archive new struct
type RankNewArchive struct {
*NewArchive
*RankStat
Others []*NewArchive `json:"others,omitempty"`
}
// RankNew rank new struct.
type RankNew struct {
Note string `json:"note"`
List []*RankNewArchive `json:"list"`
}
// NewArchive new rank archive struct
type NewArchive struct {
Aid int64 `json:"aid"`
Score int `json:"score"`
}
// RankStat rank archive stat.
type RankStat struct {
Play int32 `json:"play"`
Coin int32 `json:"coin"`
Danmu int32 `json:"danmu"`
}
// Custom game custom struct
type Custom struct {
Aid int64 `json:"aid"`
Title string `json:"title"`
Pic string `json:"pic"`
Note string `json:"note"`
Pos int `json:"-"`
URL string `json:"url"`
Type string `json:"type"`
}

View File

@@ -0,0 +1,43 @@
package model
import (
arcmdl "go-common/app/service/main/archive/api"
)
// Bnj2019 .
type Bnj2019 struct {
*Bnj2019View
Elec *ElecShow `json:"elec"`
Related []*Bnj2019Related `json:"related"`
ReqUser *ReqUser `json:"req_user"`
}
// Bnj2019View .
type Bnj2019View struct {
*arcmdl.Arc
Pages []*arcmdl.Page `json:"pages"`
}
// Bnj2019Related .
type Bnj2019Related struct {
*arcmdl.Arc
Pages []*arcmdl.Page `json:"pages"`
}
// ReqUser req user.
type ReqUser struct {
Attention bool `json:"attention"`
Favorite bool `json:"favorite"`
Like bool `json:"like"`
Dislike bool `json:"dislike"`
Coin int64 `json:"coin"`
}
// Timeline bnj timeline.
type Timeline struct {
Name string `json:"name"`
Start int64 `json:"start"`
End int64 `json:"end"`
Cover string `json:"cover"`
H5Cover string `json:"h5_cover"`
}

View File

@@ -0,0 +1,13 @@
package model
import (
v1 "go-common/app/service/main/archive/api"
)
// CoinArc coin archive.
type CoinArc struct {
*v1.Arc
Coins int64 `json:"coins"`
Time int64 `json:"time"`
IP string `json:"ip"`
}

View File

@@ -0,0 +1,24 @@
package model
import "encoding/json"
// ElecShow elec show
type ElecShow struct {
ShowInfo *ShowInfo `json:"show_info"`
AvCount int `json:"av_count"`
Count int `json:"count"`
TotalCount int64 `json:"total_count"`
SpecialDay int `json:"special_day"`
DisplayNum int `json:"display_num"`
AvList json.RawMessage `json:"av_list,omitempty"`
AvUser json.RawMessage `json:"av_user,omitempty"`
List json.RawMessage `json:"list,omitempty"`
User json.RawMessage `json:"user,omitempty"`
}
// ShowInfo show info
type ShowInfo struct {
Show bool `json:"show"`
State int8 `json:"state"`
Reason string `json:"reason,omitempty"`
}

View File

@@ -0,0 +1,21 @@
package model
// Feedback feedback param struct.
type Feedback struct {
Aid int64
Mid int64
TagID int64
Buvid string
Content *Content
Browser string
Version string
Email string
QQ string
Other string
}
// Content Content struct.
type Content struct {
Reason string `json:"reason"`
URL string `json:"url"`
}

View File

@@ -0,0 +1,39 @@
package model
import "go-common/library/time"
// HelpList help list
type HelpList struct {
Last bool `json:"last"`
ParentTypeID string `json:"parentTypeId"`
QuestionTypeDesc string `json:"questionTypeDesc"`
QuestionTypeID string `json:"questionTypeId"`
QuestionTypeName string `json:"questionTypeName"`
QuestionTypeStatus int `json:"questionTypeStatus"`
SortNo int `json:"sortNo"`
TypeLevel int `json:"typeLevel"`
}
// HelpDeatil help deatil and search
type HelpDeatil 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,10 @@
package model
// IndexIcon index icon struct.
type IndexIcon struct {
ID int64 `json:"id"`
Title string `json:"title"`
Links []string `json:"links"`
Icon string `json:"icon"`
Weight int `json:"weight"`
}

View File

@@ -0,0 +1,52 @@
package model
import (
account "go-common/app/service/main/account/model"
)
// NavResp struct of nav api response
type NavResp struct {
IsLogin bool `json:"isLogin"`
//AccessStatus int `json:"accessStatus"`
//DueRemark string `json:"dueRemark"`
EmailVerified int `json:"email_verified"`
Face string `json:"face"`
LevelInfo struct {
Cur int `json:"current_level"`
Min int `json:"current_min"`
NowExp int `json:"current_exp"`
NextExp interface{} `json:"next_exp"`
} `json:"level_info"`
Mid int64 `json:"mid"`
MobileVerified int `json:"mobile_verified"`
Coins float64 `json:"money"`
Moral float32 `json:"moral"`
OfficialVerify struct {
Type int `json:"type"`
Desc string `json:"desc"`
} `json:"officialVerify"`
Pendant account.PendantInfo `json:"pendant"`
Scores int `json:"scores"`
Uname string `json:"uname"`
VipDueDate int64 `json:"vipDueDate"`
VipStatus int `json:"vipStatus"`
VipType int `json:"vipType"`
VipPayType int32 `json:"vip_pay_type"`
Wallet *Wallet `json:"wallet"`
HasShop bool `json:"has_shop"`
ShopURL string `json:"shop_url"`
AllowanceCount int `json:"allowance_count"`
}
// FailedNavResp struct of failed nav response
type FailedNavResp struct {
IsLogin bool `json:"isLogin"`
}
// Wallet struct.
type Wallet struct {
Mid int64 `json:"mid"`
BcoinBalance float32 `json:"bcoin_balance"`
CouponBalance float32 `json:"coupon_balance"`
CouponDueTime int64 `json:"coupon_due_time"`
}

View File

@@ -0,0 +1,35 @@
package model
import v1 "go-common/app/service/main/archive/api"
// Online struct of online api response
type Online struct {
RegionCount map[int16]int `json:"region_count"`
AllCount int64 `json:"all_count"`
WebOnline int64 `json:"web_online"`
PlayOnline int64 `json:"play_online"`
}
// OnlineCount struct of online count api data
type OnlineCount struct {
ConnCount int64 `json:"conn_count"`
IPCount int64 `json:"ip_count"`
}
// LiveOnlineCount struct of live online count api data
type LiveOnlineCount struct {
IPConnect int64 `json:"ip_connect"`
TotalOnline int64 `json:"total_online"`
}
// OnlineAid online aids and count
type OnlineAid struct {
Aid int64 `json:"aid"`
Count int64 `json:"count"`
}
// OnlineArc archive whit online count
type OnlineArc struct {
*v1.Arc
OnlineCount int64 `json:"online_count"`
}

View File

@@ -0,0 +1,13 @@
package model
import (
"encoding/json"
rplmdl "go-common/app/interface/main/reply/model/reply"
)
// ReplyHot reply hot
type ReplyHot struct {
Page json.RawMessage `json:"page"`
Replies []*rplmdl.Reply `json:"replies"`
}

View File

@@ -0,0 +1,269 @@
package model
import (
"encoding/json"
accmdl "go-common/app/service/main/account/model"
)
// WxSearchType .
const WxSearchType = "wechat"
// Search all search.
type Search struct {
Code int `json:"code,omitempty"`
SeID string `json:"seid,omitempty"`
Page int `json:"page,omitempty"`
PageSize int `json:"pagesize,omitempty"`
Total int `json:"total,omitempty"`
NumResults int `json:"numResults"`
NumPages int `json:"numPages"`
SuggestKeyword string `json:"suggest_keyword"`
RqtType string `json:"rqt_type,omitempty"`
CostTime json.RawMessage `json:"cost_time,omitempty"`
ExpList json.RawMessage `json:"exp_list,omitempty"`
EggHit int `json:"egg_hit"`
PageInfo json.RawMessage `json:"pageinfo,omitempty"`
Result json.RawMessage `json:"result,omitempty"`
TopTList json.RawMessage `json:"top_tlist,omitempty"`
EggInfo *struct {
ID int64 `json:"id,omitempty"`
Source int64 `json:"source,omitempty"`
} `json:"egg_info,omitempty"`
ShowColumn int `json:"show_column"`
}
// SearchTypeRes search type res.
type SearchTypeRes struct {
Code int `json:"code,omitempty"`
SeID string `json:"seid,omitempty"`
Page int `json:"page,omitempty"`
PageSize int `json:"pagesize,omitempty"`
Total int `json:"total,omitempty"`
NumResults int `json:"numResults"`
NumPages int `json:"numPages"`
SuggestKeyword string `json:"suggest_keyword"`
RqtType string `json:"rqt_type,omitempty"`
CostTime json.RawMessage `json:"cost_time,omitempty"`
ExpList json.RawMessage `json:"exp_list,omitempty"`
EggHit int `json:"egg_hit"`
PageInfo json.RawMessage `json:"pageinfo,omitempty"`
Result json.RawMessage `json:"result,omitempty"`
ShowColumn int `json:"show_column"`
}
// SearchRec search recommend.
type SearchRec struct {
Code int `json:"code,omitempty"`
SeID string `json:"seid,omitempty"`
Page int `json:"page,omitempty"`
PageSize int `json:"pagesize,omitempty"`
Total int `json:"total,omitempty"`
NumResults int `json:"numResults"`
NumPages int `json:"numPages"`
SuggestKeyword string `json:"suggest_keyword"`
RqtType string `json:"rqt_type,omitempty"`
CostTime json.RawMessage `json:"cost_time,omitempty"`
ExpList json.RawMessage `json:"exp_list,omitempty"`
EggHit int `json:"egg_hit"`
Result json.RawMessage `json:"result,omitempty"`
}
// SearchAllArg search all api arguments.
type SearchAllArg struct {
Pn int `form:"page"`
Keyword string `form:"keyword" validate:"required"`
Rid int `form:"tids"`
Duration int `form:"duration" validate:"gte=0,lte=4"`
FromSource string `form:"from_source"`
Highlight int `form:"highlight"`
SingleColumn int `form:"-"`
}
// SearchTypeArg search type api arguments.
type SearchTypeArg struct {
Pn int `form:"page" validate:"min=1" default:"1"`
SearchType string `form:"search_type" validate:"required"`
Keyword string `form:"keyword" validate:"required"`
Order string `form:"order"`
Rid int64 `form:"tids"`
FromSource string `form:"from_source"`
Platform string `form:"platform" default:"web"`
Duration int `form:"duration" validate:"min=0,max=4"`
// article
CategoryID int64 `form:"category_id"`
// special
VpNum int `form:"vp_num"`
// bili user
BiliUserVl int `form:"bili_user_vl" default:"3"`
UserType int `form:"user_type" validate:"min=0,max=3"`
OrderSort int `form:"order_sort"`
Highlight int `form:"highlight"`
SingleColumn int `form:"-"`
}
// SearchDefault search default
type SearchDefault struct {
Trackid string `json:"seid"`
ID int64 `json:"id"`
ShowName string `json:"show_name"`
Name string `json:"name"`
Type int `json:"type"`
}
// SearchUpRecArg search up rec arg.
type SearchUpRecArg struct {
ServiceArea string `form:"service_area" validate:"required"`
Platform string `form:"platform" validate:"required"`
ContextID int64 `form:"context_id"`
MainTids []int64 `form:"main_tids,split"`
SubTids []int64 `form:"sub_tids,split"`
MobiApp string `form:"mobi_app"`
Device string `form:"device"`
Build int64 `form:"build"`
Ps int `form:"ps" default:"5" validate:"min=1,max=15"`
}
// SearchUpRecRes .
type SearchUpRecRes struct {
UpID int64 `json:"up_id"`
RecReason string `json:"rec_reason"`
Tid int16 `json:"tid"`
SecondTid int16 `json:"second_tid"`
}
// UpRecInfo .
type UpRecInfo struct {
Mid int64 `json:"mid"`
Name string `json:"name"`
Face string `json:"face"`
Official accmdl.OfficialInfo `json:"official"`
Follower int64 `json:"follower"`
Vip struct {
Type int32 `json:"type"`
Status int32 `json:"status"`
} `json:"vip"`
RecReason string `json:"rec_reason"`
Tid int16 `json:"tid"`
Tname string `json:"tname"`
SecondTid int16 `json:"second_tid"`
SecondTname string `json:"second_tname"`
Sign string `json:"sign"`
}
// UpRecData .
type UpRecData struct {
TrackID string `json:"track_id"`
List []*UpRecInfo `json:"list"`
}
// SearchEgg .
type SearchEgg struct {
Plat map[int64][]*struct {
EggID int64 `json:"egg_id"`
Plat int `json:"plat"`
URL string `json:"url"`
MD5 string `json:"md5"`
Size int64 `json:"size"`
} `json:"plat"`
ShowCount int `json:"show_count"`
}
// SearchEggRes .
type SearchEggRes struct {
EggID int64 `json:"egg_id"`
ShowCount int `json:"show_count"`
Source []*SearchEggSource `json:"source"`
}
// SearchEggSource .
type SearchEggSource struct {
URL string `json:"url"`
MD5 string `json:"md5"`
Size int64 `json:"size"`
}
// SearchType search types
const (
SearchTypeAll = "all"
SearchTypeVideo = "video"
SearchTypeBangumi = "media_bangumi"
SearchTypePGC = "media_ft"
SearchTypeLive = "live"
SearchTypeLiveRoom = "live_room"
SearchTypeLiveUser = "live_user"
SearchTypeArticle = "article"
SearchTypeSpecial = "special"
SearchTypeTopic = "topic"
SearchTypeUser = "bili_user"
SearchTypePhoto = "photo"
WxSearchTypeAll = "wx_all"
)
// SearchDefaultArg search default params.
var SearchDefaultArg = map[string]map[string]int{
SearchTypeAll: {
"highlight": 1,
"video_num": 20,
"media_bangumi_num": 3,
"media_ft_num": 3,
"is_new_pgc": 1,
"live_room_num": 1,
"card_num": 1,
"activity": 1,
"bili_user_num": 1,
"bili_user_vl": 3,
"user_num": 1,
"user_video_limit": 3,
"is_star": 1,
},
SearchTypeVideo: {
"highlight": 1,
"pagesize": 20,
"is_new_pgc": 1,
},
SearchTypeBangumi: {
"highlight": 1,
"pagesize": 20,
},
SearchTypePGC: {
"highlight": 1,
"pagesize": 20,
},
SearchTypeLive: {
"highlight": 1,
"live_user_num": 6,
"live_room_num": 40,
},
SearchTypeLiveRoom: {
"highlight": 1,
"pagesize": 40,
},
SearchTypeLiveUser: {
"highlight": 1,
"pagesize": 30,
},
SearchTypeArticle: {
"highlight": 1,
"pagesize": 20,
},
SearchTypeSpecial: {
"pagesize": 20,
},
SearchTypeTopic: {
"pagesize": 20,
},
SearchTypeUser: {
"highlight": 1,
"pagesize": 20,
},
SearchTypePhoto: {
"pagesize": 20,
},
WxSearchTypeAll: {
"video_num": 20,
"media_bangumi_num": 3,
"media_ft_num": 3,
"is_new_pgc": 1,
},
}

View File

@@ -0,0 +1,11 @@
package model
// ShopInfo shop info.
type ShopInfo struct {
ShopID int64 `json:"shopId"`
VAppID string `json:"vAppId"`
AppID string `json:"appId"`
Name string `json:"name"`
JumpURL string `json:"jumpUrl"`
ShowItemsTab int `json:"showItemsTab"`
}

View File

@@ -0,0 +1,29 @@
package model
import (
"go-common/app/interface/main/tag/model"
v1 "go-common/app/service/main/archive/api"
)
const (
// TagStateOK means normal state
TagStateOK = 0
// TagStateDeleted means tag was deleted
TagStateDeleted = 1
// TagStateBlocked means tag was blocked
TagStateBlocked = 2
)
// TagAids .
type TagAids struct {
Code int `json:"code"`
Total int64 `json:"total"`
Data []int64 `json:"data"`
}
// TagDetail .
type TagDetail struct {
Total int `json:"total"`
List []*v1.Arc `json:"list"`
*model.TagTop
}

View File

@@ -0,0 +1,112 @@
package model
import (
bcmdl "go-common/app/service/main/broadcast/api/grpc/v1"
)
// Coin add type.
const (
CoinAddArcType = 1
CoinAddArtType = 2
CoinArcBusiness = "archive"
CoinArtBusiness = "article"
)
var (
// RankType rank type params
RankType = map[int]string{
1: "all",
2: "origin",
3: "rookie",
}
// DayType day params
DayType = map[int]int{
1: 1,
3: 3,
7: 7,
30: 30,
}
// ArcType arc params type all:0 and recent:1
ArcType = map[int]int{
0: 0,
1: 1,
}
// IndexDayType rank index day type
IndexDayType = []int{
1,
3,
7,
}
// OriType original or not
OriType = []string{
0: "",
1: "_origin",
}
// AllType all or origin type
AllType = []string{
0: "all",
1: "origin",
}
// TagIDs feedback tag ids
TagIDs = []int64{
300, //播放卡顿
301, //进度条君无法调戏
302, //画音不同步
303, //弹幕无法加载/弹幕延迟
304, //出现浮窗广告
305, //无限小电视
306, //黑屏
307, //其他
354, //校园网无法访问
}
// LimitTypeIDs view limit type id
LimitTypeIDs = []int16{13, 32, 33, 94, 120}
// RecSpecTypeName recommend data special type name
RecSpecTypeName = map[int32]string{
28: "原创",
30: "V家",
31: "翻唱",
59: "演奏",
}
// LikeType thumbup like type
LikeType = map[int8]string{
1: "like",
2: "like_cancel",
3: "dislike",
4: "dislike_cancel",
}
// NewListRid new list need more rids
NewListRid = map[int32]int32{
177: 37,
23: 147,
11: 185,
}
// DefaultServer broadcst servers default value.
DefaultServer = &bcmdl.ServerListReply{
Domain: "broadcast.chat.bilibili.com",
TcpPort: 7821,
WsPort: 7822,
WssPort: 7823,
Heartbeat: 30,
Nodes: []string{"broadcast.chat.bilibili.com"},
Backoff: &bcmdl.Backoff{
MaxDelay: 300,
BaseDelay: 3,
Factor: 1.8,
Jitter: 0.3,
},
HeartbeatMax: 3,
}
)
// CheckFeedTag check if tagID in TagIDs
func CheckFeedTag(tagID int64) bool {
check := false
for _, id := range TagIDs {
if tagID == id {
check = true
break
}
}
return check
}

View File

@@ -0,0 +1,41 @@
package model
import (
v1 "go-common/app/service/main/archive/api"
"go-common/library/time"
)
// WxArchive .
type WxArchive struct {
Aid int64 `json:"aid"`
TypeID int32 `json:"type_id"`
TypeName string `json:"tname"`
Pic string `json:"pic"`
Title string `json:"title"`
PubDate time.Time `json:"pubdate"`
Ctime time.Time `json:"ctime"`
Tags []*WxArcTag `json:"tags"`
Duration int64 `json:"duration"`
Author v1.Author `json:"author"`
Stat v1.Stat `json:"stat"`
}
// WxArcTag .
type WxArcTag struct {
ID int64 `json:"id"`
Name string `json:"name"`
}
// FromArchive .
func (w *WxArchive) FromArchive(a *v1.Arc) {
w.Aid = a.Aid
w.TypeID = a.TypeID
w.TypeName = a.TypeName
w.Pic = a.Pic
w.Title = a.Title
w.PubDate = a.PubDate
w.Ctime = a.Ctime
w.Duration = a.Duration
w.Author = a.Author
w.Stat = a.Stat
}