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,41 @@
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = [
"app_active.go",
"card_set_stars.go",
"channel_tab.go",
"event_topic.go",
"search_web.go",
"search_web_card.go",
"search_web_query.go",
],
importpath = "go-common/app/admin/main/feed/model/show",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = [
"//app/admin/main/feed/model/common: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,11 @@
package show
//AppActive db show app_active table
type AppActive struct {
Name string `json:"name,omitempty"`
}
// TableName .
func (a AppActive) TableName() string {
return "app_active"
}

View File

@@ -0,0 +1,95 @@
package show
import (
"go-common/app/admin/main/feed/model/common"
xtime "go-common/library/time"
)
//PopularStars channel tab
type PopularStars struct {
ID int64 `json:"id"`
Type string `json:"type"`
Value string `json:"value"`
Title string `json:"title"`
LongTitle string `json:"longtitle"`
Content string `json:"content"`
Deleted int `json:"deleted"`
Person string `json:"person"`
Source int `json:"source"`
Status int `json:"status"`
Mtime xtime.Time `json:"mtime"`
}
//PopularStarsPager .
type PopularStarsPager struct {
Item []*PopularStars `json:"item"`
Page common.Page `json:"page"`
}
// TableName .
func (a PopularStars) TableName() string {
return "card_set"
}
/*
---------------------------
struct param
---------------------------
*/
//PopularStarsAP popular stars add param
type PopularStarsAP struct {
Type string `form:"type" validate:"required"`
Value string `form:"value" validate:"required"`
Title string `form:"title" validate:"required"`
LongTitle string `form:"longtitle" validate:"required"`
Content string `form:"content" validate:"required"`
UID int64 `form:"person" gorm:"column:uid"`
Person string `form:"person"`
Source int
Status int
}
//PopularStarsAIAP popular stars ai add param
type PopularStarsAIAP struct {
Mid int64 `form:"mid"`
Aids []int64 `form:"aids"`
}
//AiValue ai insert value
type AiValue struct {
ID int64 `json:"id"`
}
//PopularStarsUP channel tab update param
type PopularStarsUP struct {
ID int64 `form:"id" validate:"required"`
Type string `form:"type" validate:"required"`
Value string `form:"value" validate:"required"`
Title string `form:"title" validate:"required"`
LongTitle string `form:"longtitle"`
Content string `form:"content" validate:"required"`
Status int `form:"status"`
}
//PopularStarsLP channel tab list param
type PopularStarsLP struct {
ID int `form:"id"`
Title string `form:"title"`
LongTitle string `form:"longtitle"`
Person string `form:"person"`
Source int `form:"source" default:"-1"`
Status int `form:"status"`
Ps int `form:"ps" default:"20"` // 分页大小
Pn int `form:"pn" default:"1"` // 第几个分页
}
// TableName .
func (a PopularStarsAP) TableName() string {
return "card_set"
}
// TableName .
func (a PopularStarsUP) TableName() string {
return "card_set"
}

View File

@@ -0,0 +1,84 @@
package show
import "go-common/app/admin/main/feed/model/common"
//ChannelTab channel tab
type ChannelTab struct {
ID int64 `json:"id" form:"id"`
TagID int64 `json:"tag_id" form:"tag_id" validate:"required"`
TabID int64 `json:"tab_id" form:"tab_id" validate:"required"`
Title string `json:"title" form:"title" validate:"required"`
Stime int64 `json:"stime" form:"stime" validate:"required"`
Etime int64 `json:"etime" form:"etime" validate:"required"`
Check int `json:"check" form:"check"`
Priority int `json:"priority" form:"priority" validate:"required"`
UID int64 `json:"uid" form:"uid"`
Person string `json:"person" form:"person"`
IsDelete int `json:"is_delete" form:"is_delete"`
Status int `json:"status" form:"status"`
}
//ChannelTabPager .
type ChannelTabPager struct {
Item []*ChannelTab `json:"item"`
Page common.Page `json:"page"`
}
// TableName .
func (a ChannelTab) TableName() string {
return "channel_tab"
}
/*
---------------------------
struct param
---------------------------
*/
//ChannelTabAP channel tab add param
type ChannelTabAP struct {
TagID int64 `form:"tag_id" validate:"required"`
TabID int64 `form:"tab_id" validate:"required"`
Title string `form:"title" validate:"required"`
Stime int64 `form:"stime" validate:"required"`
Etime int64 `form:"etime" validate:"required"`
Priority int `form:"priority" validate:"required"`
UID int64 `form:"uid" gorm:"column:uid"`
Person string `form:"person"`
}
//ChannelTabUP channel tab update param
type ChannelTabUP struct {
ID int64 `form:"id" validate:"required"`
TagID int64 `form:"tag_id" validate:"required"`
TabID int64 `form:"tab_id" validate:"required"`
Title string `form:"title" validate:"required"`
Stime int64 `form:"stime" validate:"required"`
Etime int64 `form:"etime" validate:"required"`
Priority int `form:"priority" validate:"required"`
UID int64 `form:"uid" gorm:"column:uid"`
Person string `form:"person"`
}
//ChannelTabLP channel tab list param
type ChannelTabLP struct {
TagID int `form:"tag_id"`
TabID int `form:"tab_id"`
Stime int64 `form:"stime"`
Etime int64 `form:"etime"`
Status int `form:"status"`
Person string `form:"person"`
Order int `form:"order" default:"2"`
Ps int `form:"ps" default:"20"` // 分页大小
Pn int `form:"pn" default:"1"` // 第几个分页
}
// TableName .
func (a ChannelTabAP) TableName() string {
return "channel_tab"
}
// TableName .
func (a ChannelTabUP) TableName() string {
return "channel_tab"
}

View File

@@ -0,0 +1,76 @@
package show
import (
"go-common/app/admin/main/feed/model/common"
)
//EventTopic event topic
type EventTopic struct {
ID int64 `json:"id" form:"id"`
Title string `json:"title" form:"title"`
Desc string `json:"desc" form:"desc"`
Cover string `json:"cover" form:"cover"`
Retype int `json:"re_type" gorm:"column:re_type" form:"re_type"`
Revalue string `json:"re_value" gorm:"column:re_value" form:"string"`
Corner string `json:"corner" form:"corner"`
Person string `json:"person" form:"person"`
Deleted int `json:"deleted" form:"deleted"`
}
//EventTopicPager .
type EventTopicPager struct {
Item []*EventTopic `json:"item"`
Page common.Page `json:"page"`
}
// TableName .
func (a EventTopic) TableName() string {
return "event_topic"
}
/*
---------------------------
struct param
---------------------------
*/
//EventTopicAP event topic add param
type EventTopicAP struct {
Title string `json:"title" form:"title" validate:"required"`
Desc string `json:"desc" form:"desc" validate:"required"`
Cover string `json:"cover" form:"cover" validate:"required"`
Retype int `json:"re_type" form:"re_type" gorm:"column:re_type" validate:"required"`
Revalue string `json:"re_value" form:"re_value" gorm:"column:re_value" validate:"required"`
Corner string `json:"corner" form:"corner"`
Person string `json:"person" form:"person"`
}
//EventTopicUP event topic update param
type EventTopicUP struct {
ID int64 `form:"id" validate:"required"`
Title string `json:"title" form:"title" validate:"required"`
Desc string `json:"desc" form:"desc" validate:"required"`
Cover string `json:"cover" form:"cover" validate:"required"`
Retype int `json:"re_type" form:"re_type" gorm:"column:re_type" validate:"required"`
Revalue string `json:"re_value" form:"re_value" gorm:"column:re_value" validate:"required"`
Corner string `json:"corner" form:"corner"`
}
//EventTopicLP event topic list param
type EventTopicLP struct {
ID int `form:"id"`
Person string `form:"person"`
Title string `form:"title"`
Ps int `form:"ps" default:"20"` // 分页大小
Pn int `form:"pn" default:"1"` // 第几个分页
}
// TableName .
func (a EventTopicAP) TableName() string {
return "event_topic"
}
// TableName .
func (a EventTopicUP) TableName() string {
return "event_topic"
}

View File

@@ -0,0 +1,112 @@
package show
import (
"go-common/app/admin/main/feed/model/common"
xtime "go-common/library/time"
)
//SearchWeb search web
type SearchWeb struct {
ID int64 `json:"id" form:"id"`
CardType int `json:"card_type" form:"card_type"`
CardValue string `json:"card_value" form:"card_value"`
Stime xtime.Time `json:"stime" form:"stime"`
Etime xtime.Time `json:"etime" form:"etime"`
Check int `json:"check" form:"check"`
Status int `json:"status" form:"status"`
Priority int `json:"priority" form:"priority"`
Person string `json:"person" form:"person"`
ApplyReason string `json:"apply_reason" form:"apply_reason"`
Deleted int `json:"deleted" form:"deleted"`
Query []*SearchWebQuery `json:"query" form:"query" gorm:"-"`
Card interface{} `json:"card" gorm:"-"`
}
//SearchWebPager .
type SearchWebPager struct {
Item []*SearchWeb `json:"item"`
Page common.Page `json:"page"`
}
// TableName .
func (a SearchWeb) TableName() string {
return "search_web"
}
/*
---------------------------
struct param
---------------------------
*/
//SearchWebAP add param
type SearchWebAP struct {
ID int64 `json:"id" form:"id"`
CardType int `json:"card_type" form:"card_type" validate:"required"`
CardValue string `json:"card_value" form:"card_value" validate:"required"`
Stime xtime.Time `json:"stime" form:"stime" validate:"required"`
Etime xtime.Time `json:"etime" form:"etime" validate:"required"`
Priority int `json:"priority" form:"priority" validate:"required"`
Check int `form:"check" default:"1"`
Person string `json:"person" form:"person"`
ApplyReason string `json:"apply_reason" form:"apply_reason"`
Query string `json:"query" form:"query" gorm:"-" validate:"required"`
}
//SearchWebUP update param
type SearchWebUP struct {
ID int64 `form:"id" validate:"required"`
CardType int `json:"card_type" form:"card_type"`
CardValue string `json:"card_value" form:"card_value"`
Stime xtime.Time `json:"stime" form:"stime"`
Etime xtime.Time `json:"etime" form:"etime"`
Check int `json:"check" form:"check"`
Status int `json:"status" form:"status"`
Priority int `json:"priority" form:"priority"`
Person string `json:"person" form:"person"`
ApplyReason string `json:"apply_reason" form:"apply_reason"`
Query string `json:"query" form:"query" gorm:"-" validate:"required"`
}
//SearchWebLP list param
type SearchWebLP struct {
ID int `form:"id"`
Check int `form:"check"`
Person string `form:"person"`
STime string `form:"stime"`
ETime string `form:"etime"`
Ps int `form:"ps" default:"20"`
Pn int `form:"pn" default:"1"`
}
//SearchWebOption option web card (online,hidden,pass,reject)
type SearchWebOption struct {
ID int64 `form:"id" validate:"required"`
Check int `json:"check" form:"check"`
Status int `json:"status" form:"status"`
}
//SWTimeValid option web card (online,hidden,pass,reject)
type SWTimeValid struct {
ID int64
Query string
Priority int
STime xtime.Time
ETime xtime.Time
CardValue string
}
// TableName .
func (a SearchWebOption) TableName() string {
return "search_web"
}
// TableName .
func (a SearchWebAP) TableName() string {
return "search_web"
}
// TableName .
func (a SearchWebUP) TableName() string {
return "search_web"
}

View File

@@ -0,0 +1,84 @@
package show
import (
"go-common/app/admin/main/feed/model/common"
"go-common/library/time"
)
//SearchWebCard web card
type SearchWebCard struct {
ID int64 `form:"id" gorm:"column:id" json:"id"`
Type int64 `form:"type" gorm:"column:type" json:"type"`
Title string `form:"title" gorm:"column:title" json:"title"`
Desc string `form:"desc" gorm:"column:desc" json:"desc"`
Cover string `form:"cover" gorm:"column:cover" json:"cover"`
ReType int64 `form:"re_type" gorm:"column:re_type" json:"re_type"`
ReValue string `form:"re_value" gorm:"column:re_value" json:"re_value"`
Corner string `form:"corner" gorm:"column:corner" json:"corner"`
Person string `form:"person" gorm:"column:person" json:"person"`
Deleted int64 `form:"deleted" gorm:"column:deleted" json:"deleted"`
Ctime time.Time `form:"string" gorm:"column:ctime" json:"ctime"`
Mtime time.Time `form:"string" gorm:"column:mtime" json:"mtime"`
}
//SearchWebCardPager .
type SearchWebCardPager struct {
Item []*SearchWebCard `json:"item"`
Page common.Page `json:"page"`
}
// TableName .
func (a SearchWebCard) TableName() string {
return "search_web_card"
}
/*
---------------------------
struct param
---------------------------
*/
//SearchWebCardAP web card add param
type SearchWebCardAP struct {
Type int64 `form:"type" gorm:"column:type" json:"type"`
Title string `form:"title" gorm:"column:title" json:"title"`
Desc string `form:"desc" gorm:"column:desc" json:"desc"`
Cover string `form:"cover" gorm:"column:cover" json:"cover"`
ReType int64 `form:"re_type" gorm:"column:re_type" json:"re_type"`
ReValue string `form:"re_value" gorm:"column:re_value" json:"re_value"`
Corner string `form:"corner" gorm:"column:corner" json:"corner"`
Person string `form:"person" gorm:"column:person" json:"person"`
}
//SearchWebCardUP web card update param
type SearchWebCardUP struct {
ID int64 `form:"id" gorm:"column:id" json:"id"`
Type int64 `form:"type" gorm:"column:type" json:"type"`
Title string `form:"title" gorm:"column:title" json:"title"`
Desc string `form:"desc" gorm:"column:desc" json:"desc"`
Cover string `form:"cover" gorm:"column:cover" json:"cover"`
ReType int64 `form:"re_type" gorm:"column:re_type" json:"re_type"`
ReValue string `form:"re_value" gorm:"column:re_value" json:"re_value"`
Corner string `form:"corner" gorm:"column:corner" json:"corner"`
}
//SearchWebCardLP search web card list param
type SearchWebCardLP struct {
ID int `form:"id"`
Person string `form:"person"`
Title string `form:"title"`
Ps int `form:"ps" default:"20"` // 分页大小
Pn int `form:"pn" default:"1"` // 第几个分页
STime string `form:"stime"`
ETime string `form:"etime"`
}
// TableName .
func (a SearchWebCardAP) TableName() string {
return "search_web_card"
}
// TableName .
func (a SearchWebCardUP) TableName() string {
return "search_web_card"
}

View File

@@ -0,0 +1,54 @@
package show
import (
"fmt"
"strings"
"go-common/library/xstr"
)
const (
_queryInsertSQL = "INSERT INTO search_web_query(sid,value) VALUES %s"
_queryEditSQL = "UPDATE search_web_query SET value = CASE %s END WHERE id IN (%s)"
)
//SearchWebQuery search web query
type SearchWebQuery struct {
ID int64 `json:"id" form:"id"`
SID int64 `json:"sid" form:"sid" gorm:"column:sid"`
Value string `json:"value" form:"value"`
Deleted int `json:"deleted" form:"deleted"`
}
// TableName .
func (a SearchWebQuery) TableName() string {
return "search_web_query"
}
// BatchAddQuerySQL .
func BatchAddQuerySQL(sID int64, data []*SearchWebQuery) string {
if len(data) == 0 {
return ""
}
var rowStrings []string
for _, v := range data {
rowStrings = append(rowStrings, fmt.Sprintf("(%d,'%s')", sID, v.Value))
}
return fmt.Sprintf(_queryInsertSQL, strings.Join(rowStrings, ","))
}
// BatchEditQuerySQL .
func BatchEditQuerySQL(querys []*SearchWebQuery) string {
if len(querys) == 0 {
return ""
}
var (
oidsStr string
ids []int64
)
for _, query := range querys {
oidsStr = fmt.Sprintf("%s WHEN id = %d THEN '%s'", oidsStr, query.ID, query.Value)
ids = append(ids, query.ID)
}
return fmt.Sprintf(_queryEditSQL, oidsStr, xstr.JoinInts(ids))
}