更新ArticleBackup ,ArticleDraft ,Article的数据结构
正在显示
13 个修改的文件
包含
27 行增加
和
2 行删除
| @@ -26,6 +26,7 @@ type ( | @@ -26,6 +26,7 @@ type ( | ||
| 26 | WhoRead []int64 `json:"whoRead,optional"` //谁可查看 | 26 | WhoRead []int64 `json:"whoRead,optional"` //谁可查看 |
| 27 | WhoReview []int64 `json:"whoReview,optional"` //谁可评论 | 27 | WhoReview []int64 `json:"whoReview,optional"` //谁可评论 |
| 28 | Location Location `json:"location,optional"` //定位坐标 | 28 | Location Location `json:"location,optional"` //定位坐标 |
| 29 | + MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 | ||
| 29 | } | 30 | } |
| 30 | MiniArticleCreateResponse { | 31 | MiniArticleCreateResponse { |
| 31 | Id int64 `json:"id"` | 32 | Id int64 `json:"id"` |
| @@ -58,6 +59,7 @@ type ( | @@ -58,6 +59,7 @@ type ( | ||
| 58 | MeLoveFlag int `json:"meLoveFlag"` // 当前人员对文章的点赞标识 (0 没有点赞 1有点赞) | 59 | MeLoveFlag int `json:"meLoveFlag"` // 当前人员对文章的点赞标识 (0 没有点赞 1有点赞) |
| 59 | MeFollowFlag int `json:"meFollowFlag"` // 当前人员对作者的关注标识 (0 没有关注 1有关注) | 60 | MeFollowFlag int `json:"meFollowFlag"` // 当前人员对作者的关注标识 (0 没有关注 1有关注) |
| 60 | Tags []string `json:"tags"` // 文章的标签 | 61 | Tags []string `json:"tags"` // 文章的标签 |
| 62 | + MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 | ||
| 61 | } | 63 | } |
| 62 | ArticleSection { | 64 | ArticleSection { |
| 63 | Id int64 `json:"id"` //段落id | 65 | Id int64 `json:"id"` //段落id |
| @@ -164,10 +164,14 @@ func (l *MiniCreateArticleLogic) MiniCreateArticle(req *types.MiniArticleCreateR | @@ -164,10 +164,14 @@ func (l *MiniCreateArticleLogic) MiniCreateArticle(req *types.MiniArticleCreateR | ||
| 164 | CountRead: 0, | 164 | CountRead: 0, |
| 165 | Show: domain.ArticleShowEnable, | 165 | Show: domain.ArticleShowEnable, |
| 166 | Tags: []int64{}, | 166 | Tags: []int64{}, |
| 167 | + MatchUrl: map[string]string{}, | ||
| 167 | } | 168 | } |
| 168 | if len(whoRead) > 0 { | 169 | if len(whoRead) > 0 { |
| 169 | newArticle.TargetUser = domain.ArticleTargetLimit | 170 | newArticle.TargetUser = domain.ArticleTargetLimit |
| 170 | } | 171 | } |
| 172 | + for k, v := range req.MatchUrl { | ||
| 173 | + newArticle.MatchUrl[k] = v | ||
| 174 | + } | ||
| 171 | //设置内容概要 | 175 | //设置内容概要 |
| 172 | if len(sectionList) > 0 { | 176 | if len(sectionList) > 0 { |
| 173 | // 截取内容 50个字 | 177 | // 截取内容 50个字 |
| @@ -122,10 +122,15 @@ func (l *MiniGetArticleLogic) MiniGetArticle(req *types.MiniArticleGetRequest) ( | @@ -122,10 +122,15 @@ func (l *MiniGetArticleLogic) MiniGetArticle(req *types.MiniArticleGetRequest) ( | ||
| 122 | MeLoveFlag: meLoveFlag, | 122 | MeLoveFlag: meLoveFlag, |
| 123 | MeFollowFlag: 0, | 123 | MeFollowFlag: 0, |
| 124 | Tags: tags, | 124 | Tags: tags, |
| 125 | + MatchUrl: map[string]string{}, | ||
| 125 | } | 126 | } |
| 126 | if articleInfo.CreatedAt != articleInfo.UpdatedAt { | 127 | if articleInfo.CreatedAt != articleInfo.UpdatedAt { |
| 127 | resp.Edit = 1 | 128 | resp.Edit = 1 |
| 128 | } | 129 | } |
| 130 | + | ||
| 131 | + for k, v := range articleInfo.MatchUrl { | ||
| 132 | + resp.MatchUrl[k] = v | ||
| 133 | + } | ||
| 129 | for _, val := range articleInfo.Images { | 134 | for _, val := range articleInfo.Images { |
| 130 | resp.Images = append(resp.Images, val.Url) | 135 | resp.Images = append(resp.Images, val.Url) |
| 131 | } | 136 | } |
| @@ -797,6 +797,7 @@ type MiniArticleCreateRequest struct { | @@ -797,6 +797,7 @@ type MiniArticleCreateRequest struct { | ||
| 797 | WhoRead []int64 `json:"whoRead,optional"` //谁可查看 | 797 | WhoRead []int64 `json:"whoRead,optional"` //谁可查看 |
| 798 | WhoReview []int64 `json:"whoReview,optional"` //谁可评论 | 798 | WhoReview []int64 `json:"whoReview,optional"` //谁可评论 |
| 799 | Location Location `json:"location,optional"` //定位坐标 | 799 | Location Location `json:"location,optional"` //定位坐标 |
| 800 | + MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 | ||
| 800 | } | 801 | } |
| 801 | 802 | ||
| 802 | type MiniArticleCreateResponse struct { | 803 | type MiniArticleCreateResponse struct { |
| @@ -828,6 +829,7 @@ type MiniArticleGetResponse struct { | @@ -828,6 +829,7 @@ type MiniArticleGetResponse struct { | ||
| 828 | MeLoveFlag int `json:"meLoveFlag"` // 当前人员对文章的点赞标识 (0 没有点赞 1有点赞) | 829 | MeLoveFlag int `json:"meLoveFlag"` // 当前人员对文章的点赞标识 (0 没有点赞 1有点赞) |
| 829 | MeFollowFlag int `json:"meFollowFlag"` // 当前人员对作者的关注标识 (0 没有关注 1有关注) | 830 | MeFollowFlag int `json:"meFollowFlag"` // 当前人员对作者的关注标识 (0 没有关注 1有关注) |
| 830 | Tags []string `json:"tags"` // 文章的标签 | 831 | Tags []string `json:"tags"` // 文章的标签 |
| 832 | + MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 | ||
| 831 | } | 833 | } |
| 832 | 834 | ||
| 833 | type ArticleSection struct { | 835 | type ArticleSection struct { |
| @@ -31,6 +31,7 @@ type Article struct { | @@ -31,6 +31,7 @@ type Article struct { | ||
| 31 | Tags []int64 `gorm:"type:jsonb;serializer:json"` //定性标签 | 31 | Tags []int64 `gorm:"type:jsonb;serializer:json"` //定性标签 |
| 32 | Show int // 评论的展示状态(0显示、1不显示) | 32 | Show int // 评论的展示状态(0显示、1不显示) |
| 33 | Summary string // 内容概要 | 33 | Summary string // 内容概要 |
| 34 | + MatchUrl map[string]string `gorm:"type:jsonb;serializer:json"` // 匹配文章内容中的url文本 | ||
| 34 | } | 35 | } |
| 35 | 36 | ||
| 36 | func (m *Article) TableName() string { | 37 | func (m *Article) TableName() string { |
| @@ -28,6 +28,7 @@ type ArticleBackup struct { | @@ -28,6 +28,7 @@ type ArticleBackup struct { | ||
| 28 | Tags []int64 `gorm:"type:jsonb;serializer:json"` // 标签 | 28 | Tags []int64 `gorm:"type:jsonb;serializer:json"` // 标签 |
| 29 | Location domain.Location `gorm:"type:jsonb;serializer:json"` // 坐标 | 29 | Location domain.Location `gorm:"type:jsonb;serializer:json"` // 坐标 |
| 30 | TargetUser int // 分发方式 0 分发给所有人 1 分发给指定的人 | 30 | TargetUser int // 分发方式 0 分发给所有人 1 分发给指定的人 |
| 31 | + MatchUrl map[string]string `gorm:"type:jsonb;serializer:json"` // 匹配文章内容中的url文本 | ||
| 31 | } | 32 | } |
| 32 | 33 | ||
| 33 | func (m *ArticleBackup) TableName() string { | 34 | func (m *ArticleBackup) TableName() string { |
| @@ -25,6 +25,7 @@ type ArticleDraft struct { | @@ -25,6 +25,7 @@ type ArticleDraft struct { | ||
| 25 | WhoRead []int64 `gorm:"type:jsonb;serializer:json"` // 谁可以看 | 25 | WhoRead []int64 `gorm:"type:jsonb;serializer:json"` // 谁可以看 |
| 26 | WhoReview []int64 `gorm:"type:jsonb;serializer:json"` // 评论人 | 26 | WhoReview []int64 `gorm:"type:jsonb;serializer:json"` // 评论人 |
| 27 | Location domain.Location `gorm:"type:jsonb;serializer:json"` // 坐标 | 27 | Location domain.Location `gorm:"type:jsonb;serializer:json"` // 坐标 |
| 28 | + MatchUrl map[string]string `gorm:"type:jsonb;serializer:json"` // 匹配文章内容中的url文本 | ||
| 28 | } | 29 | } |
| 29 | 30 | ||
| 30 | func (m *ArticleDraft) TableName() string { | 31 | func (m *ArticleDraft) TableName() string { |
| @@ -171,6 +171,7 @@ func (repository *ArticleBackupRepository) ModelToDomainModel(from *models.Artic | @@ -171,6 +171,7 @@ func (repository *ArticleBackupRepository) ModelToDomainModel(from *models.Artic | ||
| 171 | WhoRead: from.WhoRead, | 171 | WhoRead: from.WhoRead, |
| 172 | WhoReview: from.WhoReview, | 172 | WhoReview: from.WhoReview, |
| 173 | Tags: from.Tags, | 173 | Tags: from.Tags, |
| 174 | + MatchUrl: from.MatchUrl, | ||
| 174 | } | 175 | } |
| 175 | // err := copier.Copy(to, from) | 176 | // err := copier.Copy(to, from) |
| 176 | return to, nil | 177 | return to, nil |
| @@ -193,9 +194,10 @@ func (repository *ArticleBackupRepository) DomainModelToModel(from *domain.Artic | @@ -193,9 +194,10 @@ func (repository *ArticleBackupRepository) DomainModelToModel(from *domain.Artic | ||
| 193 | Action: from.Action, | 194 | Action: from.Action, |
| 194 | WhoRead: from.WhoRead, | 195 | WhoRead: from.WhoRead, |
| 195 | WhoReview: from.WhoReview, | 196 | WhoReview: from.WhoReview, |
| 196 | - Location: from.Location, | ||
| 197 | Tags: from.Tags, | 197 | Tags: from.Tags, |
| 198 | + Location: from.Location, | ||
| 198 | TargetUser: int(from.TargetUser), | 199 | TargetUser: int(from.TargetUser), |
| 200 | + MatchUrl: from.MatchUrl, | ||
| 199 | } | 201 | } |
| 200 | // err := copier.Copy(to, from) | 202 | // err := copier.Copy(to, from) |
| 201 | return to, nil | 203 | return to, nil |
| @@ -156,6 +156,7 @@ func (repository *ArticleDraftRepository) ModelToDomainModel(from *models.Articl | @@ -156,6 +156,7 @@ func (repository *ArticleDraftRepository) ModelToDomainModel(from *models.Articl | ||
| 156 | WhoRead: from.WhoRead, | 156 | WhoRead: from.WhoRead, |
| 157 | WhoReview: from.WhoReview, | 157 | WhoReview: from.WhoReview, |
| 158 | Location: from.Location, | 158 | Location: from.Location, |
| 159 | + MatchUrl: from.MatchUrl, | ||
| 159 | } | 160 | } |
| 160 | // err := copier.Copy(to, from) | 161 | // err := copier.Copy(to, from) |
| 161 | return to, nil | 162 | return to, nil |
| @@ -177,6 +178,7 @@ func (repository *ArticleDraftRepository) DomainModelToModel(from *domain.Articl | @@ -177,6 +178,7 @@ func (repository *ArticleDraftRepository) DomainModelToModel(from *domain.Articl | ||
| 177 | WhoRead: from.WhoRead, | 178 | WhoRead: from.WhoRead, |
| 178 | WhoReview: from.WhoReview, | 179 | WhoReview: from.WhoReview, |
| 179 | Location: from.Location, | 180 | Location: from.Location, |
| 181 | + MatchUrl: from.MatchUrl, | ||
| 180 | } | 182 | } |
| 181 | // err := copier.Copy(to, from) | 183 | // err := copier.Copy(to, from) |
| 182 | return to, nil | 184 | return to, nil |
| @@ -304,6 +304,7 @@ func (repository *ArticleRepository) ModelToDomainModel(from *models.Article) (* | @@ -304,6 +304,7 @@ func (repository *ArticleRepository) ModelToDomainModel(from *models.Article) (* | ||
| 304 | Show: domain.ArticleShow(from.Show), | 304 | Show: domain.ArticleShow(from.Show), |
| 305 | Tags: from.Tags, | 305 | Tags: from.Tags, |
| 306 | Summary: from.Summary, | 306 | Summary: from.Summary, |
| 307 | + MatchUrl: from.MatchUrl, | ||
| 307 | } | 308 | } |
| 308 | return to, nil | 309 | return to, nil |
| 309 | } | 310 | } |
| @@ -328,9 +329,10 @@ func (repository *ArticleRepository) DomainModelToModel(from *domain.Article) (* | @@ -328,9 +329,10 @@ func (repository *ArticleRepository) DomainModelToModel(from *domain.Article) (* | ||
| 328 | CountLove: from.CountLove, | 329 | CountLove: from.CountLove, |
| 329 | CountRead: from.CountRead, | 330 | CountRead: from.CountRead, |
| 330 | CountComment: from.CountComment, | 331 | CountComment: from.CountComment, |
| 331 | - Show: int(from.Show), | ||
| 332 | Tags: from.Tags, | 332 | Tags: from.Tags, |
| 333 | + Show: int(from.Show), | ||
| 333 | Summary: from.Summary, | 334 | Summary: from.Summary, |
| 335 | + MatchUrl: from.MatchUrl, | ||
| 334 | } | 336 | } |
| 335 | // err := copier.Copy(to, from) | 337 | // err := copier.Copy(to, from) |
| 336 | return to, nil | 338 | return to, nil |
| @@ -28,6 +28,7 @@ type Article struct { | @@ -28,6 +28,7 @@ type Article struct { | ||
| 28 | Show ArticleShow `json:"show"` // 评论的展示状态(1显示,2不显示、) | 28 | Show ArticleShow `json:"show"` // 评论的展示状态(1显示,2不显示、) |
| 29 | Tags []int64 `json:"tags"` // 定性标签 | 29 | Tags []int64 `json:"tags"` // 定性标签 |
| 30 | Summary string `json:"summary"` // 内容概要 | 30 | Summary string `json:"summary"` // 内容概要 |
| 31 | + MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 | ||
| 31 | // ...more | 32 | // ...more |
| 32 | } | 33 | } |
| 33 | 34 |
| @@ -25,6 +25,7 @@ type ArticleBackup struct { | @@ -25,6 +25,7 @@ type ArticleBackup struct { | ||
| 25 | WhoRead []int64 `json:"whoRead"` // 谁可以看 | 25 | WhoRead []int64 `json:"whoRead"` // 谁可以看 |
| 26 | WhoReview []int64 `json:"whoReview"` // 评论人 | 26 | WhoReview []int64 `json:"whoReview"` // 评论人 |
| 27 | Tags []int64 `json:"tags"` // 标签 | 27 | Tags []int64 `json:"tags"` // 标签 |
| 28 | + MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 | ||
| 28 | } | 29 | } |
| 29 | 30 | ||
| 30 | type ArticleBackupRepository interface { | 31 | type ArticleBackupRepository interface { |
| @@ -23,6 +23,7 @@ type ArticleDraft struct { | @@ -23,6 +23,7 @@ type ArticleDraft struct { | ||
| 23 | WhoRead []int64 `json:"whoRead"` // 谁可以看 | 23 | WhoRead []int64 `json:"whoRead"` // 谁可以看 |
| 24 | WhoReview []int64 `json:"whoReview"` // 评论人 | 24 | WhoReview []int64 `json:"whoReview"` // 评论人 |
| 25 | Location Location `json:"location"` // 坐标 | 25 | Location Location `json:"location"` // 坐标 |
| 26 | + MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 | ||
| 26 | } | 27 | } |
| 27 | type ArticleDraftRepository interface { | 28 | type ArticleDraftRepository interface { |
| 28 | Insert(ctx context.Context, conn transaction.Conn, dm *ArticleDraft) (*ArticleDraft, error) | 29 | Insert(ctx context.Context, conn transaction.Conn, dm *ArticleDraft) (*ArticleDraft, error) |
-
请 注册 或 登录 后发表评论