56 lines
2.7 KiB
Go
56 lines
2.7 KiB
Go
package model
|
||
|
||
import (
|
||
"github.com/gogf/gf/v2/os/gtime"
|
||
)
|
||
|
||
// News 新闻模型
|
||
type News struct {
|
||
Id int `json:"id" dc:"主键"`
|
||
Title string `json:"title" dc:"标题"`
|
||
Slug string `json:"slug" dc:"URL别名"`
|
||
Summary string `json:"summary" dc:"摘要"`
|
||
Content string `json:"content" dc:"内容"`
|
||
CoverImage string `json:"cover_image" dc:"封面图片"`
|
||
Category string `json:"category" dc:"分类"`
|
||
Source string `json:"source" dc:"来源"`
|
||
Author string `json:"author" dc:"作者"`
|
||
ViewCount int `json:"view_count" dc:"浏览次数"`
|
||
IsPublished int `json:"is_published" dc:"是否发布 0:草稿 1:已发布"`
|
||
IsFeatured int `json:"is_featured" dc:"是否推荐 0:否 1:是"`
|
||
IsTop int `json:"is_top" dc:"是否置顶 0:否 1:是"`
|
||
PublishedAt *gtime.Time `json:"published_at" dc:"发布时间"`
|
||
CreatedAt *gtime.Time `json:"created_at" dc:"创建时间"`
|
||
UpdatedAt *gtime.Time `json:"updated_at" dc:"更新时间"`
|
||
DeletedAt int `json:"deleted_at" dc:"删除时间"`
|
||
}
|
||
|
||
// CreateNewsRequest 创建新闻请求
|
||
type CreateNewsRequest struct {
|
||
Title string `json:"title" v:"required|length:1,255#标题不能为空|标题长度不能超过255字符" dc:"标题"`
|
||
Slug string `json:"slug" v:"length:0,255#URL别名长度不能超过255字符" dc:"URL别名"`
|
||
Summary string `json:"summary" dc:"摘要"`
|
||
Content string `json:"content" v:"required#内容不能为空" dc:"内容"`
|
||
CoverImage string `json:"cover_image" dc:"封面图片"`
|
||
Category string `json:"category" dc:"分类"`
|
||
Source string `json:"source" dc:"来源"`
|
||
Author string `json:"author" dc:"作者"`
|
||
IsPublished int `json:"is_published" dc:"是否发布"`
|
||
IsFeatured int `json:"is_featured" dc:"是否推荐"`
|
||
IsTop int `json:"is_top" dc:"是否置顶"`
|
||
}
|
||
|
||
// UpdateNewsRequest 更新新闻请求
|
||
type UpdateNewsRequest struct {
|
||
Title string `json:"title" v:"required|length:1,255#标题不能为空|标题长度不能超过255字符" dc:"标题"`
|
||
Slug string `json:"slug" v:"length:0,255#URL别名长度不能超过255字符" dc:"URL别名"`
|
||
Summary string `json:"summary" dc:"摘要"`
|
||
Content string `json:"content" v:"required#内容不能为空" dc:"内容"`
|
||
CoverImage string `json:"cover_image" dc:"封面图片"`
|
||
Category string `json:"category" dc:"分类"`
|
||
Source string `json:"source" dc:"来源"`
|
||
Author string `json:"author" dc:"作者"`
|
||
IsPublished int `json:"is_published" dc:"是否发布"`
|
||
IsFeatured int `json:"is_featured" dc:"是否推荐"`
|
||
IsTop int `json:"is_top" dc:"是否置顶"`
|
||
} |