作者 tangxvhui

article表中添加 videos 字段

... ... @@ -21,6 +21,7 @@ type Article struct {
Author domain.UserSimple `gorm:"type:jsonb;serializer:json"` // 发布人
Title string // 文章标题
Images []domain.Image `gorm:"type:jsonb;serializer:json"` // 图片
Videos []domain.Video `gorm:"type:jsonb;serializer:json"` // 视频
WhoRead []int64 `gorm:"type:jsonb;serializer:json"` // 谁可以看
WhoReview []int64 `gorm:"type:jsonb;serializer:json"` // 评论人
Location domain.Location `gorm:"type:jsonb;serializer:json"` // 坐标
... ...
... ... @@ -305,6 +305,7 @@ func (repository *ArticleRepository) ModelToDomainModel(from *models.Article) (*
Tags: from.Tags,
Summary: from.Summary,
MatchUrl: from.MatchUrl,
Videos: from.Videos,
}
return to, nil
}
... ... @@ -333,6 +334,7 @@ func (repository *ArticleRepository) DomainModelToModel(from *domain.Article) (*
Show: int(from.Show),
Summary: from.Summary,
MatchUrl: from.MatchUrl,
Videos: from.Videos,
}
// err := copier.Copy(to, from)
return to, nil
... ...
... ... @@ -18,6 +18,7 @@ type Article struct {
Author UserSimple `json:"author"` // 发布人
Title string `json:"title"` // 文章标题
Images []Image `json:"images"` // 图片
Videos []Video `json:"videos"` // 视频
WhoRead []int64 `json:"whoRead"` // 谁可以看
WhoReview []int64 `json:"whoReview"` // 评论人
Location Location `json:"location"` // 坐标
... ...
... ... @@ -7,6 +7,14 @@ type Image struct {
Height int `json:"height"` // 图片高度
}
// 视频信息
type Video struct {
Url string `json:"url"` //视频文件的地址
Cover string `json:"cover"` //封面
Width int `json:"width"` //封面图片宽
Height int `json:"height"` //封面图片长
}
// 坐标位置
type Location struct {
Longitude float64 `json:"longitude"` //经度
... ...