作者 tangxvhui

更新ArticleBackup ,ArticleDraft ,Article的数据结构

... ... @@ -26,6 +26,7 @@ type (
WhoRead []int64 `json:"whoRead,optional"` //谁可查看
WhoReview []int64 `json:"whoReview,optional"` //谁可评论
Location Location `json:"location,optional"` //定位坐标
MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本
}
MiniArticleCreateResponse {
Id int64 `json:"id"`
... ... @@ -58,6 +59,7 @@ type (
MeLoveFlag int `json:"meLoveFlag"` // 当前人员对文章的点赞标识 (0 没有点赞 1有点赞)
MeFollowFlag int `json:"meFollowFlag"` // 当前人员对作者的关注标识 (0 没有关注 1有关注)
Tags []string `json:"tags"` // 文章的标签
MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本
}
ArticleSection {
Id int64 `json:"id"` //段落id
... ...
... ... @@ -164,10 +164,14 @@ func (l *MiniCreateArticleLogic) MiniCreateArticle(req *types.MiniArticleCreateR
CountRead: 0,
Show: domain.ArticleShowEnable,
Tags: []int64{},
MatchUrl: map[string]string{},
}
if len(whoRead) > 0 {
newArticle.TargetUser = domain.ArticleTargetLimit
}
for k, v := range req.MatchUrl {
newArticle.MatchUrl[k] = v
}
//设置内容概要
if len(sectionList) > 0 {
// 截取内容 50个字
... ...
... ... @@ -122,10 +122,15 @@ func (l *MiniGetArticleLogic) MiniGetArticle(req *types.MiniArticleGetRequest) (
MeLoveFlag: meLoveFlag,
MeFollowFlag: 0,
Tags: tags,
MatchUrl: map[string]string{},
}
if articleInfo.CreatedAt != articleInfo.UpdatedAt {
resp.Edit = 1
}
for k, v := range articleInfo.MatchUrl {
resp.MatchUrl[k] = v
}
for _, val := range articleInfo.Images {
resp.Images = append(resp.Images, val.Url)
}
... ...
... ... @@ -797,6 +797,7 @@ type MiniArticleCreateRequest struct {
WhoRead []int64 `json:"whoRead,optional"` //谁可查看
WhoReview []int64 `json:"whoReview,optional"` //谁可评论
Location Location `json:"location,optional"` //定位坐标
MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本
}
type MiniArticleCreateResponse struct {
... ... @@ -828,6 +829,7 @@ type MiniArticleGetResponse struct {
MeLoveFlag int `json:"meLoveFlag"` // 当前人员对文章的点赞标识 (0 没有点赞 1有点赞)
MeFollowFlag int `json:"meFollowFlag"` // 当前人员对作者的关注标识 (0 没有关注 1有关注)
Tags []string `json:"tags"` // 文章的标签
MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本
}
type ArticleSection struct {
... ...
... ... @@ -31,6 +31,7 @@ type Article struct {
Tags []int64 `gorm:"type:jsonb;serializer:json"` //定性标签
Show int // 评论的展示状态(0显示、1不显示)
Summary string // 内容概要
MatchUrl map[string]string `gorm:"type:jsonb;serializer:json"` // 匹配文章内容中的url文本
}
func (m *Article) TableName() string {
... ...
... ... @@ -28,6 +28,7 @@ type ArticleBackup struct {
Tags []int64 `gorm:"type:jsonb;serializer:json"` // 标签
Location domain.Location `gorm:"type:jsonb;serializer:json"` // 坐标
TargetUser int // 分发方式 0 分发给所有人 1 分发给指定的人
MatchUrl map[string]string `gorm:"type:jsonb;serializer:json"` // 匹配文章内容中的url文本
}
func (m *ArticleBackup) TableName() string {
... ...
... ... @@ -25,6 +25,7 @@ type ArticleDraft struct {
WhoRead []int64 `gorm:"type:jsonb;serializer:json"` // 谁可以看
WhoReview []int64 `gorm:"type:jsonb;serializer:json"` // 评论人
Location domain.Location `gorm:"type:jsonb;serializer:json"` // 坐标
MatchUrl map[string]string `gorm:"type:jsonb;serializer:json"` // 匹配文章内容中的url文本
}
func (m *ArticleDraft) TableName() string {
... ...
... ... @@ -171,6 +171,7 @@ func (repository *ArticleBackupRepository) ModelToDomainModel(from *models.Artic
WhoRead: from.WhoRead,
WhoReview: from.WhoReview,
Tags: from.Tags,
MatchUrl: from.MatchUrl,
}
// err := copier.Copy(to, from)
return to, nil
... ... @@ -193,9 +194,10 @@ func (repository *ArticleBackupRepository) DomainModelToModel(from *domain.Artic
Action: from.Action,
WhoRead: from.WhoRead,
WhoReview: from.WhoReview,
Location: from.Location,
Tags: from.Tags,
Location: from.Location,
TargetUser: int(from.TargetUser),
MatchUrl: from.MatchUrl,
}
// err := copier.Copy(to, from)
return to, nil
... ...
... ... @@ -156,6 +156,7 @@ func (repository *ArticleDraftRepository) ModelToDomainModel(from *models.Articl
WhoRead: from.WhoRead,
WhoReview: from.WhoReview,
Location: from.Location,
MatchUrl: from.MatchUrl,
}
// err := copier.Copy(to, from)
return to, nil
... ... @@ -177,6 +178,7 @@ func (repository *ArticleDraftRepository) DomainModelToModel(from *domain.Articl
WhoRead: from.WhoRead,
WhoReview: from.WhoReview,
Location: from.Location,
MatchUrl: from.MatchUrl,
}
// err := copier.Copy(to, from)
return to, nil
... ...
... ... @@ -304,6 +304,7 @@ func (repository *ArticleRepository) ModelToDomainModel(from *models.Article) (*
Show: domain.ArticleShow(from.Show),
Tags: from.Tags,
Summary: from.Summary,
MatchUrl: from.MatchUrl,
}
return to, nil
}
... ... @@ -328,9 +329,10 @@ func (repository *ArticleRepository) DomainModelToModel(from *domain.Article) (*
CountLove: from.CountLove,
CountRead: from.CountRead,
CountComment: from.CountComment,
Show: int(from.Show),
Tags: from.Tags,
Show: int(from.Show),
Summary: from.Summary,
MatchUrl: from.MatchUrl,
}
// err := copier.Copy(to, from)
return to, nil
... ...
... ... @@ -28,6 +28,7 @@ type Article struct {
Show ArticleShow `json:"show"` // 评论的展示状态(1显示,2不显示、)
Tags []int64 `json:"tags"` // 定性标签
Summary string `json:"summary"` // 内容概要
MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本
// ...more
}
... ...
... ... @@ -25,6 +25,7 @@ type ArticleBackup struct {
WhoRead []int64 `json:"whoRead"` // 谁可以看
WhoReview []int64 `json:"whoReview"` // 评论人
Tags []int64 `json:"tags"` // 标签
MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本
}
type ArticleBackupRepository interface {
... ...
... ... @@ -23,6 +23,7 @@ type ArticleDraft struct {
WhoRead []int64 `json:"whoRead"` // 谁可以看
WhoReview []int64 `json:"whoReview"` // 评论人
Location Location `json:"location"` // 坐标
MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本
}
type ArticleDraftRepository interface {
Insert(ctx context.Context, conn transaction.Conn, dm *ArticleDraft) (*ArticleDraft, error)
... ...