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,84 @@
load(
"@io_bazel_rules_go//proto:def.bzl",
"go_proto_library",
)
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = [
"account.go",
"album.go",
"app.go",
"archive.go",
"article.go",
"audio.go",
"bangumi.go",
"channel.go",
"coin.go",
"dynamic.go",
"elec.go",
"fav.go",
"game.go",
"live.go",
"setting.go",
"shop.go",
"tag.go",
"theme.go",
"web.go",
],
embed = [":model_go_proto"],
importpath = "go-common/app/interface/main/space/model",
tags = ["automanaged"],
deps = [
"//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/favorite/model:go_default_library",
"//library/time:go_default_library",
"@com_github_gogo_protobuf//gogoproto:go_default_library",
"@com_github_golang_protobuf//proto: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"],
)
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
proto_library(
name = "model_proto",
srcs = ["proto.proto"],
tags = ["automanaged"],
deps = ["@gogo_special_proto//github.com/gogo/protobuf/gogoproto"],
)
go_proto_library(
name = "model_go_proto",
compilers = ["@io_bazel_rules_go//proto:gogofast_proto"],
importpath = "go-common/app/interface/main/space/model",
proto = ":model_proto",
tags = ["automanaged"],
deps = ["@com_github_gogo_protobuf//gogoproto:go_default_library"],
)

View File

@@ -0,0 +1,112 @@
package model
import (
accmdl "go-common/app/service/main/account/api"
)
// NavNum nav num struct.
type NavNum struct {
Video int64 `json:"video"`
Bangumi int `json:"bangumi"`
Channel *Num `json:"channel"`
Favourite *Num `json:"favourite"`
Tag int `json:"tag"`
Article int `json:"article"`
Playlist int `json:"playlist"`
Album int64 `json:"album"`
Audio int `json:"audio"`
}
// Num num struct.
type Num struct {
Master int `json:"master"`
Guest int `json:"guest"`
}
// UpStat up stat struct.
type UpStat struct {
Archive struct {
View int64 `json:"view"`
} `json:"archive"`
Article struct {
View int64 `json:"view"`
} `json:"article"`
}
// AccInfo account info.
type AccInfo struct {
Mid int64 `json:"mid"`
Name string `json:"name"`
Sex string `json:"sex"`
Face string `json:"face"`
Sign string `json:"sign"`
Rank int32 `json:"rank"`
Level int32 `json:"level"`
JoinTime int32 `json:"jointime"`
Moral int32 `json:"moral"`
Silence int32 `json:"silence"`
Birthday string `json:"birthday"`
Coins float64 `json:"coins"`
FansBadge bool `json:"fans_badge"`
Official accmdl.OfficialInfo `json:"official"`
Vip struct {
Type int32 `json:"type"`
Status int32 `json:"status"`
} `json:"vip"`
IsFollowed bool `json:"is_followed"`
TopPhoto string `json:"top_photo"`
Theme interface{} `json:"theme"`
}
// AccBlock acc block
type AccBlock struct {
Status int `json:"status"`
IsDue int `json:"is_due"`
IsAnswered int `json:"is_answered"`
}
// TopPhoto top photo struct.
type TopPhoto struct {
SImg string `json:"s_img"`
LImg string `json:"l_img"`
}
// Relation .
type Relation struct {
Relation interface{} `json:"relation"`
BeRelation interface{} `json:"be_relation"`
}
// FromCard from account card.
func (ai *AccInfo) FromCard(c *accmdl.ProfileStatReply) {
ai.Mid = c.Profile.Mid
ai.Name = c.Profile.Name
ai.Rank = c.Profile.Rank
ai.Face = c.Profile.Face
ai.Sex = c.Profile.Sex
ai.JoinTime = c.Profile.JoinTime
ai.Silence = c.Profile.Silence
ai.Birthday = c.Profile.Birthday.Time().Format("01-02")
ai.Sign = c.Profile.Sign
ai.Level = c.Profile.Level
ai.Official = c.Profile.Official
ai.Vip.Type = c.Profile.Vip.Type
ai.Vip.Status = c.Profile.Vip.Status
ai.Coins = c.Coins
}
var (
// DefaultProfileStat .
DefaultProfileStat = &accmdl.ProfileStatReply{
Profile: DefaultProfile,
LevelInfo: accmdl.LevelInfo{},
}
// DefaultProfile .
DefaultProfile = &accmdl.Profile{
Name: "bilibili",
Sex: "保密",
Face: "https://static.hdslb.com/images/member/noface.gif",
Sign: "哔哩哔哩 (゜-゜)つロ 干杯~-bilibili",
Rank: 5000,
}
)

View File

@@ -0,0 +1,32 @@
package model
import "go-common/library/time"
// AlbumCount album count struct.
type AlbumCount struct {
AllCount int64 `json:"all_count"`
DrawCount int64 `json:"draw_count"`
PhotoCount int64 `json:"photo_count"`
DailyCount int64 `json:"daily_count"`
}
// Album album struct.
type Album struct {
DocID int64 `json:"doc_id"`
PosterUID int64 `json:"poster_uid"`
Title string `json:"title"`
Description string `json:"description"`
Pictures []*PicItem `json:"pictures"`
Count int64 `json:"count"`
Ctime time.Time `json:"ctime"`
View int64 `json:"view"`
Like int64 `json:"like"`
}
// PicItem picture item struct.
type PicItem struct {
ImgSrc string `json:"img_src"`
ImgWidth int `json:"img_width"`
ImgHeight int `json:"img_height"`
ImgSize int `json:"img_size"`
}

View File

@@ -0,0 +1,100 @@
package model
import (
accwar "go-common/app/service/main/account/api"
"go-common/app/service/main/account/model"
)
// AppAccInfo app acc info struct.
type AppAccInfo struct {
Mid int64 `json:"mid"`
Name string `json:"name"`
Sex string `json:"sex"`
Face string `json:"face"`
Sign string `json:"sign"`
Rank int32 `json:"rank"`
Level int32 `json:"level"`
LevelInfo accwar.LevelInfo `json:"level_info"`
Pendant model.PendantInfo `json:"pendant"`
Silence int32 `json:"silence"`
Vip struct {
Type int32 `json:"vipType"`
VipStatus int32 `json:"vipStatus"`
} `json:"vip"`
OfficialInfo struct {
Type int `json:"type"`
Desc string `json:"desc"`
} `json:"official_info"`
Following int64 `json:"following"`
Follower int64 `json:"follower"`
Relation interface{} `json:"relation"`
BeRelation interface{} `json:"be_relation"`
FansGroup int `json:"fans_group"`
Audio int `json:"audio"`
Shop interface{} `json:"shop"`
Elec interface{} `json:"elec"`
Live interface{} `json:"live"`
FansBadge bool `json:"fans_badge"`
TopPhoto string `json:"top_photo"`
Block *AccBlock `json:"block,omitempty"`
}
// FromProfile from account profile.
func (ai *AppAccInfo) FromProfile(p *accwar.ProfileStatReply) {
ai.Mid = p.Profile.Mid
ai.Name = p.Profile.Name
ai.Sex = p.Profile.Sex
ai.Face = p.Profile.Face
ai.Sign = p.Profile.Sign
ai.Rank = p.Profile.Rank
ai.Face = p.Profile.Face
ai.Level = p.Profile.Level
ai.Silence = p.Profile.Silence
ai.Vip.Type = p.Profile.Vip.Type
ai.Vip.VipStatus = p.Profile.Vip.Status
ai.Pendant = p.Profile.Pendant
if p.Profile.Official.Role == 0 {
ai.OfficialInfo.Type = -1
} else {
if p.Profile.Official.Role <= 2 {
ai.OfficialInfo.Type = 0
ai.OfficialInfo.Desc = p.Profile.Official.Title
} else {
ai.OfficialInfo.Type = 1
ai.OfficialInfo.Desc = p.Profile.Official.Title
}
}
ai.Following = p.Following
ai.Follower = p.Follower
}
// AppTab tab if show.
type AppTab struct {
Dynamic bool `json:"dynamic"`
Shop bool `json:"shop"`
Archive bool `json:"video"`
Article bool `json:"article"`
Audio bool `json:"audio"`
Album bool `json:"album"`
Favorite bool `json:"favorite"`
Bangumi bool `json:"bangumi"`
Game bool `json:"game"`
}
// AppIndex app index data.
type AppIndex struct {
Info *AppAccInfo `json:"info"`
Tab *AppTab `json:"tab"`
Dynamic *DyTotal `json:"dynamic"`
Archive *UpArc `json:"archive"`
}
// AppIndexArg .
type AppIndexArg struct {
Mid int64
Vmid int64 `form:"mid" validate:"min=1"`
Qn int `form:"qn" default:"16" validate:"min=1"`
Platform string `form:"platform" default:"android"`
Ps int32 `form:"ps" default:"16" validate:"min=1"`
Device string `form:"device"`
}

View File

@@ -0,0 +1,107 @@
package model
import (
v1 "go-common/app/service/main/archive/api"
"go-common/library/time"
)
// UpArcStat up archives stat struct.
type UpArcStat struct {
View int64 `json:"view"`
Reply int64 `json:"reply"`
Dm int64 `json:"dm"`
Fans int64 `json:"fans"`
}
// ArchiveReason archive with reason struct.
type ArchiveReason struct {
*v1.Arc
Reason string `json:"reason"`
}
// SearchRes search res data.
type SearchRes struct {
TList map[string]*SearchTList `json:"tlist"`
VList []*SearchVList `json:"vlist"`
}
// SearchTList search cate list.
type SearchTList struct {
Tid int64 `json:"tid"`
Count int64 `json:"count"`
Name string `json:"name"`
}
// SearchVList video list.
type SearchVList struct {
Comment int64 `json:"comment"`
TypeID int64 `json:"typeid"`
Play interface{} `json:"play"`
Pic string `json:"pic"`
SubTitle string `json:"subtitle"`
Description string `json:"description"`
Copyright string `json:"copyright"`
Title string `json:"title"`
Review int64 `json:"review"`
Author string `json:"author"`
Mid int64 `json:"mid"`
Created string `json:"created"`
Length string `json:"length"`
VideoReview int64 `json:"video_review"`
Aid int64 `json:"aid"`
HideClick bool `json:"hide_click"`
IsPay int `json:"is_pay"`
IsUnionVideo int `json:"is_union_video"`
}
// UpArc up archive struct
type UpArc struct {
Count int64 `json:"count"`
List []*ArcItem `json:"list"`
}
// ArcItem space archive item.
type ArcItem struct {
Aid int64 `json:"aid"`
Pic string `json:"pic"`
Title string `json:"title"`
Duration int64 `json:"duration"`
Author struct {
Mid int64 `json:"mid"`
Name string `json:"name"`
Face string `json:"face"`
} `json:"author"`
Stat struct {
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"`
} `json:"stat"`
Rights v1.Rights `json:"rights"`
Pubdate time.Time `json:"pubdate"`
}
// FromArc from archive to space act item.
func (ac *ArcItem) FromArc(arc *v1.Arc) {
ac.Aid = arc.Aid
ac.Pic = arc.Pic
ac.Title = arc.Title
ac.Duration = arc.Duration
ac.Author.Mid = arc.Author.Mid
ac.Author.Name = arc.Author.Name
ac.Author.Face = arc.Author.Face
ac.Stat.View = arc.Stat.View
if arc.Access >= 10000 {
ac.Stat.View = "--"
}
ac.Stat.Danmaku = arc.Stat.Danmaku
ac.Stat.Reply = arc.Stat.Reply
ac.Stat.Fav = arc.Stat.Fav
ac.Stat.Share = arc.Stat.Share
ac.Stat.Like = arc.Stat.Like
ac.Pubdate = arc.PubDate
ac.Rights = arc.Rights
}

View File

@@ -0,0 +1,20 @@
package model
// UpArtStat struct.
type UpArtStat struct {
View int64 `json:"view"`
Reply int64 `json:"reply"`
Like int64 `json:"like"`
Coin int64 `json:"coin"`
Fav int64 `json:"fav"`
PreView int64 `json:"-"`
PreReply int64 `json:"-"`
PreLike int64 `json:"-"`
PreCoin int64 `json:"-"`
PreFav int64 `json:"-"`
IncrView int64 `json:"incr_view"`
IncrReply int64 `json:"incr_reply"`
IncrLike int64 `json:"incr_like"`
IncrCoin int64 `json:"incr_coin"`
IncrFav int64 `json:"incr_fav"`
}

View File

@@ -0,0 +1,29 @@
package model
// AudioCard .
type AudioCard struct {
Type int `json:"type"`
Status int `json:"status"`
}
// AudioUpperCert .
type AudioUpperCert struct {
Cert *struct {
Type int `json:"type"`
Desc string `json:"desc"`
} `json:"cert"`
}
// Audio .
type Audio struct {
MenuID int64 `json:"menu_id"`
Title string `json:"title"`
CoverURL string `json:"cover_url"`
PlayNum int `json:"play_num"`
RecordNum int `json:"record_num"`
Ctgs []*struct {
ItemID int64 `json:"item_id"`
ItemVal string `json:"item_val"`
} `json:"ctgs"`
Type int `json:"type"`
}

View File

@@ -0,0 +1,16 @@
package model
// Bangumi bangumi struct.
type Bangumi struct {
SeasonID string `json:"season_id"`
ShareURL string `json:"share_url"`
Title string `json:"title"`
IsFinish string `json:"is_finish"`
Favorites string `json:"favorites"`
NewestEpIndex string `json:"newest_ep_index"`
LastEpIndex string `json:"last_ep_index"`
TotalCount string `json:"total_count"`
Cover string `json:"cover"`
Evaluate string `json:"evaluate"`
Brief string `json:"brief"`
}

View File

@@ -0,0 +1,47 @@
package model
import (
v1 "go-common/app/service/main/archive/api"
xtime "go-common/library/time"
)
// Channel channel struct
type Channel struct {
Cid int64 `json:"cid"`
Mid int64 `json:"mid"`
Name string `json:"name"`
Intro string `json:"intro"`
Mtime xtime.Time `json:"mtime"`
Count int `json:"count"`
Cover string `json:"cover"`
}
// ChannelExtra channel extra fields
type ChannelExtra struct {
Aid int64
Cid int64
Count int
Cover string
}
// ChannelDetail channel detail info
type ChannelDetail struct {
*Channel
Archives []*v1.Arc `json:"archives"`
}
// ChannelArc channel video struct
type ChannelArc struct {
ID int64 `json:"id"`
Mid int64 `json:"mid"`
Cid int64 `json:"cid"`
Aid int64 `json:"aid"`
OrderNum int `json:"order_num"`
Mtime xtime.Time `json:"mtime"`
}
// ChannelArcSort channel archive sort struct
type ChannelArcSort struct {
Aid int64 `json:"aid"`
OrderNum int `json:"order_num"`
}

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,200 @@
package model
import (
"encoding/json"
"strconv"
v1 "go-common/app/service/main/archive/api"
)
// DyCard dynamic data.
type DyCard struct {
Card json.RawMessage `json:"card"`
Desc struct {
UID int64 `json:"uid"`
Type int `json:"type"`
ACL int `json:"acl"`
Rid int64 `json:"rid"`
View int32 `json:"view"`
Repost int32 `json:"repost"`
Comment int32 `json:"comment"`
Like int32 `json:"like"`
IsLiked int32 `json:"is_liked"`
DynamicID int64 `json:"dynamic_id"`
CommentID int64 `json:"comment_id"`
Timestamp int64 `json:"timestamp"`
PreDyID int64 `json:"pre_dy_id"`
OrigDyID int64 `json:"orig_dy_id"`
OrigType int `json:"orig_type"`
RType int `json:"r_type"`
InnerID int64 `json:"inner_id"`
UserProfile *UserProfile `json:"user_profile,omitempty"`
} `json:"desc"`
Extension *DyExtension `json:"extension,omitempty"`
}
// DyResult dynamic result
type DyResult struct {
Card json.RawMessage `json:"card"`
Desc struct {
UID int64 `json:"uid"`
Type int `json:"type"`
ACL int `json:"acl"`
Rid int64 `json:"rid"`
View int32 `json:"view"`
Repost int32 `json:"repost"`
Comment int32 `json:"comment"`
Like int32 `json:"like"`
IsLiked int32 `json:"is_liked"`
DynamicID string `json:"dynamic_id"`
CommentID int64 `json:"comment_id"`
Timestamp int64 `json:"timestamp"`
PreDyID string `json:"pre_dy_id"`
OrigDyID string `json:"orig_dy_id"`
OrigType int `json:"orig_type"`
RType int `json:"r_type"`
InnerID int64 `json:"inner_id"`
UserProfile *UserProfile `json:"user_profile,omitempty"`
} `json:"desc"`
Extension *DyExtension `json:"extension,omitempty"`
}
// DyExtension .
type DyExtension struct {
VoteCfg *struct {
VoteID int64 `json:"vote_id"`
Desc string `json:"desc"`
JoinNum int64 `json:"join_num"`
} `json:"vote_cfg,omitempty"`
}
// DyTotal out dynamic total.
type DyTotal struct {
HasMore bool `json:"has_more"`
List []*DyItem `json:"list"`
}
// DyItem out dynamic item.
type DyItem struct {
Type int `json:"type"`
Top bool `json:"top"`
Card *DyResult `json:"card,omitempty"`
Archive *VideoItem `json:"video,omitempty"`
Fold []*DyItem `json:"fold,omitempty"`
Ctime int64 `json:"ctime"`
Privacy bool `json:"privacy"`
}
// UserProfile dynamic item user profile.
type UserProfile struct {
Pendant struct {
Pid int64 `json:"pid"`
Name string `json:"name"`
Image string `json:"image"`
Expire int64 `json:"expire"`
} `json:"pendant,omitempty"`
DecorateCard struct {
Mid int64 `json:"mid"`
ID int64 `json:"id"`
CardURL string `json:"card_url"`
CardType int `json:"card_type"`
Name string `json:"name"`
ExpireTime int64 `json:"expire_time"`
CardTypeName string `json:"card_type_name"`
UID int64 `json:"uid"`
} `json:"decorate_card,omitempty"`
}
// FromCard format dynamic card.
func (d *DyResult) FromCard(c *DyCard) {
d.Card = c.Card
d.Desc.UID = c.Desc.UID
d.Desc.Type = c.Desc.Type
d.Desc.ACL = c.Desc.ACL
d.Desc.Rid = c.Desc.Rid
d.Desc.View = c.Desc.View
d.Desc.Repost = c.Desc.Repost
d.Desc.Comment = c.Desc.Comment
d.Desc.Like = c.Desc.Like
d.Desc.IsLiked = c.Desc.IsLiked
d.Desc.DynamicID = strconv.FormatInt(c.Desc.DynamicID, 10)
d.Desc.CommentID = c.Desc.CommentID
d.Desc.Timestamp = c.Desc.Timestamp
d.Desc.PreDyID = strconv.FormatInt(c.Desc.PreDyID, 10)
d.Desc.OrigDyID = strconv.FormatInt(c.Desc.OrigDyID, 10)
d.Desc.OrigType = c.Desc.OrigType
d.Desc.RType = c.Desc.RType
d.Desc.InnerID = c.Desc.InnerID
if c.Extension != nil && c.Extension.VoteCfg != nil {
d.Extension = c.Extension
}
if c.Desc.UserProfile != nil {
d.Desc.UserProfile = c.Desc.UserProfile
}
}
// DyList dynamic list.
type DyList struct {
HasMore int `json:"has_more"`
Cards []*DyCard `json:"cards"`
}
// DyActItem dynamic other action items.
type DyActItem struct {
Aid int64 `json:"aid"`
Type int `json:"type"`
ActionTime int64 `json:"action_time"`
Privacy bool `json:"privacy"`
}
// VideoItem user action video item.
type VideoItem struct {
Aid int64 `json:"aid"`
Pic string `json:"pic"`
Title string `json:"title"`
Duration int64 `json:"duration"`
Author struct {
Mid int64 `json:"mid"`
Name string `json:"name"`
Face string `json:"face"`
}
Stat struct {
View int32 `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"`
}
Rights v1.Rights `json:"rights"`
ActionTime int64 `json:"action_time"`
}
// DyListArg .
type DyListArg struct {
Mid int64 `form:"-"`
Vmid int64 `form:"mid" validate:"min=1"`
DyID int64 `form:"dy_id"`
Qn int `form:"qn" default:"16" validate:"min=1"`
Pn int `form:"pn" default:"1" validate:"min=1"`
LastTime int64 `form:"last_time"`
}
// FromArchive from archive to video item.
func (v *VideoItem) FromArchive(arc *v1.Arc) {
v.Aid = arc.Aid
v.Pic = arc.Pic
v.Title = arc.Title
v.Duration = arc.Duration
v.Author.Mid = arc.Author.Mid
v.Author.Name = arc.Author.Name
v.Author.Face = arc.Author.Face
v.Stat.View = arc.Stat.View
v.Stat.Danmaku = arc.Stat.Danmaku
v.Stat.Reply = arc.Stat.Reply
v.Stat.Fav = arc.Stat.Fav
v.Stat.Share = arc.Stat.Share
v.Stat.Like = arc.Stat.Like
v.Rights = arc.Rights
}

View File

@@ -0,0 +1,15 @@
package model
import "encoding/json"
// ElecInfo elec info.
type ElecInfo struct {
Start int64 `json:"start"`
Show bool `json:"show"`
Total int `json:"total"`
Count int `json:"count"`
State int `json:"state"`
List json.RawMessage `json:"list,omitempty"`
User json.RawMessage `json:"user,omitempty"`
ElecSet json.RawMessage `json:"elec_set,omitempty"`
}

View File

@@ -0,0 +1,24 @@
package model
import "go-common/app/service/main/favorite/model"
// FavNav fav nav struct.
type FavNav struct {
Archive []*model.VideoFolder `json:"archive"`
Playlist int `json:"playlist"`
Topic int `json:"topic"`
Article int `json:"article"`
Album int `json:"album"`
Movie int `json:"movie"`
}
// FavArcArg .
type FavArcArg struct {
Vmid int64 `form:"vmid" validate:"min=1"`
Fid int64 `form:"fid" validate:"min=-1"`
Tid int64 `form:"tid"`
Keyword string `form:"keyword"`
Order string `form:"order"`
Pn int `form:"pn" default:"1" validate:"min=1"`
Ps int `form:"ps" default:"30" validate:"min=1"`
}

View File

@@ -0,0 +1,17 @@
package model
// Game game struct.
type Game struct {
Website string `json:"website"`
Image string `json:"image"`
Name string `json:"name"`
}
// AppGame app game struct.
type AppGame struct {
GameBaseID int64 `json:"game_base_id"`
GameName string `json:"game_name"`
GameIcon string `json:"game_icon"`
Grade float64 `json:"grade"`
DetailURL string `json:"detail_url"`
}

View File

@@ -0,0 +1,14 @@
package model
// Live .
type Live struct {
RoomStatus int `json:"roomStatus"`
LiveStatus int `json:"liveStatus"`
URL string `json:"url"`
Title string `json:"title"`
Cover string `json:"cover"`
Online int `json:"online"`
RoomID int64 `json:"roomid"`
RoundStatus int `json:"roundStatus"`
BroadcastType int `json:"broadcast_type"`
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,37 @@
syntax = "proto3";
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
option go_package = "model";
option (gogoproto.goproto_enum_prefix_all) = false;
option (gogoproto.goproto_getters_all) = false;
option (gogoproto.unmarshaler_all) = true;
option (gogoproto.marshaler_all) = true;
option (gogoproto.sizer_all) = true;
message AidReason {
int64 Aid = 1 [(gogoproto.jsontag) ="aid"];
string Reason = 2 [(gogoproto.jsontag) ="reason"];
}
message AidReasons {
repeated AidReason List = 1;
}
message ThemeDetail {
int64 ID = 1 [(gogoproto.jsontag) ="id"];
string Name = 2 [(gogoproto.jsontag) ="name"];
string Icon = 3 [(gogoproto.jsontag) ="icon"];
string TopPhoto = 4 [(gogoproto.jsontag) ="top_photo"];
string BgImg = 5 [(gogoproto.jsontag) ="bg_img"];
int64 IsActivated = 6 [(gogoproto.jsontag) ="is_activated"];
}
message ThemeDetails {
repeated ThemeDetail List = 1;
}
message Notice {
string Notice = 1 [(gogoproto.jsontag) ="notice"];
int64 IsForbid = 2 [(gogoproto.jsontag) ="is_forbid"];
}

View File

@@ -0,0 +1,68 @@
package model
// DefaultPrivacy default privacy.
var (
PcyBangumi = "bangumi"
PcyTag = "tags"
PcyFavVideo = "fav_video"
PcyCoinVideo = "coins_video"
PcyGroup = "groups"
PcyGame = "played_game"
PcyChannel = "channel"
PcyUserInfo = "user_info"
PcyLikeVideo = "likes_video"
DefaultPrivacy = map[string]int{
PcyBangumi: 1,
PcyTag: 1,
PcyFavVideo: 1,
PcyCoinVideo: 1,
PcyGroup: 1,
PcyGame: 1,
PcyChannel: 1,
PcyUserInfo: 1,
PcyLikeVideo: 1,
}
DefaultIndexOrder = []*IndexOrder{
{ID: 1, Name: "我的稿件"},
{ID: 8, Name: "我的专栏"},
{ID: 7, Name: "我的频道"},
{ID: 2, Name: "我的收藏夹"},
{ID: 3, Name: "订阅番剧"},
{ID: 4, Name: "订阅标签"},
{ID: 5, Name: "最近投币的视频"},
{ID: 6, Name: "我的圈子"},
{ID: 9, Name: "我的相簿"},
{ID: 21, Name: "公告"},
{ID: 22, Name: "直播间"},
{ID: 23, Name: "个人资料"},
{ID: 24, Name: "官方活动"},
{ID: 25, Name: "最近玩过的游戏"},
}
IndexOrderMap = indexOrderMap()
)
// Setting setting struct.
type Setting struct {
Privacy map[string]int `json:"privacy"`
IndexOrder []*IndexOrder `json:"index_order"`
}
// Privacy privacy struct.
type Privacy struct {
Privacy string `json:"privacy"`
Status int `json:"status"`
}
// IndexOrder index order struct.
type IndexOrder struct {
ID int `json:"id"`
Name string `json:"name"`
}
func indexOrderMap() map[int]string {
data := make(map[int]string, len(DefaultIndexOrder))
for _, v := range DefaultIndexOrder {
data[v.ID] = v.Name
}
return data
}

View File

@@ -0,0 +1,24 @@
package model
// ShopInfo shop info.
type ShopInfo struct {
ID int64 `json:"id"`
Mid int64 `json:"mid"`
Name string `json:"name"`
Logo string `json:"logo"`
URL string `json:"url"`
Status int `json:"status"`
GoodsNum int64 `json:"goods_num"`
MonthSales int64 `json:"month_sales"`
StatusV string `json:"status_v"`
}
// ShopLinkInfo shop link info.
type ShopLinkInfo 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,8 @@
package model
// Tag tag struct.
type Tag struct {
ID int64 `json:"tag_id"`
Name string `json:"tag_name"`
Cover string `json:"cover"`
}

View File

@@ -0,0 +1,7 @@
package model
// ThemeInfo theme info.
type ThemeInfo struct {
SID int64 `json:"sid"`
IsActivated int64 `json:"is_activated"`
}

View File

@@ -0,0 +1,67 @@
package model
import artmdl "go-common/app/interface/openplatform/article/model"
var (
// ArticleSortType article list sort types.
ArticleSortType = map[string]int{
"publish_time": artmdl.FieldDefault,
"view": artmdl.FieldView,
"fav": artmdl.FieldFav,
}
// PrivacyFields privacy allowed field.
PrivacyFields = []string{
"bangumi",
"tags",
"fav_video",
"coins_video",
"groups",
"played_game",
"channel",
"user_info",
"likes_video",
}
//ArcCheckType search arc check type.
ArcCheckType = map[string]int{
"channel": 1,
}
)
// Page page return data struct.
type Page struct {
Pn int `json:"pn"`
Ps int `json:"ps"`
Total int `json:"total"`
}
// SearchArg arc search param.
type SearchArg struct {
Mid int64 `form:"mid" validate:"gt=0"`
Tid int64 `form:"tid"`
Order string `form:"order"`
Keyword string `form:"keyword"`
Pn int `form:"pn" validate:"gt=0"`
Ps int `form:"ps" validate:"gt=0,lte=100"`
CheckType string `form:"check_type"`
CheckID int64 `form:"check_id"`
}
// WebIndex .
type WebIndex struct {
Account *AccInfo `json:"account"`
Setting *Setting `json:"setting"`
Archive *WebArc `json:"archive"`
}
// WebArc .
type WebArc struct {
Page WebPage `json:"page"`
Archives []*ArcItem `json:"archives"`
}
// WebPage .
type WebPage struct {
Pn int32 `json:"pn"`
Ps int32 `json:"ps"`
Count int64 `json:"count"`
}