正在显示
24 个修改的文件
包含
115 行增加
和
2 行删除
| @@ -77,6 +77,7 @@ type ( | @@ -77,6 +77,7 @@ type ( | ||
| 77 | MeFollowFlag int `json:"meFollowFlag"` // 当前人员对作者的关注标识 (0 没有关注 1有关注) | 77 | MeFollowFlag int `json:"meFollowFlag"` // 当前人员对作者的关注标识 (0 没有关注 1有关注) |
| 78 | Tags []string `json:"tags"` // 文章的标签 | 78 | Tags []string `json:"tags"` // 文章的标签 |
| 79 | MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 | 79 | MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 |
| 80 | + Cover string `json:"cover"` //封面 | ||
| 80 | } | 81 | } |
| 81 | ArticleSection { | 82 | ArticleSection { |
| 82 | Id int64 `json:"id"` //段落id | 83 | Id int64 `json:"id"` //段落id |
| @@ -116,6 +117,7 @@ type ( | @@ -116,6 +117,7 @@ type ( | ||
| 116 | WhoRead []int64 `json:"whoRead"` //谁可查看 | 117 | WhoRead []int64 `json:"whoRead"` //谁可查看 |
| 117 | IsDel int `json:"isDel"` //是否删除 1-删除 0-否 | 118 | IsDel int `json:"isDel"` //是否删除 1-删除 0-否 |
| 118 | DeletedType int `json:"deletedType"` //类型 1-运营删除 2-用户删除 | 119 | DeletedType int `json:"deletedType"` //类型 1-运营删除 2-用户删除 |
| 120 | + Cover string `json:"cover"` //封面 | ||
| 119 | } | 121 | } |
| 120 | 122 | ||
| 121 | SystemArticleSearchMeRequest { | 123 | SystemArticleSearchMeRequest { |
| @@ -216,6 +218,7 @@ type ( | @@ -216,6 +218,7 @@ type ( | ||
| 216 | Location Location `json:"location"` | 218 | Location Location `json:"location"` |
| 217 | Action string `json:"action"` | 219 | Action string `json:"action"` |
| 218 | Show int `json:"show"` | 220 | Show int `json:"show"` |
| 221 | + Cover string `json:"cover"` //封面 | ||
| 219 | } | 222 | } |
| 220 | ) | 223 | ) |
| 221 | 224 | ||
| @@ -235,6 +238,7 @@ type ( | @@ -235,6 +238,7 @@ type ( | ||
| 235 | Location Location `json:"location"` | 238 | Location Location `json:"location"` |
| 236 | Action string `json:"action"` | 239 | Action string `json:"action"` |
| 237 | Show int `json:"show"` | 240 | Show int `json:"show"` |
| 241 | + Cover string `json:"cover"` //封面 | ||
| 238 | } | 242 | } |
| 239 | ) | 243 | ) |
| 240 | 244 | ||
| @@ -320,6 +324,7 @@ type ( | @@ -320,6 +324,7 @@ type ( | ||
| 320 | CreatedAt int64 `json:"createdAt"`// | 324 | CreatedAt int64 `json:"createdAt"`// |
| 321 | MatchUrl map[string]string `json:"matchUrl"` //匹配内容中的url文本 | 325 | MatchUrl map[string]string `json:"matchUrl"` //匹配内容中的url文本 |
| 322 | Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 | 326 | Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 |
| 327 | + Cover string `json:"cover"` //封面 | ||
| 323 | } | 328 | } |
| 324 | ) | 329 | ) |
| 325 | 330 | ||
| @@ -342,6 +347,7 @@ type ( | @@ -342,6 +347,7 @@ type ( | ||
| 342 | Location Location `json:"location"` // 坐标 | 347 | Location Location `json:"location"` // 坐标 |
| 343 | MatchUrl map[string]string `json:"matchUrl"` // | 348 | MatchUrl map[string]string `json:"matchUrl"` // |
| 344 | Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 | 349 | Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 |
| 350 | + Cover string `json:"cover"` //封面 | ||
| 345 | } | 351 | } |
| 346 | ) | 352 | ) |
| 347 | 353 | ||
| @@ -447,6 +453,7 @@ type ( | @@ -447,6 +453,7 @@ type ( | ||
| 447 | Show int `json:"show"` // 评论的展示状态(0显示、1不显示) | 453 | Show int `json:"show"` // 评论的展示状态(0显示、1不显示) |
| 448 | Tags []ArticleTagItem `json:"tags"` //标签 | 454 | Tags []ArticleTagItem `json:"tags"` //标签 |
| 449 | TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人] | 455 | TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人] |
| 456 | + Cover string `json:"cover"` //封面 | ||
| 450 | } | 457 | } |
| 451 | ) | 458 | ) |
| 452 | 459 | ||
| @@ -473,6 +480,7 @@ type ( | @@ -473,6 +480,7 @@ type ( | ||
| 473 | Title string `json:"title"` //标题 | 480 | Title string `json:"title"` //标题 |
| 474 | AuthorId int64 `json:"authorId"` //发布人ID | 481 | AuthorId int64 `json:"authorId"` //发布人ID |
| 475 | Author string `json:"author"` //发布人 | 482 | Author string `json:"author"` //发布人 |
| 483 | + Cover string `json:"cover"` //封面 | ||
| 476 | Images []string `json:"images"` //图片 | 484 | Images []string `json:"images"` //图片 |
| 477 | CreatedAt int64 `json:"createdAt"` //文章的创建日期 | 485 | CreatedAt int64 `json:"createdAt"` //文章的创建日期 |
| 478 | UpdatedAt int64 `json:"updatedAt"` //文章的编辑日期 | 486 | UpdatedAt int64 `json:"updatedAt"` //文章的编辑日期 |
| @@ -601,6 +609,7 @@ type ( | @@ -601,6 +609,7 @@ type ( | ||
| 601 | Location Location `json:"location"` // 定位坐标 | 609 | Location Location `json:"location"` // 定位坐标 |
| 602 | TargetUser int `json:"targetUser"` // 分发方式 [0分发给所有人、1分发给指定的人] | 610 | TargetUser int `json:"targetUser"` // 分发方式 [0分发给所有人、1分发给指定的人] |
| 603 | Tags []int64 `json:"tags"` // 标签 | 611 | Tags []int64 `json:"tags"` // 标签 |
| 612 | + Cover string `json:"cover"` //封面 | ||
| 604 | } | 613 | } |
| 605 | ) | 614 | ) |
| 606 | // 管理后台文章恢复 | 615 | // 管理后台文章恢复 |
| @@ -666,6 +675,7 @@ type ( | @@ -666,6 +675,7 @@ type ( | ||
| 666 | Images []string `json:"images"` | 675 | Images []string `json:"images"` |
| 667 | CreatedAt int64 `json:"createdAt"` | 676 | CreatedAt int64 `json:"createdAt"` |
| 668 | MeReadFlag int `json:"meReadFlag"` //已读标识 [0:未读] [1:已读] | 677 | MeReadFlag int `json:"meReadFlag"` //已读标识 [0:未读] [1:已读] |
| 678 | + Cover string `json:"cover"` //封面 | ||
| 669 | } | 679 | } |
| 670 | ) | 680 | ) |
| 671 | 681 | ||
| @@ -755,6 +765,7 @@ type ( | @@ -755,6 +765,7 @@ type ( | ||
| 755 | AuthorId int64 `json:"authorId"` //发布人id | 765 | AuthorId int64 `json:"authorId"` //发布人id |
| 756 | Author string `json:"author"` //发布人 | 766 | Author string `json:"author"` //发布人 |
| 757 | UpdatedAt int64 `json:"updatedAt"` //编辑时间 | 767 | UpdatedAt int64 `json:"updatedAt"` //编辑时间 |
| 768 | + Cover string `json:"cover"` //封面 | ||
| 758 | } | 769 | } |
| 759 | ) | 770 | ) |
| 760 | 771 | ||
| @@ -799,6 +810,7 @@ type ( | @@ -799,6 +810,7 @@ type ( | ||
| 799 | MatchUrl map[string]string `json:"matchUrl,optional"` // 匹配文章内容中的url文本 | 810 | MatchUrl map[string]string `json:"matchUrl,optional"` // 匹配文章内容中的url文本 |
| 800 | Tags []int64 `json:"tags"` // 标签 | 811 | Tags []int64 `json:"tags"` // 标签 |
| 801 | Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 | 812 | Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 |
| 813 | + Cover string `json:"cover"` //封面 | ||
| 802 | } | 814 | } |
| 803 | ) | 815 | ) |
| 804 | 816 |
| @@ -236,6 +236,7 @@ type( | @@ -236,6 +236,7 @@ type( | ||
| 236 | ReadFlag bool `json:"readFlag"` // 已读标识 true:已读 false:未读 | 236 | ReadFlag bool `json:"readFlag"` // 已读标识 true:已读 false:未读 |
| 237 | Images []string `json:"images"` // 图片列表 | 237 | Images []string `json:"images"` // 图片列表 |
| 238 | Author UserItem `json:"author"` // 作者 | 238 | Author UserItem `json:"author"` // 作者 |
| 239 | + Cover string `json:"cover"` //封面 | ||
| 239 | } | 240 | } |
| 240 | MiniUserFollowedSearchRequest{ | 241 | MiniUserFollowedSearchRequest{ |
| 241 | Page int `json:"page,optional"` | 242 | Page int `json:"page,optional"` |
| @@ -76,6 +76,7 @@ func (l *MiniArticleBackupSearchLogic) MiniArticleBackupSearch(req *types.MiniAr | @@ -76,6 +76,7 @@ func (l *MiniArticleBackupSearchLogic) MiniArticleBackupSearch(req *types.MiniAr | ||
| 76 | ChangeField: backupList[i].ChangeField, | 76 | ChangeField: backupList[i].ChangeField, |
| 77 | Action: backupList[i].Action, | 77 | Action: backupList[i].Action, |
| 78 | Show: int(backupList[i].Show), | 78 | Show: int(backupList[i].Show), |
| 79 | + Cover: backupList[i].GetCover(), | ||
| 79 | } | 80 | } |
| 80 | //根据修改的内容替换展示内容 | 81 | //根据修改的内容替换展示内容 |
| 81 | changeFiled := []string{} | 82 | changeFiled := []string{} |
| @@ -69,6 +69,7 @@ func NewArticle(article *domain.Article) types.ArticleSearchMe { | @@ -69,6 +69,7 @@ func NewArticle(article *domain.Article) types.ArticleSearchMe { | ||
| 69 | WhoRead: article.WhoRead, | 69 | WhoRead: article.WhoRead, |
| 70 | IsDel: article.IsDel, | 70 | IsDel: article.IsDel, |
| 71 | DeletedType: article.DeletedType, | 71 | DeletedType: article.DeletedType, |
| 72 | + Cover: article.GetCover(), | ||
| 72 | } | 73 | } |
| 73 | return articleSearchMe | 74 | return articleSearchMe |
| 74 | } | 75 | } |
| @@ -67,6 +67,7 @@ func (l *MiniGetArticleBackupLogic) MiniGetArticleBackup(req *types.MiniGetArtic | @@ -67,6 +67,7 @@ func (l *MiniGetArticleBackupLogic) MiniGetArticleBackup(req *types.MiniGetArtic | ||
| 67 | ChangeField: backupInfo.ChangeField, | 67 | ChangeField: backupInfo.ChangeField, |
| 68 | Action: backupInfo.Action, | 68 | Action: backupInfo.Action, |
| 69 | Show: int(backupInfo.Show), | 69 | Show: int(backupInfo.Show), |
| 70 | + Cover: backupInfo.GetCover(), | ||
| 70 | } | 71 | } |
| 71 | 72 | ||
| 72 | return | 73 | return |
| @@ -70,6 +70,7 @@ func (l *MiniGetArticleDraftMeLogic) MiniGetArticleDraftMe(req *types.MiniArticl | @@ -70,6 +70,7 @@ func (l *MiniGetArticleDraftMeLogic) MiniGetArticleDraftMe(req *types.MiniArticl | ||
| 70 | }, | 70 | }, |
| 71 | MatchUrl: map[string]string{}, | 71 | MatchUrl: map[string]string{}, |
| 72 | Paragraphs: paragraphs, | 72 | Paragraphs: paragraphs, |
| 73 | + Cover: draftInfo.GetCover(), | ||
| 73 | } | 74 | } |
| 74 | for k, v := range draftInfo.MatchUrl { | 75 | for k, v := range draftInfo.MatchUrl { |
| 75 | resp.MatchUrl[k] = v | 76 | resp.MatchUrl[k] = v |
| @@ -147,6 +147,7 @@ func (l *MiniGetArticleLogic) MiniGetArticle(req *types.MiniArticleGetRequest) ( | @@ -147,6 +147,7 @@ func (l *MiniGetArticleLogic) MiniGetArticle(req *types.MiniArticleGetRequest) ( | ||
| 147 | Tags: tags, | 147 | Tags: tags, |
| 148 | MatchUrl: map[string]string{}, | 148 | MatchUrl: map[string]string{}, |
| 149 | Videos: []types.Video{}, | 149 | Videos: []types.Video{}, |
| 150 | + Cover: articleInfo.GetCover(), | ||
| 150 | } | 151 | } |
| 151 | if backupCount > 1 { | 152 | if backupCount > 1 { |
| 152 | resp.Edit = 1 | 153 | resp.Edit = 1 |
| @@ -75,6 +75,7 @@ func (l *MiniSearchArticleDraftMeLogic) MiniSearchArticleDraftMe(req *types.Mini | @@ -75,6 +75,7 @@ func (l *MiniSearchArticleDraftMeLogic) MiniSearchArticleDraftMe(req *types.Mini | ||
| 75 | CreatedAt: draftList[i].CreatedAt, | 75 | CreatedAt: draftList[i].CreatedAt, |
| 76 | MatchUrl: draftList[i].MatchUrl, | 76 | MatchUrl: draftList[i].MatchUrl, |
| 77 | Paragraphs: paragraphs, | 77 | Paragraphs: paragraphs, |
| 78 | + Cover: draftList[i].GetCover(), | ||
| 78 | } | 79 | } |
| 79 | } | 80 | } |
| 80 | return resp, nil | 81 | return resp, nil |
| @@ -76,6 +76,7 @@ func (l *MiniSearchArticlePageLogic) MiniSearchArticlePage(req *types.MiniSearch | @@ -76,6 +76,7 @@ func (l *MiniSearchArticlePageLogic) MiniSearchArticlePage(req *types.MiniSearch | ||
| 76 | Images: []string{}, | 76 | Images: []string{}, |
| 77 | CreatedAt: val.CreatedAt, | 77 | CreatedAt: val.CreatedAt, |
| 78 | MeReadFlag: 0, | 78 | MeReadFlag: 0, |
| 79 | + Cover: val.GetCover(), | ||
| 79 | } | 80 | } |
| 80 | 81 | ||
| 81 | if _, ok := readFlag[val.Id]; ok { | 82 | if _, ok := readFlag[val.Id]; ok { |
| @@ -54,6 +54,7 @@ func (l *SystemArticleGetHistoryLogic) SystemArticleGetHistory(req *types.System | @@ -54,6 +54,7 @@ func (l *SystemArticleGetHistoryLogic) SystemArticleGetHistory(req *types.System | ||
| 54 | TargetUser: int(backup.TargetUser), | 54 | TargetUser: int(backup.TargetUser), |
| 55 | Tags: backup.Tags, | 55 | Tags: backup.Tags, |
| 56 | Videos: make([]types.Video, 0), | 56 | Videos: make([]types.Video, 0), |
| 57 | + Cover: backup.GetCover(), | ||
| 57 | } | 58 | } |
| 58 | 59 | ||
| 59 | //文章段落内容 | 60 | //文章段落内容 |
| @@ -81,6 +81,7 @@ func (l *SystemGetArticleDraftLogic) SystemGetArticleDraft(req *types.SystemArti | @@ -81,6 +81,7 @@ func (l *SystemGetArticleDraftLogic) SystemGetArticleDraft(req *types.SystemArti | ||
| 81 | WhoReviewInfo: make([]types.UserShowName, 0), | 81 | WhoReviewInfo: make([]types.UserShowName, 0), |
| 82 | MatchUrl: articleDraft.MatchUrl, | 82 | MatchUrl: articleDraft.MatchUrl, |
| 83 | Tags: articleDraft.Tags, | 83 | Tags: articleDraft.Tags, |
| 84 | + Cover: articleDraft.GetCover(), | ||
| 84 | } | 85 | } |
| 85 | userIds := lo.Union(resp.WhoRead, resp.WhoReview) | 86 | userIds := lo.Union(resp.WhoRead, resp.WhoReview) |
| 86 | if len(userIds) > 0 { | 87 | if len(userIds) > 0 { |
| @@ -68,6 +68,7 @@ func (l *SystemGetArticleLogic) SystemGetArticle(req *types.SystemArticleGetRequ | @@ -68,6 +68,7 @@ func (l *SystemGetArticleLogic) SystemGetArticle(req *types.SystemArticleGetRequ | ||
| 68 | Tags: make([]types.ArticleTagItem, 0), | 68 | Tags: make([]types.ArticleTagItem, 0), |
| 69 | TargetUser: int(article.TargetUser), | 69 | TargetUser: int(article.TargetUser), |
| 70 | Videos: make([]types.Video, 0), | 70 | Videos: make([]types.Video, 0), |
| 71 | + Cover: article.Cover, | ||
| 71 | } | 72 | } |
| 72 | 73 | ||
| 73 | for _, val := range article.Videos { | 74 | for _, val := range article.Videos { |
| @@ -72,6 +72,7 @@ func (l *SystemSearchArticleDraftLogic) SystemSearchArticleDraft(req *types.Syst | @@ -72,6 +72,7 @@ func (l *SystemSearchArticleDraftLogic) SystemSearchArticleDraft(req *types.Syst | ||
| 72 | AuthorId: item.AuthorId, | 72 | AuthorId: item.AuthorId, |
| 73 | Author: author, | 73 | Author: author, |
| 74 | UpdatedAt: item.UpdatedAt, | 74 | UpdatedAt: item.UpdatedAt, |
| 75 | + Cover: item.GetCover(), | ||
| 75 | }) | 76 | }) |
| 76 | }) | 77 | }) |
| 77 | return | 78 | return |
| @@ -93,6 +93,7 @@ func (l *SystemSearchArticleLogic) SystemSearchArticle(req *types.SystemArticleS | @@ -93,6 +93,7 @@ func (l *SystemSearchArticleLogic) SystemSearchArticle(req *types.SystemArticleS | ||
| 93 | Id: item.Operator.Id, | 93 | Id: item.Operator.Id, |
| 94 | Name: item.Operator.Name, | 94 | Name: item.Operator.Name, |
| 95 | }, | 95 | }, |
| 96 | + Cover: item.Cover, | ||
| 96 | }) | 97 | }) |
| 97 | }) | 98 | }) |
| 98 | return | 99 | return |
| @@ -327,7 +327,7 @@ func (l *SystemUpdateArticleLogic) getSections(req *types.SystemArticleUpdateReq | @@ -327,7 +327,7 @@ func (l *SystemUpdateArticleLogic) getSections(req *types.SystemArticleUpdateReq | ||
| 327 | lo.ForEach(req.Section, func(item types.ArticleSection, index int) { | 327 | lo.ForEach(req.Section, func(item types.ArticleSection, index int) { |
| 328 | strList := strings.Split(item.Content, "\n") | 328 | strList := strings.Split(item.Content, "\n") |
| 329 | for key, value := range strList { | 329 | for key, value := range strList { |
| 330 | - if value == "" && item.ParagraphType != 2 { | 330 | + if value == "" && item.ParagraphType == domain.ParagraphTypeNone { |
| 331 | continue | 331 | continue |
| 332 | } | 332 | } |
| 333 | section := domain.ArticleSection{ | 333 | section := domain.ArticleSection{ |
| @@ -64,6 +64,7 @@ func (l *MiniUserNewsLogic) MiniUserNews(req *types.MiniUserNewsRequest) (resp * | @@ -64,6 +64,7 @@ func (l *MiniUserNewsLogic) MiniUserNews(req *types.MiniUserNewsRequest) (resp * | ||
| 64 | Time: item.CreatedAt, | 64 | Time: item.CreatedAt, |
| 65 | Images: make([]string, 0), | 65 | Images: make([]string, 0), |
| 66 | ReadFlag: false, | 66 | ReadFlag: false, |
| 67 | + Cover: item.GetCover(), | ||
| 67 | } | 68 | } |
| 68 | if author, _ := domain.LazyLoad(userMap, l.ctx, conn, item.AuthorId, l.svcCtx.UserRepository.FindOne); author != nil { | 69 | if author, _ := domain.LazyLoad(userMap, l.ctx, conn, item.AuthorId, l.svcCtx.UserRepository.FindOne); author != nil { |
| 69 | newsItem.Author = types.UserItem{ | 70 | newsItem.Author = types.UserItem{ |
| @@ -607,6 +607,7 @@ type UserNewsItem struct { | @@ -607,6 +607,7 @@ type UserNewsItem struct { | ||
| 607 | ReadFlag bool `json:"readFlag"` // 已读标识 true:已读 false:未读 | 607 | ReadFlag bool `json:"readFlag"` // 已读标识 true:已读 false:未读 |
| 608 | Images []string `json:"images"` // 图片列表 | 608 | Images []string `json:"images"` // 图片列表 |
| 609 | Author UserItem `json:"author"` // 作者 | 609 | Author UserItem `json:"author"` // 作者 |
| 610 | + Cover string `json:"cover"` //封面 | ||
| 610 | } | 611 | } |
| 611 | 612 | ||
| 612 | type MiniUserFollowedSearchRequest struct { | 613 | type MiniUserFollowedSearchRequest struct { |
| @@ -1000,6 +1001,7 @@ type MiniArticleGetResponse struct { | @@ -1000,6 +1001,7 @@ type MiniArticleGetResponse struct { | ||
| 1000 | MeFollowFlag int `json:"meFollowFlag"` // 当前人员对作者的关注标识 (0 没有关注 1有关注) | 1001 | MeFollowFlag int `json:"meFollowFlag"` // 当前人员对作者的关注标识 (0 没有关注 1有关注) |
| 1001 | Tags []string `json:"tags"` // 文章的标签 | 1002 | Tags []string `json:"tags"` // 文章的标签 |
| 1002 | MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 | 1003 | MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 |
| 1004 | + Cover string `json:"cover"` //封面 | ||
| 1003 | } | 1005 | } |
| 1004 | 1006 | ||
| 1005 | type ArticleSection struct { | 1007 | type ArticleSection struct { |
| @@ -1037,6 +1039,7 @@ type ArticleSearchMe struct { | @@ -1037,6 +1039,7 @@ type ArticleSearchMe struct { | ||
| 1037 | WhoRead []int64 `json:"whoRead"` //谁可查看 | 1039 | WhoRead []int64 `json:"whoRead"` //谁可查看 |
| 1038 | IsDel int `json:"isDel"` //是否删除 1-删除 0-否 | 1040 | IsDel int `json:"isDel"` //是否删除 1-删除 0-否 |
| 1039 | DeletedType int `json:"deletedType"` //类型 1-运营删除 2-用户删除 | 1041 | DeletedType int `json:"deletedType"` //类型 1-运营删除 2-用户删除 |
| 1042 | + Cover string `json:"cover"` //封面 | ||
| 1040 | } | 1043 | } |
| 1041 | 1044 | ||
| 1042 | type SystemArticleSearchMeRequest struct { | 1045 | type SystemArticleSearchMeRequest struct { |
| @@ -1129,6 +1132,7 @@ type MiniArticleBackupItem struct { | @@ -1129,6 +1132,7 @@ type MiniArticleBackupItem struct { | ||
| 1129 | Location Location `json:"location"` | 1132 | Location Location `json:"location"` |
| 1130 | Action string `json:"action"` | 1133 | Action string `json:"action"` |
| 1131 | Show int `json:"show"` | 1134 | Show int `json:"show"` |
| 1135 | + Cover string `json:"cover"` //封面 | ||
| 1132 | } | 1136 | } |
| 1133 | 1137 | ||
| 1134 | type MiniGetArticleBackupRequest struct { | 1138 | type MiniGetArticleBackupRequest struct { |
| @@ -1147,6 +1151,7 @@ type MiniGetArticleBackupResponse struct { | @@ -1147,6 +1151,7 @@ type MiniGetArticleBackupResponse struct { | ||
| 1147 | Location Location `json:"location"` | 1151 | Location Location `json:"location"` |
| 1148 | Action string `json:"action"` | 1152 | Action string `json:"action"` |
| 1149 | Show int `json:"show"` | 1153 | Show int `json:"show"` |
| 1154 | + Cover string `json:"cover"` //封面 | ||
| 1150 | } | 1155 | } |
| 1151 | 1156 | ||
| 1152 | type MiniArticleMarkUserReadRequest struct { | 1157 | type MiniArticleMarkUserReadRequest struct { |
| @@ -1217,6 +1222,7 @@ type MiniArticleDraftItem struct { | @@ -1217,6 +1222,7 @@ type MiniArticleDraftItem struct { | ||
| 1217 | CreatedAt int64 `json:"createdAt"` // | 1222 | CreatedAt int64 `json:"createdAt"` // |
| 1218 | MatchUrl map[string]string `json:"matchUrl"` //匹配内容中的url文本 | 1223 | MatchUrl map[string]string `json:"matchUrl"` //匹配内容中的url文本 |
| 1219 | Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 | 1224 | Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 |
| 1225 | + Cover string `json:"cover"` //封面 | ||
| 1220 | } | 1226 | } |
| 1221 | 1227 | ||
| 1222 | type MiniArticleDraftGetMeRequest struct { | 1228 | type MiniArticleDraftGetMeRequest struct { |
| @@ -1236,6 +1242,7 @@ type MiniArticleDraftGetMeResponse struct { | @@ -1236,6 +1242,7 @@ type MiniArticleDraftGetMeResponse struct { | ||
| 1236 | Location Location `json:"location"` // 坐标 | 1242 | Location Location `json:"location"` // 坐标 |
| 1237 | MatchUrl map[string]string `json:"matchUrl"` // | 1243 | MatchUrl map[string]string `json:"matchUrl"` // |
| 1238 | Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 | 1244 | Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 |
| 1245 | + Cover string `json:"cover"` //封面 | ||
| 1239 | } | 1246 | } |
| 1240 | 1247 | ||
| 1241 | type MiniArticleDraftDeleteMeRequest struct { | 1248 | type MiniArticleDraftDeleteMeRequest struct { |
| @@ -1331,6 +1338,7 @@ type SystemArticleGetResponse struct { | @@ -1331,6 +1338,7 @@ type SystemArticleGetResponse struct { | ||
| 1331 | Show int `json:"show"` // 评论的展示状态(0显示、1不显示) | 1338 | Show int `json:"show"` // 评论的展示状态(0显示、1不显示) |
| 1332 | Tags []ArticleTagItem `json:"tags"` //标签 | 1339 | Tags []ArticleTagItem `json:"tags"` //标签 |
| 1333 | TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人] | 1340 | TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人] |
| 1341 | + Cover string `json:"cover"` //封面 | ||
| 1334 | } | 1342 | } |
| 1335 | 1343 | ||
| 1336 | type SystemArticleSearchRequest struct { | 1344 | type SystemArticleSearchRequest struct { |
| @@ -1355,6 +1363,7 @@ type SystemArticleSearch struct { | @@ -1355,6 +1363,7 @@ type SystemArticleSearch struct { | ||
| 1355 | Title string `json:"title"` //标题 | 1363 | Title string `json:"title"` //标题 |
| 1356 | AuthorId int64 `json:"authorId"` //发布人ID | 1364 | AuthorId int64 `json:"authorId"` //发布人ID |
| 1357 | Author string `json:"author"` //发布人 | 1365 | Author string `json:"author"` //发布人 |
| 1366 | + Cover string `json:"cover"` //封面 | ||
| 1358 | Images []string `json:"images"` //图片 | 1367 | Images []string `json:"images"` //图片 |
| 1359 | CreatedAt int64 `json:"createdAt"` //文章的创建日期 | 1368 | CreatedAt int64 `json:"createdAt"` //文章的创建日期 |
| 1360 | UpdatedAt int64 `json:"updatedAt"` //文章的编辑日期 | 1369 | UpdatedAt int64 `json:"updatedAt"` //文章的编辑日期 |
| @@ -1476,6 +1485,7 @@ type SystemArticleGetHistoryResponse struct { | @@ -1476,6 +1485,7 @@ type SystemArticleGetHistoryResponse struct { | ||
| 1476 | Location Location `json:"location"` // 定位坐标 | 1485 | Location Location `json:"location"` // 定位坐标 |
| 1477 | TargetUser int `json:"targetUser"` // 分发方式 [0分发给所有人、1分发给指定的人] | 1486 | TargetUser int `json:"targetUser"` // 分发方式 [0分发给所有人、1分发给指定的人] |
| 1478 | Tags []int64 `json:"tags"` // 标签 | 1487 | Tags []int64 `json:"tags"` // 标签 |
| 1488 | + Cover string `json:"cover"` //封面 | ||
| 1479 | } | 1489 | } |
| 1480 | 1490 | ||
| 1481 | type SystemArticleRestoreRequest struct { | 1491 | type SystemArticleRestoreRequest struct { |
| @@ -1535,6 +1545,7 @@ type MiniSearchArticleItem struct { | @@ -1535,6 +1545,7 @@ type MiniSearchArticleItem struct { | ||
| 1535 | Images []string `json:"images"` | 1545 | Images []string `json:"images"` |
| 1536 | CreatedAt int64 `json:"createdAt"` | 1546 | CreatedAt int64 `json:"createdAt"` |
| 1537 | MeReadFlag int `json:"meReadFlag"` //已读标识 [0:未读] [1:已读] | 1547 | MeReadFlag int `json:"meReadFlag"` //已读标识 [0:未读] [1:已读] |
| 1548 | + Cover string `json:"cover"` //封面 | ||
| 1538 | } | 1549 | } |
| 1539 | 1550 | ||
| 1540 | type SystemArticleDraftCreateRequest struct { | 1551 | type SystemArticleDraftCreateRequest struct { |
| @@ -1619,6 +1630,7 @@ type SystemArticleDraftSearch struct { | @@ -1619,6 +1630,7 @@ type SystemArticleDraftSearch struct { | ||
| 1619 | AuthorId int64 `json:"authorId"` //发布人id | 1630 | AuthorId int64 `json:"authorId"` //发布人id |
| 1620 | Author string `json:"author"` //发布人 | 1631 | Author string `json:"author"` //发布人 |
| 1621 | UpdatedAt int64 `json:"updatedAt"` //编辑时间 | 1632 | UpdatedAt int64 `json:"updatedAt"` //编辑时间 |
| 1633 | + Cover string `json:"cover"` //封面 | ||
| 1622 | } | 1634 | } |
| 1623 | 1635 | ||
| 1624 | type SystemArticleDraftDeleteRequest struct { | 1636 | type SystemArticleDraftDeleteRequest struct { |
| @@ -1659,6 +1671,7 @@ type SystemArticleDraftGetResponse struct { | @@ -1659,6 +1671,7 @@ type SystemArticleDraftGetResponse struct { | ||
| 1659 | MatchUrl map[string]string `json:"matchUrl,optional"` // 匹配文章内容中的url文本 | 1671 | MatchUrl map[string]string `json:"matchUrl,optional"` // 匹配文章内容中的url文本 |
| 1660 | Tags []int64 `json:"tags"` // 标签 | 1672 | Tags []int64 `json:"tags"` // 标签 |
| 1661 | Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 | 1673 | Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 |
| 1674 | + Cover string `json:"cover"` //封面 | ||
| 1662 | } | 1675 | } |
| 1663 | 1676 | ||
| 1664 | type SystemArticleSearchDeletedRequest struct { | 1677 | type SystemArticleSearchDeletedRequest struct { |
| @@ -35,6 +35,7 @@ type Article struct { | @@ -35,6 +35,7 @@ type Article struct { | ||
| 35 | Source int `gorm:"default:1"` // 来源 1-用户发布 2-运营发布 | 35 | Source int `gorm:"default:1"` // 来源 1-用户发布 2-运营发布 |
| 36 | Operator domain.Operator `gorm:"type:jsonb;serializer:json"` // 运营操作人 | 36 | Operator domain.Operator `gorm:"type:jsonb;serializer:json"` // 运营操作人 |
| 37 | DeletedType int `json:"deletedType"` // 删除类型 1-运营删除 2-用户删除 | 37 | DeletedType int `json:"deletedType"` // 删除类型 1-运营删除 2-用户删除 |
| 38 | + Cover string | ||
| 38 | } | 39 | } |
| 39 | 40 | ||
| 40 | func (m *Article) TableName() string { | 41 | func (m *Article) TableName() string { |
| @@ -35,6 +35,7 @@ type Article struct { | @@ -35,6 +35,7 @@ type Article struct { | ||
| 35 | Source int `gorm:"default:1"` // 来源 1-用户发布 2-运营发布 | 35 | Source int `gorm:"default:1"` // 来源 1-用户发布 2-运营发布 |
| 36 | Operator Operator `gorm:"type:jsonb;serializer:json"` // 运营操作人 | 36 | Operator Operator `gorm:"type:jsonb;serializer:json"` // 运营操作人 |
| 37 | DeletedType int `json:"deletedType"` // 删除类型 1-运营删除 2-用户删除 | 37 | DeletedType int `json:"deletedType"` // 删除类型 1-运营删除 2-用户删除 |
| 38 | + Cover string `json:"cover"` // 封面 | ||
| 38 | // ...more | 39 | // ...more |
| 39 | } | 40 | } |
| 40 | 41 | ||
| @@ -132,6 +133,8 @@ func (m *Article) SetSummary(sectionList []*ArticleSection) { | @@ -132,6 +133,8 @@ func (m *Article) SetSummary(sectionList []*ArticleSection) { | ||
| 132 | length = 50 | 133 | length = 50 |
| 133 | } | 134 | } |
| 134 | m.Summary = string(runeContent[0:length]) | 135 | m.Summary = string(runeContent[0:length]) |
| 136 | + // 设置封面 | ||
| 137 | + m.Cover = m.GetCoverWithSections(sectionList) | ||
| 135 | } | 138 | } |
| 136 | 139 | ||
| 137 | // GetSubscribeMessageTitle 获取订阅消息标题 超过20个字用... | 140 | // GetSubscribeMessageTitle 获取订阅消息标题 超过20个字用... |
| @@ -172,3 +175,28 @@ func (m *Article) WhoCanReview(userId int64) bool { | @@ -172,3 +175,28 @@ func (m *Article) WhoCanReview(userId int64) bool { | ||
| 172 | } | 175 | } |
| 173 | return false | 176 | return false |
| 174 | } | 177 | } |
| 178 | + | ||
| 179 | +func (m *Article) GetCover() string { | ||
| 180 | + if len(m.Cover) > 0 { | ||
| 181 | + return m.Cover | ||
| 182 | + } | ||
| 183 | + if len(m.Images) > 0 { | ||
| 184 | + return m.Images[0].Url | ||
| 185 | + } | ||
| 186 | + return "" | ||
| 187 | +} | ||
| 188 | + | ||
| 189 | +func (m *Article) GetCoverWithSections(list []*ArticleSection) string { | ||
| 190 | + if len(m.Cover) > 0 { | ||
| 191 | + return m.Cover | ||
| 192 | + } | ||
| 193 | + if len(m.Images) > 0 { | ||
| 194 | + return m.Images[0].Url | ||
| 195 | + } | ||
| 196 | + for _, sec := range list { | ||
| 197 | + if sec.ParagraphType == ParagraphTypeImages && len(sec.Images) > 0 { | ||
| 198 | + return sec.Images[0] | ||
| 199 | + } | ||
| 200 | + } | ||
| 201 | + return "" | ||
| 202 | +} |
| @@ -200,3 +200,15 @@ func (bk *ArticleBackup) MakeBackup(operator UserSimple, article *Article, secti | @@ -200,3 +200,15 @@ func (bk *ArticleBackup) MakeBackup(operator UserSimple, article *Article, secti | ||
| 200 | } | 200 | } |
| 201 | *bk = b | 201 | *bk = b |
| 202 | } | 202 | } |
| 203 | + | ||
| 204 | +func (m *ArticleBackup) GetCover() string { | ||
| 205 | + if len(m.Images) > 0 { | ||
| 206 | + return m.Images[0].Url | ||
| 207 | + } | ||
| 208 | + for _, sec := range m.Section { | ||
| 209 | + if sec.ParagraphType == ParagraphTypeImages && len(sec.Images) > 0 { | ||
| 210 | + return sec.Images[0] | ||
| 211 | + } | ||
| 212 | + } | ||
| 213 | + return "" | ||
| 214 | +} |
| @@ -35,3 +35,15 @@ type ArticleDraftRepository interface { | @@ -35,3 +35,15 @@ type ArticleDraftRepository interface { | ||
| 35 | FindOne(ctx context.Context, conn transaction.Conn, id int64) (*ArticleDraft, error) | 35 | FindOne(ctx context.Context, conn transaction.Conn, id int64) (*ArticleDraft, error) |
| 36 | Find(ctx context.Context, conn transaction.Conn, queryOptions map[string]interface{}) (int64, []*ArticleDraft, error) | 36 | Find(ctx context.Context, conn transaction.Conn, queryOptions map[string]interface{}) (int64, []*ArticleDraft, error) |
| 37 | } | 37 | } |
| 38 | + | ||
| 39 | +func (m *ArticleDraft) GetCover() string { | ||
| 40 | + if len(m.Images) > 0 { | ||
| 41 | + return m.Images[0].Url | ||
| 42 | + } | ||
| 43 | + for _, sec := range m.Section { | ||
| 44 | + if sec.ParagraphType == ParagraphTypeImages && len(sec.Images) > 0 { | ||
| 45 | + return sec.Images[0] | ||
| 46 | + } | ||
| 47 | + } | ||
| 48 | + return "" | ||
| 49 | +} |
| @@ -45,3 +45,15 @@ func (m *ArticleDraftOperation) Identify() interface{} { | @@ -45,3 +45,15 @@ func (m *ArticleDraftOperation) Identify() interface{} { | ||
| 45 | } | 45 | } |
| 46 | return m.Id | 46 | return m.Id |
| 47 | } | 47 | } |
| 48 | + | ||
| 49 | +func (m *ArticleDraftOperation) GetCover() string { | ||
| 50 | + if len(m.Images) > 0 { | ||
| 51 | + return m.Images[0].Url | ||
| 52 | + } | ||
| 53 | + for _, sec := range m.Section { | ||
| 54 | + if sec.ParagraphType == ParagraphTypeImages && len(sec.Images) > 0 { | ||
| 55 | + return sec.Images[0] | ||
| 56 | + } | ||
| 57 | + } | ||
| 58 | + return "" | ||
| 59 | +} |
| @@ -40,3 +40,9 @@ type SortArticleSection []*ArticleSection | @@ -40,3 +40,9 @@ type SortArticleSection []*ArticleSection | ||
| 40 | func (a SortArticleSection) Len() int { return len(a) } | 40 | func (a SortArticleSection) Len() int { return len(a) } |
| 41 | func (a SortArticleSection) Swap(i, j int) { a[i], a[j] = a[j], a[i] } | 41 | func (a SortArticleSection) Swap(i, j int) { a[i], a[j] = a[j], a[i] } |
| 42 | func (a SortArticleSection) Less(i, j int) bool { return a[i].SortBy < a[j].SortBy } | 42 | func (a SortArticleSection) Less(i, j int) bool { return a[i].SortBy < a[j].SortBy } |
| 43 | + | ||
| 44 | +const ( | ||
| 45 | + ParagraphTypeNone = 0 | ||
| 46 | + ParagraphTypeText = 1 | ||
| 47 | + ParagraphTypeImages = 2 | ||
| 48 | +) |
| @@ -5,4 +5,7 @@ alter table article_section add column paragraph_type int8; | @@ -5,4 +5,7 @@ alter table article_section add column paragraph_type int8; | ||
| 5 | alter table article_section add column images jsonb; | 5 | alter table article_section add column images jsonb; |
| 6 | update article_section set paragraph_type = 0; | 6 | update article_section set paragraph_type = 0; |
| 7 | 7 | ||
| 8 | -alter table article_draft_operation add column section jsonb; | ||
| 8 | +alter table article_draft_operation add column section jsonb; | ||
| 9 | + | ||
| 10 | +-- 文章封面 | ||
| 11 | +alter table article add column cover varchar(1024); |
-
请 注册 或 登录 后发表评论