Create & Init Project...
This commit is contained in:
32
app/admin/main/creative/model/academy/BUILD
Normal file
32
app/admin/main/creative/model/academy/BUILD
Normal 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 = [
|
||||
"archive.go",
|
||||
"occupation.go",
|
||||
"tag.go",
|
||||
],
|
||||
importpath = "go-common/app/admin/main/creative/model/academy",
|
||||
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"],
|
||||
)
|
147
app/admin/main/creative/model/academy/archive.go
Normal file
147
app/admin/main/creative/model/academy/archive.go
Normal file
@ -0,0 +1,147 @@
|
||||
package academy
|
||||
|
||||
const (
|
||||
//StateRemove 移除状态
|
||||
StateRemove = -1
|
||||
//StateNormal 正常状态
|
||||
StateNormal = 0
|
||||
//BusinessForArchvie 稿件
|
||||
BusinessForArchvie = 1
|
||||
//BusinessForArticle 专栏
|
||||
BusinessForArticle = 2
|
||||
//LogClientAcademy 日志服务类型
|
||||
LogClientAcademy = 181
|
||||
//DefaultState check search archive state
|
||||
DefaultState = 2018
|
||||
)
|
||||
|
||||
//TableName get table name
|
||||
func (a *Archive) TableName() string {
|
||||
return "academy_archive"
|
||||
}
|
||||
|
||||
//Archive for academy achive & article.
|
||||
type Archive struct {
|
||||
ID int64 `gorm:"column:id"`
|
||||
OID int64 `gorm:"column:oid"`
|
||||
Title string `gorm:"column:title"`
|
||||
State int8 `gorm:"column:state"`
|
||||
Business int8 `gorm:"column:business"`
|
||||
CTime string `gorm:"column:ctime"`
|
||||
MTime string `gorm:"column:mtime"`
|
||||
Comment string `gorm:"column:comment"`
|
||||
Hot int64 `gorm:"column:hot"`
|
||||
}
|
||||
|
||||
//TableName get table name
|
||||
func (at *ArchiveTag) TableName() string {
|
||||
return "academy_archive_tag"
|
||||
}
|
||||
|
||||
//ArchiveTag for academy achive & tag relation .
|
||||
type ArchiveTag struct {
|
||||
ID int64 `gorm:"column:id"`
|
||||
OID int64 `gorm:"column:oid"`
|
||||
TID int64 `gorm:"column:tid"`
|
||||
State int8 `gorm:"column:state"`
|
||||
Business int8 `gorm:"column:business"`
|
||||
CTime string `gorm:"column:ctime"`
|
||||
MTime string `gorm:"column:mtime"`
|
||||
}
|
||||
|
||||
//ArchiveOrigin for archive list.
|
||||
type ArchiveOrigin struct {
|
||||
OID int64
|
||||
TIDs []int64
|
||||
Comment string
|
||||
Business int8
|
||||
}
|
||||
|
||||
//ArchiveCount get archive count by tid.
|
||||
type ArchiveCount struct {
|
||||
TID int64 `gorm:"column:tid"`
|
||||
Count int `gorm:"column:count"` //当前tag关联的稿件量
|
||||
}
|
||||
|
||||
//ArchiveMeta for archive meta.
|
||||
type ArchiveMeta struct {
|
||||
OID int64 `json:"oid"`
|
||||
State int32 `json:"state"`
|
||||
Forbid int8 `json:"forbid"`
|
||||
Cover string `json:"cover"`
|
||||
Type string `json:"type"`
|
||||
Title string `json:"title"`
|
||||
UName string `json:"uname"`
|
||||
Comment string `json:"comment"`
|
||||
CTime int64 `json:"ctime"`
|
||||
MTime int64 `json:"mtime"`
|
||||
Tags map[int][]*TagMeta `json:"tags"`
|
||||
Hot int64 `json:"hot"`
|
||||
}
|
||||
|
||||
//ArchiveTags for archive tag relation.
|
||||
type ArchiveTags struct {
|
||||
ID int64 `gorm:"column:id"`
|
||||
TID int64 `gorm:"column:tid"`
|
||||
OID int64 `gorm:"column:oid"`
|
||||
Type int8 `gorm:"column:type"`
|
||||
Business int8 `gorm:"column:business"`
|
||||
}
|
||||
|
||||
//Archives for archive list
|
||||
type Archives struct {
|
||||
Pager *Pager `json:"pager"`
|
||||
Items []*ArchiveMeta `json:"items"`
|
||||
}
|
||||
|
||||
// Pager Pager def.
|
||||
type Pager struct {
|
||||
Num int `json:"num"`
|
||||
Size int `json:"size"`
|
||||
Total int `json:"total"`
|
||||
}
|
||||
|
||||
// LogParam for manager.
|
||||
type LogParam struct {
|
||||
UID int64 `json:"uid"`
|
||||
UName string `json:"uname"`
|
||||
Action string `json:"action"`
|
||||
TID int64 `json:"tid"`
|
||||
OIDs string `json:"oids"`
|
||||
OName string `json:"oname"`
|
||||
OState int8 `json:"ostate"`
|
||||
}
|
||||
|
||||
// EsParam for es param.
|
||||
type EsParam struct {
|
||||
OID int64
|
||||
Business int8
|
||||
Keyword string
|
||||
Uname string
|
||||
TID []int64
|
||||
Copyright int
|
||||
State int
|
||||
Pn int
|
||||
Ps int
|
||||
IP string
|
||||
TidsMap map[int][]int64
|
||||
}
|
||||
|
||||
// EsPage for es page.
|
||||
type EsPage struct {
|
||||
Num int `json:"num"`
|
||||
Size int `json:"size"`
|
||||
Total int `json:"total"`
|
||||
}
|
||||
|
||||
// EsArc for search archive.
|
||||
type EsArc struct {
|
||||
OID int64 `json:"oid"`
|
||||
TID []int64 `json:"tid"`
|
||||
}
|
||||
|
||||
// SearchResult archive list from search.
|
||||
type SearchResult struct {
|
||||
Page *EsPage `json:"page"`
|
||||
Result []*EsArc `json:"result"`
|
||||
}
|
118
app/admin/main/creative/model/academy/occupation.go
Normal file
118
app/admin/main/creative/model/academy/occupation.go
Normal file
@ -0,0 +1,118 @@
|
||||
package academy
|
||||
|
||||
//TableName get table name
|
||||
func (o *Occupation) TableName() string {
|
||||
return "academy_occupation"
|
||||
}
|
||||
|
||||
//TableName get table name
|
||||
func (s *Skill) TableName() string {
|
||||
return "academy_skill"
|
||||
}
|
||||
|
||||
//TableName get table name
|
||||
func (s *Software) TableName() string {
|
||||
return "academy_software"
|
||||
}
|
||||
|
||||
//TableName get table name
|
||||
func (s *ArcSkill) TableName() string {
|
||||
return "academy_arc_skill"
|
||||
}
|
||||
|
||||
//TableName get table name
|
||||
func (s *TagLink) TableName() string {
|
||||
return "academy_tag_link"
|
||||
}
|
||||
|
||||
//Occupation for academy occupation.
|
||||
type Occupation struct {
|
||||
ID int64 `gorm:"column:id" form:"id" json:"id"`
|
||||
Rank int64 `gorm:"column:rank" form:"rank" json:"rank"`
|
||||
State int `gorm:"column:state" form:"state" json:"state"`
|
||||
Name string `gorm:"column:name" form:"name" json:"name"`
|
||||
Desc string `gorm:"column:desc" form:"desc" json:"desc"`
|
||||
Logo string `gorm:"column:logo" form:"logo" json:"logo"`
|
||||
MainStep string `gorm:"column:main_step" form:"main_step" json:"main_step"`
|
||||
MainSoftware string `gorm:"column:main_software" form:"main_software" json:"main_software"`
|
||||
CTime string `gorm:"column:ctime" form:"ctime" json:"-"`
|
||||
MTime string `gorm:"column:mtime" form:"mtime" json:"-"`
|
||||
Skill []*Skill `gorm:"-" form:"-" json:"skill"`
|
||||
Count int `gorm:"-" form:"-" json:"count"`
|
||||
}
|
||||
|
||||
//Skill for academy skill.
|
||||
type Skill struct {
|
||||
ID int64 `gorm:"column:id" form:"id" json:"id"`
|
||||
OID int64 `gorm:"column:oid" form:"oid" json:"oid"`
|
||||
State int `gorm:"column:state" form:"state" json:"state"`
|
||||
Name string `gorm:"column:name" form:"name" json:"name"`
|
||||
Desc string `gorm:"column:desc" form:"desc" json:"desc"`
|
||||
CTime string `gorm:"column:ctime" form:"ctime" json:"-"`
|
||||
MTime string `gorm:"column:mtime" form:"mtime" json:"-"`
|
||||
Software []*Software `gorm:"-" form:"-" json:"software"`
|
||||
Count int `gorm:"-" form:"-" json:"count"`
|
||||
}
|
||||
|
||||
//Software for academy software.
|
||||
type Software struct {
|
||||
ID int64 `gorm:"column:id" form:"id" json:"id"`
|
||||
SkID int64 `gorm:"column:skid" form:"skid" json:"skid"`
|
||||
State int `gorm:"column:state" form:"state" json:"state"`
|
||||
Name string `gorm:"column:name" form:"name" json:"name"`
|
||||
Desc string `gorm:"column:desc" form:"desc" json:"desc"`
|
||||
CTime string `gorm:"column:ctime" form:"ctime" json:"-"`
|
||||
MTime string `gorm:"column:mtime" form:"mtime" json:"-"`
|
||||
Count int `gorm:"-" form:"-" json:"count"`
|
||||
}
|
||||
|
||||
//ArcSkill for academy archive relation to occupation & skill & software.
|
||||
type ArcSkill struct {
|
||||
ID int64 `gorm:"column:id" form:"id" json:"id"`
|
||||
AID int64 `gorm:"column:aid" form:"aid" json:"aid"`
|
||||
PID int64 `gorm:"column:pid" form:"pid" json:"pid"`
|
||||
SkID int64 `gorm:"column:skid" form:"skid" json:"skid"`
|
||||
SID int64 `gorm:"column:sid" form:"sid" json:"sid"`
|
||||
Type int `gorm:"column:type" form:"type" json:"type"`
|
||||
State int `gorm:"column:state" form:"state" json:"state"`
|
||||
CTime string `gorm:"column:ctime" form:"ctime" json:"-"`
|
||||
MTime string `gorm:"column:mtime" form:"mtime" json:"-"`
|
||||
Title string `gorm:"-" form:"title" json:"title"`
|
||||
Pic string `gorm:"-" form:"pic" json:"pic"`
|
||||
Pn int `gorm:"-" form:"pn" json:"-"`
|
||||
Ps int `gorm:"-" form:"ps" json:"-"`
|
||||
}
|
||||
|
||||
//ArcSkills for archive skill list
|
||||
type ArcSkills struct {
|
||||
Pager *Pager `json:"pager"`
|
||||
Items []*ArcSkill `json:"items"`
|
||||
}
|
||||
|
||||
//TagLink for academy h5 tag relation to web tags.
|
||||
type TagLink struct {
|
||||
ID int64 `gorm:"column:id" form:"id" json:"id"`
|
||||
TID int64 `gorm:"column:tid" form:"tid" json:"tid"`
|
||||
LinkID int64 `gorm:"column:link_id" form:"link_id" json:"link_id"`
|
||||
CTime string `gorm:"column:ctime" form:"ctime" json:"-"`
|
||||
MTime string `gorm:"column:mtime" form:"mtime" json:"-"`
|
||||
}
|
||||
|
||||
//TableName get table name
|
||||
func (sk *SearchKeywords) TableName() string {
|
||||
return "academy_search_keywords"
|
||||
}
|
||||
|
||||
//SearchKeywords for academy h5 search keywords.
|
||||
type SearchKeywords struct {
|
||||
ID int64 `gorm:"column:id" form:"id" json:"id"`
|
||||
Rank int64 `gorm:"column:rank" form:"rank" json:"rank"`
|
||||
ParentID int64 `gorm:"column:parent_id" form:"parent_id" json:"parent_id"`
|
||||
State int8 `gorm:"column:state" form:"state" json:"state"`
|
||||
Name string `gorm:"column:name" form:"name" json:"name"`
|
||||
Comment string `gorm:"column:comment" form:"comment" json:"comment"`
|
||||
CTime string `gorm:"column:ctime" form:"ctime" json:"-"`
|
||||
MTime string `gorm:"column:mtime" form:"mtime" json:"-"`
|
||||
Count int `gorm:"-" form:"-" json:"count,omitempty"`
|
||||
Children []*SearchKeywords `json:"children,omitempty"`
|
||||
}
|
71
app/admin/main/creative/model/academy/tag.go
Normal file
71
app/admin/main/creative/model/academy/tag.go
Normal file
@ -0,0 +1,71 @@
|
||||
package academy
|
||||
|
||||
const (
|
||||
_ = iota
|
||||
//Course 教程级别
|
||||
Course
|
||||
//Operation 运营标签
|
||||
Operation
|
||||
//Classify 分类标签
|
||||
Classify
|
||||
//ArticleClass 专栏分类
|
||||
ArticleClass
|
||||
//H5 手机端分类标签
|
||||
H5
|
||||
//Recommend 理由标签
|
||||
Recommend
|
||||
)
|
||||
|
||||
const (
|
||||
//StateUnBlock 解冻状态
|
||||
StateUnBlock = 0
|
||||
//StateBlock 冻结状态
|
||||
StateBlock = -1
|
||||
)
|
||||
|
||||
//TableName get table name
|
||||
func (t *Tag) TableName() string {
|
||||
return "academy_tag"
|
||||
}
|
||||
|
||||
//Tag for academy tag.
|
||||
type Tag struct {
|
||||
ID int64 `gorm:"column:id"`
|
||||
ParentID int64 `gorm:"column:parent_id"`
|
||||
Type int8 `gorm:"column:type"`
|
||||
State int8 `gorm:"column:state"`
|
||||
Business int8 `gorm:"column:business"`
|
||||
Name string `gorm:"column:name"`
|
||||
Desc string `gorm:"column:desc"`
|
||||
CTime string `gorm:"column:ctime"`
|
||||
MTime string `gorm:"column:mtime"`
|
||||
Rank int64 `gorm:"column:rank"`
|
||||
Children []*Tag `json:"children,omitempty"`
|
||||
}
|
||||
|
||||
//TagMeta for academy tag reuslt.
|
||||
type TagMeta struct {
|
||||
ID int64 `json:"id"`
|
||||
ParentID int64 `json:"parent_id"`
|
||||
Type int8 `json:"type"`
|
||||
State int8 `json:"state"`
|
||||
Business int8 `json:"business"`
|
||||
Count int `json:"count"`
|
||||
Name string `json:"name"`
|
||||
Desc string `json:"desc"`
|
||||
Children []*TagMeta `json:"children,omitempty"`
|
||||
Rank int64 `gorm:"column:rank"`
|
||||
LinkID []int64 `json:"link_id,omitempty"`
|
||||
}
|
||||
|
||||
//TagClass for tag type name map.
|
||||
func TagClass() map[int]string {
|
||||
return map[int]string{
|
||||
Course: "教程级别",
|
||||
Operation: "运营标签",
|
||||
Classify: "分类标签",
|
||||
ArticleClass: "专栏分类",
|
||||
H5: "手机端分类标签",
|
||||
Recommend: "推荐理由",
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user