正在显示
37 个修改的文件
包含
144 行增加
和
7 行删除
@@ -41,12 +41,16 @@ type ( | @@ -41,12 +41,16 @@ type ( | ||
41 | WhoReview []int64 `json:"whoReview,optional"` //谁可评论 | 41 | WhoReview []int64 `json:"whoReview,optional"` //谁可评论 |
42 | Location Location `json:"location,optional"` //定位坐标 | 42 | Location Location `json:"location,optional"` //定位坐标 |
43 | MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 | 43 | MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 |
44 | - | 44 | + Attachments []FileInfo `json:"attachments,optional"` // 附件 |
45 | Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 | 45 | Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 |
46 | } | 46 | } |
47 | MiniArticleCreateResponse { | 47 | MiniArticleCreateResponse { |
48 | Id int64 `json:"id"` | 48 | Id int64 `json:"id"` |
49 | } | 49 | } |
50 | + FileInfo struct { | ||
51 | + Name string `json:"name"` | ||
52 | + Url string `json:"url"` | ||
53 | + } | ||
50 | ) | 54 | ) |
51 | 55 | ||
52 | //小程序端查看文章的详情 | 56 | //小程序端查看文章的详情 |
@@ -78,6 +82,7 @@ type ( | @@ -78,6 +82,7 @@ type ( | ||
78 | Tags []string `json:"tags"` // 文章的标签 | 82 | Tags []string `json:"tags"` // 文章的标签 |
79 | MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 | 83 | MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 |
80 | Cover string `json:"cover"` //封面 | 84 | Cover string `json:"cover"` //封面 |
85 | + Attachments []FileInfo `json:"attachments,optional"` // 附件 | ||
81 | } | 86 | } |
82 | ArticleSection { | 87 | ArticleSection { |
83 | Id int64 `json:"id"` //段落id | 88 | Id int64 `json:"id"` //段落id |
@@ -118,6 +123,7 @@ type ( | @@ -118,6 +123,7 @@ type ( | ||
118 | IsDel int `json:"isDel"` //是否删除 1-删除 0-否 | 123 | IsDel int `json:"isDel"` //是否删除 1-删除 0-否 |
119 | DeletedType int `json:"deletedType"` //类型 1-运营删除 2-用户删除 | 124 | DeletedType int `json:"deletedType"` //类型 1-运营删除 2-用户删除 |
120 | Cover string `json:"cover"` //封面 | 125 | Cover string `json:"cover"` //封面 |
126 | + Attachments []FileInfo `json:"attachments,optional"` // 附件 | ||
121 | } | 127 | } |
122 | 128 | ||
123 | SystemArticleSearchMeRequest { | 129 | SystemArticleSearchMeRequest { |
@@ -219,6 +225,7 @@ type ( | @@ -219,6 +225,7 @@ type ( | ||
219 | Action string `json:"action"` | 225 | Action string `json:"action"` |
220 | Show int `json:"show"` | 226 | Show int `json:"show"` |
221 | Cover string `json:"cover"` //封面 | 227 | Cover string `json:"cover"` //封面 |
228 | + Attachments []FileInfo `json:"attachments,optional"` // 附件 | ||
222 | } | 229 | } |
223 | ) | 230 | ) |
224 | 231 | ||
@@ -239,6 +246,7 @@ type ( | @@ -239,6 +246,7 @@ type ( | ||
239 | Action string `json:"action"` | 246 | Action string `json:"action"` |
240 | Show int `json:"show"` | 247 | Show int `json:"show"` |
241 | Cover string `json:"cover"` //封面 | 248 | Cover string `json:"cover"` //封面 |
249 | + Attachments []FileInfo `json:"attachments,optional"` // 附件 | ||
242 | } | 250 | } |
243 | ) | 251 | ) |
244 | 252 | ||
@@ -272,6 +280,7 @@ type ( | @@ -272,6 +280,7 @@ type ( | ||
272 | MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 | 280 | MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 |
273 | 281 | ||
274 | Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 | 282 | Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 |
283 | + Attachments []FileInfo `json:"attachments,optional"` // 附件 | ||
275 | } | 284 | } |
276 | 285 | ||
277 | MiniArticleDraftCreateResponse { | 286 | MiniArticleDraftCreateResponse { |
@@ -293,7 +302,7 @@ type ( | @@ -293,7 +302,7 @@ type ( | ||
293 | WhoReview []int64 `json:"whoReview"` // 评论人 | 302 | WhoReview []int64 `json:"whoReview"` // 评论人 |
294 | Location Location `json:"location"` // 坐标 | 303 | Location Location `json:"location"` // 坐标 |
295 | MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 | 304 | MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 |
296 | - | 305 | + Attachments []FileInfo `json:"attachments,optional"` // 附件 |
297 | Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 | 306 | Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 |
298 | } | 307 | } |
299 | 308 | ||
@@ -325,6 +334,7 @@ type ( | @@ -325,6 +334,7 @@ type ( | ||
325 | MatchUrl map[string]string `json:"matchUrl"` //匹配内容中的url文本 | 334 | MatchUrl map[string]string `json:"matchUrl"` //匹配内容中的url文本 |
326 | Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 | 335 | Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 |
327 | Cover string `json:"cover"` //封面 | 336 | Cover string `json:"cover"` //封面 |
337 | + Attachments []FileInfo `json:"attachments,optional"` // 附件 | ||
328 | } | 338 | } |
329 | ) | 339 | ) |
330 | 340 | ||
@@ -348,6 +358,7 @@ type ( | @@ -348,6 +358,7 @@ type ( | ||
348 | MatchUrl map[string]string `json:"matchUrl"` // | 358 | MatchUrl map[string]string `json:"matchUrl"` // |
349 | Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 | 359 | Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 |
350 | Cover string `json:"cover"` //封面 | 360 | Cover string `json:"cover"` //封面 |
361 | + Attachments []FileInfo `json:"attachments,optional"` // 附件 | ||
351 | } | 362 | } |
352 | ) | 363 | ) |
353 | 364 | ||
@@ -454,6 +465,7 @@ type ( | @@ -454,6 +465,7 @@ type ( | ||
454 | Tags []ArticleTagItem `json:"tags"` //标签 | 465 | Tags []ArticleTagItem `json:"tags"` //标签 |
455 | TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人] | 466 | TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人] |
456 | Cover string `json:"cover"` //封面 | 467 | Cover string `json:"cover"` //封面 |
468 | + Attachments []FileInfo `json:"attachments,optional"` // 附件 | ||
457 | } | 469 | } |
458 | ) | 470 | ) |
459 | 471 | ||
@@ -491,6 +503,7 @@ type ( | @@ -491,6 +503,7 @@ type ( | ||
491 | TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人] | 503 | TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人] |
492 | Operator Operator `json:"operator"` //运营操作人 | 504 | Operator Operator `json:"operator"` //运营操作人 |
493 | Source int `json:"source"` //来源[1用户发布、2运营发布] | 505 | Source int `json:"source"` //来源[1用户发布、2运营发布] |
506 | + Attachments []FileInfo `json:"attachments,optional"` // 附件 | ||
494 | } | 507 | } |
495 | ) | 508 | ) |
496 | // 管理后台编辑文章 | 509 | // 管理后台编辑文章 |
@@ -509,6 +522,7 @@ type ( | @@ -509,6 +522,7 @@ type ( | ||
509 | TargetUser int `json:"targetUser"` // 分发方式 [0分发给所有人、1分发给指定的人] | 522 | TargetUser int `json:"targetUser"` // 分发方式 [0分发给所有人、1分发给指定的人] |
510 | Tags []int64 `json:"tags"` // 标签 | 523 | Tags []int64 `json:"tags"` // 标签 |
511 | AccessToken string `header:"x-mmm-accesstoken"` // 授权token | 524 | AccessToken string `header:"x-mmm-accesstoken"` // 授权token |
525 | + Attachments []FileInfo `json:"attachments,optional"` // 附件 | ||
512 | } | 526 | } |
513 | SystemArticleUpdateResponse { | 527 | SystemArticleUpdateResponse { |
514 | Id int64 `json:"id"` //id | 528 | Id int64 `json:"id"` //id |
@@ -538,7 +552,7 @@ type ( | @@ -538,7 +552,7 @@ type ( | ||
538 | MatchUrl map[string]string `json:"matchUrl,optional"` // 匹配文章内容中的url文本 | 552 | MatchUrl map[string]string `json:"matchUrl,optional"` // 匹配文章内容中的url文本 |
539 | ArticleDraftId int64 `json:"articleDraftId"` // 草稿ID | 553 | ArticleDraftId int64 `json:"articleDraftId"` // 草稿ID |
540 | AccessToken string `header:"x-mmm-accesstoken"` // 授权token | 554 | AccessToken string `header:"x-mmm-accesstoken"` // 授权token |
541 | - | 555 | + Attachments []FileInfo `json:"attachments,optional"` // 附件 |
542 | Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 | 556 | Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 |
543 | } | 557 | } |
544 | SystemArticleCreateResponse { | 558 | SystemArticleCreateResponse { |
@@ -610,6 +624,7 @@ type ( | @@ -610,6 +624,7 @@ type ( | ||
610 | TargetUser int `json:"targetUser"` // 分发方式 [0分发给所有人、1分发给指定的人] | 624 | TargetUser int `json:"targetUser"` // 分发方式 [0分发给所有人、1分发给指定的人] |
611 | Tags []int64 `json:"tags"` // 标签 | 625 | Tags []int64 `json:"tags"` // 标签 |
612 | Cover string `json:"cover"` //封面 | 626 | Cover string `json:"cover"` //封面 |
627 | + Attachments []FileInfo `json:"attachments,optional"` // 附件 | ||
613 | } | 628 | } |
614 | ) | 629 | ) |
615 | // 管理后台文章恢复 | 630 | // 管理后台文章恢复 |
@@ -676,6 +691,7 @@ type ( | @@ -676,6 +691,7 @@ type ( | ||
676 | CreatedAt int64 `json:"createdAt"` | 691 | CreatedAt int64 `json:"createdAt"` |
677 | MeReadFlag int `json:"meReadFlag"` //已读标识 [0:未读] [1:已读] | 692 | MeReadFlag int `json:"meReadFlag"` //已读标识 [0:未读] [1:已读] |
678 | Cover string `json:"cover"` //封面 | 693 | Cover string `json:"cover"` //封面 |
694 | + Attachments []FileInfo `json:"attachments,optional"` // 附件 | ||
679 | } | 695 | } |
680 | ) | 696 | ) |
681 | 697 | ||
@@ -694,6 +710,7 @@ type ( | @@ -694,6 +710,7 @@ type ( | ||
694 | Tags []int64 `json:"tags"` // 标签 | 710 | Tags []int64 `json:"tags"` // 标签 |
695 | AccessToken string `header:"x-mmm-accesstoken"` // 授权token | 711 | AccessToken string `header:"x-mmm-accesstoken"` // 授权token |
696 | Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 | 712 | Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 |
713 | + Attachments []FileInfo `json:"attachments,optional"` // 附件 | ||
697 | } | 714 | } |
698 | SystemArticleDraftCreateResponse { | 715 | SystemArticleDraftCreateResponse { |
699 | Id int64 `json:"id"` //ID | 716 | Id int64 `json:"id"` //ID |
@@ -726,6 +743,7 @@ type ( | @@ -726,6 +743,7 @@ type ( | ||
726 | Tags []int64 `json:"tags"` // 标签 | 743 | Tags []int64 `json:"tags"` // 标签 |
727 | AccessToken string `header:"x-mmm-accesstoken"` // 授权token | 744 | AccessToken string `header:"x-mmm-accesstoken"` // 授权token |
728 | Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 | 745 | Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 |
746 | + Attachments []FileInfo `json:"attachments,optional"` // 附件 | ||
729 | } | 747 | } |
730 | SystemArticleDraftUpdateResponse { | 748 | SystemArticleDraftUpdateResponse { |
731 | Id int64 `json:"id"` //ID | 749 | Id int64 `json:"id"` //ID |
@@ -766,6 +784,7 @@ type ( | @@ -766,6 +784,7 @@ type ( | ||
766 | Author string `json:"author"` //发布人 | 784 | Author string `json:"author"` //发布人 |
767 | UpdatedAt int64 `json:"updatedAt"` //编辑时间 | 785 | UpdatedAt int64 `json:"updatedAt"` //编辑时间 |
768 | Cover string `json:"cover"` //封面 | 786 | Cover string `json:"cover"` //封面 |
787 | + Attachments []FileInfo `json:"attachments,optional"` // 附件 | ||
769 | } | 788 | } |
770 | ) | 789 | ) |
771 | 790 | ||
@@ -811,6 +830,7 @@ type ( | @@ -811,6 +830,7 @@ type ( | ||
811 | Tags []int64 `json:"tags"` // 标签 | 830 | Tags []int64 `json:"tags"` // 标签 |
812 | Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 | 831 | Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 |
813 | Cover string `json:"cover"` //封面 | 832 | Cover string `json:"cover"` //封面 |
833 | + Attachments []FileInfo `json:"attachments,optional"` // 附件 | ||
814 | } | 834 | } |
815 | ) | 835 | ) |
816 | 836 |
@@ -237,6 +237,7 @@ type( | @@ -237,6 +237,7 @@ type( | ||
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 | Cover string `json:"cover"` //封面 |
240 | + Attachments []FileInfo `json:"attachments,optional"` // 附件 | ||
240 | } | 241 | } |
241 | MiniUserFollowedSearchRequest{ | 242 | MiniUserFollowedSearchRequest{ |
242 | Page int `json:"page,optional"` | 243 | Page int `json:"page,optional"` |
@@ -77,6 +77,7 @@ func (l *MiniArticleBackupSearchLogic) MiniArticleBackupSearch(req *types.MiniAr | @@ -77,6 +77,7 @@ func (l *MiniArticleBackupSearchLogic) MiniArticleBackupSearch(req *types.MiniAr | ||
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 | Cover: backupList[i].GetCover(), |
80 | + Attachments: NewTypesAttachments(backupList[i].Attachments), | ||
80 | } | 81 | } |
81 | //根据修改的内容替换展示内容 | 82 | //根据修改的内容替换展示内容 |
82 | changeFiled := []string{} | 83 | changeFiled := []string{} |
@@ -56,6 +56,7 @@ func NewArticle(article *domain.Article) types.ArticleSearchMe { | @@ -56,6 +56,7 @@ func NewArticle(article *domain.Article) types.ArticleSearchMe { | ||
56 | Id: article.Id, | 56 | Id: article.Id, |
57 | Title: article.Title, | 57 | Title: article.Title, |
58 | Images: article.GetImages(), | 58 | Images: article.GetImages(), |
59 | + Attachments: NewTypesAttachments(article.Attachments), | ||
59 | CreatedAt: article.CreatedAt, | 60 | CreatedAt: article.CreatedAt, |
60 | CountLove: article.CountLove, | 61 | CountLove: article.CountLove, |
61 | CountComment: article.CountComment, | 62 | CountComment: article.CountComment, |
@@ -46,6 +46,7 @@ func (l *MiniCreateArticleDraftLogic) MiniCreateArticleDraft(req *types.MiniArti | @@ -46,6 +46,7 @@ func (l *MiniCreateArticleDraftLogic) MiniCreateArticleDraft(req *types.MiniArti | ||
46 | AuthorId: req.AuthorId, | 46 | AuthorId: req.AuthorId, |
47 | Title: req.Title, | 47 | Title: req.Title, |
48 | Images: []domain.Image{}, | 48 | Images: []domain.Image{}, |
49 | + Attachments: NewDomainAttachments(req.Attachments), | ||
49 | WhoRead: req.WhoRead, | 50 | WhoRead: req.WhoRead, |
50 | WhoReview: req.WhoReview, | 51 | WhoReview: req.WhoReview, |
51 | Location: domain.Location{ | 52 | Location: domain.Location{ |
@@ -350,6 +350,7 @@ func (l *MiniCreateArticleLogic) MiniCreateArticleBak(req *types.MiniArticleCrea | @@ -350,6 +350,7 @@ func (l *MiniCreateArticleLogic) MiniCreateArticleBak(req *types.MiniArticleCrea | ||
350 | Author: articleAuthor, | 350 | Author: articleAuthor, |
351 | Title: req.Title, | 351 | Title: req.Title, |
352 | Images: images, | 352 | Images: images, |
353 | + Attachments: NewDomainAttachments(req.Attachments), | ||
353 | WhoRead: whoRead, | 354 | WhoRead: whoRead, |
354 | WhoReview: whoReview, | 355 | WhoReview: whoReview, |
355 | Location: domain.Location{ | 356 | Location: domain.Location{ |
@@ -439,3 +440,25 @@ func (l *MiniCreateArticleLogic) validateTextLimit(req *types.MiniArticleCreateR | @@ -439,3 +440,25 @@ func (l *MiniCreateArticleLogic) validateTextLimit(req *types.MiniArticleCreateR | ||
439 | } | 440 | } |
440 | return nil | 441 | return nil |
441 | } | 442 | } |
443 | + | ||
444 | +func NewDomainAttachments(from []types.FileInfo) []domain.FileInfo { | ||
445 | + var to = make([]domain.FileInfo, 0) | ||
446 | + lo.ForEach(from, func(item types.FileInfo, index int) { | ||
447 | + to = append(to, domain.FileInfo{ | ||
448 | + Name: item.Name, | ||
449 | + Url: item.Url, | ||
450 | + }) | ||
451 | + }) | ||
452 | + return to | ||
453 | +} | ||
454 | + | ||
455 | +func NewTypesAttachments(from []domain.FileInfo) []types.FileInfo { | ||
456 | + var to = make([]types.FileInfo, 0) | ||
457 | + lo.ForEach(from, func(item domain.FileInfo, index int) { | ||
458 | + to = append(to, types.FileInfo{ | ||
459 | + Name: item.Name, | ||
460 | + Url: item.Url, | ||
461 | + }) | ||
462 | + }) | ||
463 | + return to | ||
464 | +} |
@@ -57,6 +57,7 @@ func (l *MiniGetArticleBackupLogic) MiniGetArticleBackup(req *types.MiniGetArtic | @@ -57,6 +57,7 @@ func (l *MiniGetArticleBackupLogic) MiniGetArticleBackup(req *types.MiniGetArtic | ||
57 | Title: backupInfo.Title, | 57 | Title: backupInfo.Title, |
58 | Content: content.String(), | 58 | Content: content.String(), |
59 | Images: images, | 59 | Images: images, |
60 | + Attachments: NewTypesAttachments(backupInfo.Attachments), | ||
60 | Videos: videos, | 61 | Videos: videos, |
61 | CreatedAt: backupInfo.CreatedAt, | 62 | CreatedAt: backupInfo.CreatedAt, |
62 | Location: types.Location{ | 63 | Location: types.Location{ |
@@ -61,6 +61,7 @@ func (l *MiniGetArticleDraftMeLogic) MiniGetArticleDraftMe(req *types.MiniArticl | @@ -61,6 +61,7 @@ func (l *MiniGetArticleDraftMeLogic) MiniGetArticleDraftMe(req *types.MiniArticl | ||
61 | //Section: draftInfo.Content, | 61 | //Section: draftInfo.Content, |
62 | Title: draftInfo.Title, | 62 | Title: draftInfo.Title, |
63 | Images: []string{}, | 63 | Images: []string{}, |
64 | + Attachments: NewTypesAttachments(draftInfo.Attachments), | ||
64 | WhoRead: draftInfo.WhoRead, | 65 | WhoRead: draftInfo.WhoRead, |
65 | WhoReview: draftInfo.WhoReview, | 66 | WhoReview: draftInfo.WhoReview, |
66 | Location: types.Location{ | 67 | Location: types.Location{ |
@@ -130,6 +130,7 @@ func (l *MiniGetArticleLogic) MiniGetArticle(req *types.MiniArticleGetRequest) ( | @@ -130,6 +130,7 @@ func (l *MiniGetArticleLogic) MiniGetArticle(req *types.MiniArticleGetRequest) ( | ||
130 | CreatedAt: articleInfo.CreatedAt, | 130 | CreatedAt: articleInfo.CreatedAt, |
131 | Section: articleSection, | 131 | Section: articleSection, |
132 | Images: []string{}, | 132 | Images: []string{}, |
133 | + Attachments: NewTypesAttachments(articleInfo.Attachments), | ||
133 | WhoRead: articleInfo.WhoRead, | 134 | WhoRead: articleInfo.WhoRead, |
134 | WhoReview: articleInfo.WhoReview, | 135 | WhoReview: articleInfo.WhoReview, |
135 | Location: types.Location{ | 136 | Location: types.Location{ |
@@ -76,6 +76,7 @@ func (l *MiniSearchArticleDraftMeLogic) MiniSearchArticleDraftMe(req *types.Mini | @@ -76,6 +76,7 @@ func (l *MiniSearchArticleDraftMeLogic) MiniSearchArticleDraftMe(req *types.Mini | ||
76 | MatchUrl: draftList[i].MatchUrl, | 76 | MatchUrl: draftList[i].MatchUrl, |
77 | Paragraphs: paragraphs, | 77 | Paragraphs: paragraphs, |
78 | Cover: draftList[i].GetCover(), | 78 | Cover: draftList[i].GetCover(), |
79 | + Attachments: NewTypesAttachments(draftList[i].Attachments), | ||
79 | } | 80 | } |
80 | } | 81 | } |
81 | return resp, nil | 82 | return resp, nil |
@@ -74,6 +74,7 @@ func (l *MiniSearchArticlePageLogic) MiniSearchArticlePage(req *types.MiniSearch | @@ -74,6 +74,7 @@ func (l *MiniSearchArticlePageLogic) MiniSearchArticlePage(req *types.MiniSearch | ||
74 | Author: author.Name, | 74 | Author: author.Name, |
75 | Avatar: author.Avatar, | 75 | Avatar: author.Avatar, |
76 | Images: val.GetImages(), | 76 | Images: val.GetImages(), |
77 | + Attachments: NewTypesAttachments(val.Attachments), | ||
77 | CreatedAt: val.CreatedAt, | 78 | CreatedAt: val.CreatedAt, |
78 | MeReadFlag: 0, | 79 | MeReadFlag: 0, |
79 | Cover: val.GetCover(), | 80 | Cover: val.GetCover(), |
@@ -58,6 +58,7 @@ func (l *MiniUpdateArticleDraftLogic) MiniUpdateArticleDraft(req *types.MiniArti | @@ -58,6 +58,7 @@ func (l *MiniUpdateArticleDraftLogic) MiniUpdateArticleDraft(req *types.MiniArti | ||
58 | Url: val, | 58 | Url: val, |
59 | }) | 59 | }) |
60 | } | 60 | } |
61 | + draftInfo.Attachments = NewDomainAttachments(req.Attachments) | ||
61 | draftInfo.MatchUrl = make(map[string]string) | 62 | draftInfo.MatchUrl = make(map[string]string) |
62 | for k, v := range req.MatchUrl { | 63 | for k, v := range req.MatchUrl { |
63 | draftInfo.MatchUrl[k] = v | 64 | draftInfo.MatchUrl[k] = v |
@@ -42,6 +42,7 @@ func (l *SystemArticleGetHistoryLogic) SystemArticleGetHistory(req *types.System | @@ -42,6 +42,7 @@ func (l *SystemArticleGetHistoryLogic) SystemArticleGetHistory(req *types.System | ||
42 | CreatedAt: backup.CreatedAt, | 42 | CreatedAt: backup.CreatedAt, |
43 | Section: make([]types.ArticleSection, 0), | 43 | Section: make([]types.ArticleSection, 0), |
44 | Images: make([]string, 0), | 44 | Images: make([]string, 0), |
45 | + Attachments: NewTypesAttachments(backup.Attachments), | ||
45 | WhoRead: backup.WhoRead, | 46 | WhoRead: backup.WhoRead, |
46 | WhoReadInfo: make([]types.UserShowName, 0), | 47 | WhoReadInfo: make([]types.UserShowName, 0), |
47 | WhoReview: backup.WhoReview, | 48 | WhoReview: backup.WhoReview, |
@@ -64,6 +64,7 @@ func (l *SystemCreateArticleDraftLogic) SystemCreateArticleDraft(req *types.Syst | @@ -64,6 +64,7 @@ func (l *SystemCreateArticleDraftLogic) SystemCreateArticleDraft(req *types.Syst | ||
64 | Title: req.Title, | 64 | Title: req.Title, |
65 | Content: req.Content, | 65 | Content: req.Content, |
66 | Images: images, | 66 | Images: images, |
67 | + Attachments: NewDomainAttachments(req.Attachments), | ||
67 | Videos: videos, | 68 | Videos: videos, |
68 | TargetUser: domain.ArticleTarget(req.TargetUser), | 69 | TargetUser: domain.ArticleTarget(req.TargetUser), |
69 | WhoRead: req.WhoRead, | 70 | WhoRead: req.WhoRead, |
@@ -84,6 +84,7 @@ func (l *SystemCreateArticleLogic) SystemCreateArticle(req *types.SystemArticleC | @@ -84,6 +84,7 @@ func (l *SystemCreateArticleLogic) SystemCreateArticle(req *types.SystemArticleC | ||
84 | Author: articleAuthor, | 84 | Author: articleAuthor, |
85 | Title: req.Title, | 85 | Title: req.Title, |
86 | Images: images, | 86 | Images: images, |
87 | + Attachments: NewDomainAttachments(req.Attachments), | ||
87 | Videos: videos, | 88 | Videos: videos, |
88 | WhoRead: make([]int64, 0), | 89 | WhoRead: make([]int64, 0), |
89 | WhoReview: make([]int64, 0), | 90 | WhoReview: make([]int64, 0), |
@@ -73,6 +73,7 @@ func (l *SystemGetArticleDraftLogic) SystemGetArticleDraft(req *types.SystemArti | @@ -73,6 +73,7 @@ func (l *SystemGetArticleDraftLogic) SystemGetArticleDraft(req *types.SystemArti | ||
73 | Content: articleDraft.Content, | 73 | Content: articleDraft.Content, |
74 | AuthorId: articleDraft.AuthorId, | 74 | AuthorId: articleDraft.AuthorId, |
75 | Images: images, | 75 | Images: images, |
76 | + Attachments: NewTypesAttachments(articleDraft.Attachments), | ||
76 | Videos: videos, | 77 | Videos: videos, |
77 | TargetUser: int(articleDraft.TargetUser), | 78 | TargetUser: int(articleDraft.TargetUser), |
78 | WhoRead: articleDraft.WhoRead, | 79 | WhoRead: articleDraft.WhoRead, |
@@ -52,6 +52,7 @@ func (l *SystemGetArticleLogic) SystemGetArticle(req *types.SystemArticleGetRequ | @@ -52,6 +52,7 @@ func (l *SystemGetArticleLogic) SystemGetArticle(req *types.SystemArticleGetRequ | ||
52 | CreatedAt: article.CreatedAt, | 52 | CreatedAt: article.CreatedAt, |
53 | Section: make([]types.ArticleSection, 0), | 53 | Section: make([]types.ArticleSection, 0), |
54 | Images: images, | 54 | Images: images, |
55 | + Attachments: NewTypesAttachments(article.Attachments), | ||
55 | WhoRead: article.WhoRead, | 56 | WhoRead: article.WhoRead, |
56 | WhoReadInfo: make([]types.UserShowName, 0), | 57 | WhoReadInfo: make([]types.UserShowName, 0), |
57 | WhoReview: article.WhoReview, | 58 | WhoReview: article.WhoReview, |
@@ -73,6 +73,7 @@ func (l *SystemSearchArticleDraftLogic) SystemSearchArticleDraft(req *types.Syst | @@ -73,6 +73,7 @@ func (l *SystemSearchArticleDraftLogic) SystemSearchArticleDraft(req *types.Syst | ||
73 | Author: author, | 73 | Author: author, |
74 | UpdatedAt: item.UpdatedAt, | 74 | UpdatedAt: item.UpdatedAt, |
75 | Cover: item.GetCover(), | 75 | Cover: item.GetCover(), |
76 | + Attachments: NewTypesAttachments(item.Attachments), | ||
76 | }) | 77 | }) |
77 | }) | 78 | }) |
78 | return | 79 | return |
@@ -89,6 +89,7 @@ func (l *SystemSearchArticleLogic) SystemSearchArticle(req *types.SystemArticleS | @@ -89,6 +89,7 @@ func (l *SystemSearchArticleLogic) SystemSearchArticle(req *types.SystemArticleS | ||
89 | Name: item.Operator.Name, | 89 | Name: item.Operator.Name, |
90 | }, | 90 | }, |
91 | Cover: item.GetCover(), | 91 | Cover: item.GetCover(), |
92 | + Attachments: NewTypesAttachments(item.Attachments), | ||
92 | }) | 93 | }) |
93 | }) | 94 | }) |
94 | return | 95 | return |
@@ -51,6 +51,7 @@ func (l *SystemUpdateArticleDraftLogic) SystemUpdateArticleDraft(req *types.Syst | @@ -51,6 +51,7 @@ func (l *SystemUpdateArticleDraftLogic) SystemUpdateArticleDraft(req *types.Syst | ||
51 | return nil, xerr.NewErrMsg(err.Error()) | 51 | return nil, xerr.NewErrMsg(err.Error()) |
52 | } | 52 | } |
53 | articleDraft.Images = images | 53 | articleDraft.Images = images |
54 | + articleDraft.Attachments = NewDomainAttachments(req.Attachments) | ||
54 | //视频 | 55 | //视频 |
55 | videos, err := getVideos(req.Videos) | 56 | videos, err := getVideos(req.Videos) |
56 | if err != nil { | 57 | if err != nil { |
@@ -112,6 +112,7 @@ func (l *SystemUpdateArticleLogic) SystemUpdateArticle(req *types.SystemArticleU | @@ -112,6 +112,7 @@ func (l *SystemUpdateArticleLogic) SystemUpdateArticle(req *types.SystemArticleU | ||
112 | article.Title = req.Title | 112 | article.Title = req.Title |
113 | article.Version = article.Version + 1 | 113 | article.Version = article.Version + 1 |
114 | article.Images = images | 114 | article.Images = images |
115 | + article.Attachments = NewDomainAttachments(req.Attachments) | ||
115 | article.Videos = videos | 116 | article.Videos = videos |
116 | article.WhoRead = whoRead | 117 | article.WhoRead = whoRead |
117 | article.WhoReview = whoReview | 118 | article.WhoReview = whoReview |
@@ -63,6 +63,7 @@ func (l *MiniUserNewsLogic) MiniUserNews(req *types.MiniUserNewsRequest) (resp * | @@ -63,6 +63,7 @@ func (l *MiniUserNewsLogic) MiniUserNews(req *types.MiniUserNewsRequest) (resp * | ||
63 | Summary: item.Summary, | 63 | Summary: item.Summary, |
64 | Time: item.CreatedAt, | 64 | Time: item.CreatedAt, |
65 | Images: item.GetImages(), | 65 | Images: item.GetImages(), |
66 | + Attachments: types.NewTypesAttachments(item.Attachments), | ||
66 | ReadFlag: false, | 67 | ReadFlag: false, |
67 | Cover: item.GetCover(), | 68 | Cover: item.GetCover(), |
68 | } | 69 | } |
cmd/discuss/api/internal/types/other.go
0 → 100644
1 | +package types | ||
2 | + | ||
3 | +import ( | ||
4 | + "github.com/samber/lo" | ||
5 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" | ||
6 | +) | ||
7 | + | ||
8 | +func NewDomainAttachments(from []FileInfo) []domain.FileInfo { | ||
9 | + var to = make([]domain.FileInfo, 0) | ||
10 | + lo.ForEach(from, func(item FileInfo, index int) { | ||
11 | + to = append(to, domain.FileInfo{ | ||
12 | + Name: item.Name, | ||
13 | + Url: item.Url, | ||
14 | + }) | ||
15 | + }) | ||
16 | + return to | ||
17 | +} | ||
18 | + | ||
19 | +func NewTypesAttachments(from []domain.FileInfo) []FileInfo { | ||
20 | + var to = make([]FileInfo, 0) | ||
21 | + lo.ForEach(from, func(item domain.FileInfo, index int) { | ||
22 | + to = append(to, FileInfo{ | ||
23 | + Name: item.Name, | ||
24 | + Url: item.Url, | ||
25 | + }) | ||
26 | + }) | ||
27 | + return to | ||
28 | +} |
@@ -608,6 +608,7 @@ type UserNewsItem struct { | @@ -608,6 +608,7 @@ type UserNewsItem struct { | ||
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 | Cover string `json:"cover"` //封面 |
611 | + Attachments []FileInfo `json:"attachments,optional"` // 附件 | ||
611 | } | 612 | } |
612 | 613 | ||
613 | type MiniUserFollowedSearchRequest struct { | 614 | type MiniUserFollowedSearchRequest struct { |
@@ -967,6 +968,7 @@ type MiniArticleCreateRequest struct { | @@ -967,6 +968,7 @@ type MiniArticleCreateRequest struct { | ||
967 | WhoReview []int64 `json:"whoReview,optional"` //谁可评论 | 968 | WhoReview []int64 `json:"whoReview,optional"` //谁可评论 |
968 | Location Location `json:"location,optional"` //定位坐标 | 969 | Location Location `json:"location,optional"` //定位坐标 |
969 | MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 | 970 | MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 |
971 | + Attachments []FileInfo `json:"attachments,optional"` // 附件 | ||
970 | Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 | 972 | Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 |
971 | } | 973 | } |
972 | 974 | ||
@@ -974,6 +976,11 @@ type MiniArticleCreateResponse struct { | @@ -974,6 +976,11 @@ type MiniArticleCreateResponse struct { | ||
974 | Id int64 `json:"id"` | 976 | Id int64 `json:"id"` |
975 | } | 977 | } |
976 | 978 | ||
979 | +type FileInfo struct { | ||
980 | + Name string `json:"name"` | ||
981 | + Url string `json:"url"` | ||
982 | +} | ||
983 | + | ||
977 | type MiniArticleGetRequest struct { | 984 | type MiniArticleGetRequest struct { |
978 | Id int64 `path:"id"` //id | 985 | Id int64 `path:"id"` //id |
979 | CompanyId int64 `path:",optional"` //当前公司 | 986 | CompanyId int64 `path:",optional"` //当前公司 |
@@ -1002,6 +1009,7 @@ type MiniArticleGetResponse struct { | @@ -1002,6 +1009,7 @@ type MiniArticleGetResponse struct { | ||
1002 | Tags []string `json:"tags"` // 文章的标签 | 1009 | Tags []string `json:"tags"` // 文章的标签 |
1003 | MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 | 1010 | MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 |
1004 | Cover string `json:"cover"` //封面 | 1011 | Cover string `json:"cover"` //封面 |
1012 | + Attachments []FileInfo `json:"attachments,optional"` // 附件 | ||
1005 | } | 1013 | } |
1006 | 1014 | ||
1007 | type ArticleSection struct { | 1015 | type ArticleSection struct { |
@@ -1040,6 +1048,7 @@ type ArticleSearchMe struct { | @@ -1040,6 +1048,7 @@ type ArticleSearchMe struct { | ||
1040 | IsDel int `json:"isDel"` //是否删除 1-删除 0-否 | 1048 | IsDel int `json:"isDel"` //是否删除 1-删除 0-否 |
1041 | DeletedType int `json:"deletedType"` //类型 1-运营删除 2-用户删除 | 1049 | DeletedType int `json:"deletedType"` //类型 1-运营删除 2-用户删除 |
1042 | Cover string `json:"cover"` //封面 | 1050 | Cover string `json:"cover"` //封面 |
1051 | + Attachments []FileInfo `json:"attachments,optional"` // 附件 | ||
1043 | } | 1052 | } |
1044 | 1053 | ||
1045 | type SystemArticleSearchMeRequest struct { | 1054 | type SystemArticleSearchMeRequest struct { |
@@ -1133,6 +1142,7 @@ type MiniArticleBackupItem struct { | @@ -1133,6 +1142,7 @@ type MiniArticleBackupItem struct { | ||
1133 | Action string `json:"action"` | 1142 | Action string `json:"action"` |
1134 | Show int `json:"show"` | 1143 | Show int `json:"show"` |
1135 | Cover string `json:"cover"` //封面 | 1144 | Cover string `json:"cover"` //封面 |
1145 | + Attachments []FileInfo `json:"attachments,optional"` // 附件 | ||
1136 | } | 1146 | } |
1137 | 1147 | ||
1138 | type MiniGetArticleBackupRequest struct { | 1148 | type MiniGetArticleBackupRequest struct { |
@@ -1152,6 +1162,7 @@ type MiniGetArticleBackupResponse struct { | @@ -1152,6 +1162,7 @@ type MiniGetArticleBackupResponse struct { | ||
1152 | Action string `json:"action"` | 1162 | Action string `json:"action"` |
1153 | Show int `json:"show"` | 1163 | Show int `json:"show"` |
1154 | Cover string `json:"cover"` //封面 | 1164 | Cover string `json:"cover"` //封面 |
1165 | + Attachments []FileInfo `json:"attachments,optional"` // 附件 | ||
1155 | } | 1166 | } |
1156 | 1167 | ||
1157 | type MiniArticleMarkUserReadRequest struct { | 1168 | type MiniArticleMarkUserReadRequest struct { |
@@ -1176,6 +1187,7 @@ type MiniArticleDraftCreateRequest struct { | @@ -1176,6 +1187,7 @@ type MiniArticleDraftCreateRequest struct { | ||
1176 | Location Location `json:"location"` // 坐标 | 1187 | Location Location `json:"location"` // 坐标 |
1177 | MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 | 1188 | MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 |
1178 | Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 | 1189 | Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 |
1190 | + Attachments []FileInfo `json:"attachments,optional"` // 附件 | ||
1179 | } | 1191 | } |
1180 | 1192 | ||
1181 | type MiniArticleDraftCreateResponse struct { | 1193 | type MiniArticleDraftCreateResponse struct { |
@@ -1194,6 +1206,7 @@ type MiniArticleDraftUpdateRequest struct { | @@ -1194,6 +1206,7 @@ type MiniArticleDraftUpdateRequest struct { | ||
1194 | WhoReview []int64 `json:"whoReview"` // 评论人 | 1206 | WhoReview []int64 `json:"whoReview"` // 评论人 |
1195 | Location Location `json:"location"` // 坐标 | 1207 | Location Location `json:"location"` // 坐标 |
1196 | MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 | 1208 | MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 |
1209 | + Attachments []FileInfo `json:"attachments,optional"` // 附件 | ||
1197 | Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 | 1210 | Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 |
1198 | } | 1211 | } |
1199 | 1212 | ||
@@ -1223,6 +1236,7 @@ type MiniArticleDraftItem struct { | @@ -1223,6 +1236,7 @@ type MiniArticleDraftItem struct { | ||
1223 | MatchUrl map[string]string `json:"matchUrl"` //匹配内容中的url文本 | 1236 | MatchUrl map[string]string `json:"matchUrl"` //匹配内容中的url文本 |
1224 | Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 | 1237 | Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 |
1225 | Cover string `json:"cover"` //封面 | 1238 | Cover string `json:"cover"` //封面 |
1239 | + Attachments []FileInfo `json:"attachments,optional"` // 附件 | ||
1226 | } | 1240 | } |
1227 | 1241 | ||
1228 | type MiniArticleDraftGetMeRequest struct { | 1242 | type MiniArticleDraftGetMeRequest struct { |
@@ -1243,6 +1257,7 @@ type MiniArticleDraftGetMeResponse struct { | @@ -1243,6 +1257,7 @@ type MiniArticleDraftGetMeResponse struct { | ||
1243 | MatchUrl map[string]string `json:"matchUrl"` // | 1257 | MatchUrl map[string]string `json:"matchUrl"` // |
1244 | Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 | 1258 | Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 |
1245 | Cover string `json:"cover"` //封面 | 1259 | Cover string `json:"cover"` //封面 |
1260 | + Attachments []FileInfo `json:"attachments,optional"` // 附件 | ||
1246 | } | 1261 | } |
1247 | 1262 | ||
1248 | type MiniArticleDraftDeleteMeRequest struct { | 1263 | type MiniArticleDraftDeleteMeRequest struct { |
@@ -1339,6 +1354,7 @@ type SystemArticleGetResponse struct { | @@ -1339,6 +1354,7 @@ type SystemArticleGetResponse struct { | ||
1339 | Tags []ArticleTagItem `json:"tags"` //标签 | 1354 | Tags []ArticleTagItem `json:"tags"` //标签 |
1340 | TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人] | 1355 | TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人] |
1341 | Cover string `json:"cover"` //封面 | 1356 | Cover string `json:"cover"` //封面 |
1357 | + Attachments []FileInfo `json:"attachments,optional"` // 附件 | ||
1342 | } | 1358 | } |
1343 | 1359 | ||
1344 | type SystemArticleSearchRequest struct { | 1360 | type SystemArticleSearchRequest struct { |
@@ -1374,6 +1390,7 @@ type SystemArticleSearch struct { | @@ -1374,6 +1390,7 @@ type SystemArticleSearch struct { | ||
1374 | TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人] | 1390 | TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人] |
1375 | Operator Operator `json:"operator"` //运营操作人 | 1391 | Operator Operator `json:"operator"` //运营操作人 |
1376 | Source int `json:"source"` //来源[1用户发布、2运营发布] | 1392 | Source int `json:"source"` //来源[1用户发布、2运营发布] |
1393 | + Attachments []FileInfo `json:"attachments,optional"` // 附件 | ||
1377 | } | 1394 | } |
1378 | 1395 | ||
1379 | type SystemArticleUpdateRequest struct { | 1396 | type SystemArticleUpdateRequest struct { |
@@ -1389,6 +1406,7 @@ type SystemArticleUpdateRequest struct { | @@ -1389,6 +1406,7 @@ type SystemArticleUpdateRequest struct { | ||
1389 | TargetUser int `json:"targetUser"` // 分发方式 [0分发给所有人、1分发给指定的人] | 1406 | TargetUser int `json:"targetUser"` // 分发方式 [0分发给所有人、1分发给指定的人] |
1390 | Tags []int64 `json:"tags"` // 标签 | 1407 | Tags []int64 `json:"tags"` // 标签 |
1391 | AccessToken string `header:"x-mmm-accesstoken"` // 授权token | 1408 | AccessToken string `header:"x-mmm-accesstoken"` // 授权token |
1409 | + Attachments []FileInfo `json:"attachments,optional"` // 附件 | ||
1392 | } | 1410 | } |
1393 | 1411 | ||
1394 | type SystemArticleUpdateResponse struct { | 1412 | type SystemArticleUpdateResponse struct { |
@@ -1417,6 +1435,7 @@ type SystemArticleCreateRequest struct { | @@ -1417,6 +1435,7 @@ type SystemArticleCreateRequest struct { | ||
1417 | MatchUrl map[string]string `json:"matchUrl,optional"` // 匹配文章内容中的url文本 | 1435 | MatchUrl map[string]string `json:"matchUrl,optional"` // 匹配文章内容中的url文本 |
1418 | ArticleDraftId int64 `json:"articleDraftId"` // 草稿ID | 1436 | ArticleDraftId int64 `json:"articleDraftId"` // 草稿ID |
1419 | AccessToken string `header:"x-mmm-accesstoken"` // 授权token | 1437 | AccessToken string `header:"x-mmm-accesstoken"` // 授权token |
1438 | + Attachments []FileInfo `json:"attachments,optional"` // 附件 | ||
1420 | Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 | 1439 | Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 |
1421 | } | 1440 | } |
1422 | 1441 | ||
@@ -1486,6 +1505,7 @@ type SystemArticleGetHistoryResponse struct { | @@ -1486,6 +1505,7 @@ type SystemArticleGetHistoryResponse struct { | ||
1486 | TargetUser int `json:"targetUser"` // 分发方式 [0分发给所有人、1分发给指定的人] | 1505 | TargetUser int `json:"targetUser"` // 分发方式 [0分发给所有人、1分发给指定的人] |
1487 | Tags []int64 `json:"tags"` // 标签 | 1506 | Tags []int64 `json:"tags"` // 标签 |
1488 | Cover string `json:"cover"` //封面 | 1507 | Cover string `json:"cover"` //封面 |
1508 | + Attachments []FileInfo `json:"attachments,optional"` // 附件 | ||
1489 | } | 1509 | } |
1490 | 1510 | ||
1491 | type SystemArticleRestoreRequest struct { | 1511 | type SystemArticleRestoreRequest struct { |
@@ -1546,6 +1566,7 @@ type MiniSearchArticleItem struct { | @@ -1546,6 +1566,7 @@ type MiniSearchArticleItem struct { | ||
1546 | CreatedAt int64 `json:"createdAt"` | 1566 | CreatedAt int64 `json:"createdAt"` |
1547 | MeReadFlag int `json:"meReadFlag"` //已读标识 [0:未读] [1:已读] | 1567 | MeReadFlag int `json:"meReadFlag"` //已读标识 [0:未读] [1:已读] |
1548 | Cover string `json:"cover"` //封面 | 1568 | Cover string `json:"cover"` //封面 |
1569 | + Attachments []FileInfo `json:"attachments,optional"` // 附件 | ||
1549 | } | 1570 | } |
1550 | 1571 | ||
1551 | type SystemArticleDraftCreateRequest struct { | 1572 | type SystemArticleDraftCreateRequest struct { |
@@ -1561,6 +1582,7 @@ type SystemArticleDraftCreateRequest struct { | @@ -1561,6 +1582,7 @@ type SystemArticleDraftCreateRequest struct { | ||
1561 | Tags []int64 `json:"tags"` // 标签 | 1582 | Tags []int64 `json:"tags"` // 标签 |
1562 | AccessToken string `header:"x-mmm-accesstoken"` // 授权token | 1583 | AccessToken string `header:"x-mmm-accesstoken"` // 授权token |
1563 | Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 | 1584 | Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 |
1585 | + Attachments []FileInfo `json:"attachments,optional"` // 附件 | ||
1564 | } | 1586 | } |
1565 | 1587 | ||
1566 | type SystemArticleDraftCreateResponse struct { | 1588 | type SystemArticleDraftCreateResponse struct { |
@@ -1591,6 +1613,7 @@ type SystemArticleDraftUpdateRequest struct { | @@ -1591,6 +1613,7 @@ type SystemArticleDraftUpdateRequest struct { | ||
1591 | Tags []int64 `json:"tags"` // 标签 | 1613 | Tags []int64 `json:"tags"` // 标签 |
1592 | AccessToken string `header:"x-mmm-accesstoken"` // 授权token | 1614 | AccessToken string `header:"x-mmm-accesstoken"` // 授权token |
1593 | Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 | 1615 | Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 |
1616 | + Attachments []FileInfo `json:"attachments,optional"` // 附件 | ||
1594 | } | 1617 | } |
1595 | 1618 | ||
1596 | type SystemArticleDraftUpdateResponse struct { | 1619 | type SystemArticleDraftUpdateResponse struct { |
@@ -1631,6 +1654,7 @@ type SystemArticleDraftSearch struct { | @@ -1631,6 +1654,7 @@ type SystemArticleDraftSearch struct { | ||
1631 | Author string `json:"author"` //发布人 | 1654 | Author string `json:"author"` //发布人 |
1632 | UpdatedAt int64 `json:"updatedAt"` //编辑时间 | 1655 | UpdatedAt int64 `json:"updatedAt"` //编辑时间 |
1633 | Cover string `json:"cover"` //封面 | 1656 | Cover string `json:"cover"` //封面 |
1657 | + Attachments []FileInfo `json:"attachments,optional"` // 附件 | ||
1634 | } | 1658 | } |
1635 | 1659 | ||
1636 | type SystemArticleDraftDeleteRequest struct { | 1660 | type SystemArticleDraftDeleteRequest struct { |
@@ -1672,6 +1696,7 @@ type SystemArticleDraftGetResponse struct { | @@ -1672,6 +1696,7 @@ type SystemArticleDraftGetResponse struct { | ||
1672 | Tags []int64 `json:"tags"` // 标签 | 1696 | Tags []int64 `json:"tags"` // 标签 |
1673 | Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 | 1697 | Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落 |
1674 | Cover string `json:"cover"` //封面 | 1698 | Cover string `json:"cover"` //封面 |
1699 | + Attachments []FileInfo `json:"attachments,optional"` // 附件 | ||
1675 | } | 1700 | } |
1676 | 1701 | ||
1677 | type SystemArticleSearchDeletedRequest struct { | 1702 | type SystemArticleSearchDeletedRequest struct { |
@@ -36,6 +36,7 @@ type Article struct { | @@ -36,6 +36,7 @@ type Article struct { | ||
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 | Cover string |
39 | + Attachments []domain.FileInfo `gorm:"type:jsonb;serializer:json"` | ||
39 | } | 40 | } |
40 | 41 | ||
41 | func (m *Article) TableName() string { | 42 | func (m *Article) TableName() string { |
@@ -32,6 +32,7 @@ type ArticleBackup struct { | @@ -32,6 +32,7 @@ type ArticleBackup struct { | ||
32 | TargetUser int // 分发方式 0 分发给所有人 1 分发给指定的人 | 32 | TargetUser int // 分发方式 0 分发给所有人 1 分发给指定的人 |
33 | MatchUrl map[string]string `gorm:"type:jsonb;serializer:json"` // 匹配文章内容中的url文本 | 33 | MatchUrl map[string]string `gorm:"type:jsonb;serializer:json"` // 匹配文章内容中的url文本 |
34 | Show int | 34 | Show int |
35 | + Attachments []domain.FileInfo `gorm:"type:jsonb;serializer:json"` | ||
35 | } | 36 | } |
36 | 37 | ||
37 | func (m *ArticleBackup) TableName() string { | 38 | func (m *ArticleBackup) TableName() string { |
@@ -26,7 +26,7 @@ type ArticleDraft struct { | @@ -26,7 +26,7 @@ type ArticleDraft struct { | ||
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 | MatchUrl map[string]string `gorm:"type:jsonb;serializer:json"` // 匹配文章内容中的url文本 |
29 | - | 29 | + Attachments []domain.FileInfo `gorm:"type:jsonb;serializer:json"` |
30 | Section []*domain.ArticleSection `gorm:"type:jsonb;serializer:json"` | 30 | Section []*domain.ArticleSection `gorm:"type:jsonb;serializer:json"` |
31 | } | 31 | } |
32 | 32 |
@@ -29,7 +29,7 @@ type ArticleDraftOperation struct { | @@ -29,7 +29,7 @@ type ArticleDraftOperation struct { | ||
29 | UpdatedAt int64 `gorm:"comment:编辑时间"` // 编辑时间 | 29 | UpdatedAt int64 `gorm:"comment:编辑时间"` // 编辑时间 |
30 | IsDel soft_delete.DeletedAt `gorm:"softDelete:flag,DeletedAtField:DeletedAt"` // 删除标记 | 30 | IsDel soft_delete.DeletedAt `gorm:"softDelete:flag,DeletedAtField:DeletedAt"` // 删除标记 |
31 | DeletedAt int64 `gorm:"comment:删除时间"` // 删除时间 | 31 | DeletedAt int64 `gorm:"comment:删除时间"` // 删除时间 |
32 | - | 32 | + Attachments []domain.FileInfo `gorm:"type:jsonb;serializer:json"` |
33 | Section []*domain.ArticleSection `gorm:"type:jsonb;serializer:json"` // 分段内容 | 33 | Section []*domain.ArticleSection `gorm:"type:jsonb;serializer:json"` // 分段内容 |
34 | } | 34 | } |
35 | 35 |
@@ -178,6 +178,7 @@ func (repository *ArticleBackupRepository) ModelToDomainModel(from *models.Artic | @@ -178,6 +178,7 @@ func (repository *ArticleBackupRepository) ModelToDomainModel(from *models.Artic | ||
178 | ChangeField: from.ChangeField, | 178 | ChangeField: from.ChangeField, |
179 | Videos: from.Videos, | 179 | Videos: from.Videos, |
180 | Show: domain.ArticleShow(from.Show), | 180 | Show: domain.ArticleShow(from.Show), |
181 | + Attachments: from.Attachments, | ||
181 | } | 182 | } |
182 | // err := copier.Copy(to, from) | 183 | // err := copier.Copy(to, from) |
183 | return to, nil | 184 | return to, nil |
@@ -207,6 +208,7 @@ func (repository *ArticleBackupRepository) DomainModelToModel(from *domain.Artic | @@ -207,6 +208,7 @@ func (repository *ArticleBackupRepository) DomainModelToModel(from *domain.Artic | ||
207 | Videos: from.Videos, | 208 | Videos: from.Videos, |
208 | ChangeField: from.ChangeField, | 209 | ChangeField: from.ChangeField, |
209 | Show: int(from.Show), | 210 | Show: int(from.Show), |
211 | + Attachments: from.Attachments, | ||
210 | } | 212 | } |
211 | // err := copier.Copy(to, from) | 213 | // err := copier.Copy(to, from) |
212 | return to, nil | 214 | return to, nil |
@@ -162,6 +162,7 @@ func (repository *ArticleDraftRepository) ModelToDomainModel(from *models.Articl | @@ -162,6 +162,7 @@ func (repository *ArticleDraftRepository) ModelToDomainModel(from *models.Articl | ||
162 | Location: from.Location, | 162 | Location: from.Location, |
163 | MatchUrl: from.MatchUrl, | 163 | MatchUrl: from.MatchUrl, |
164 | Section: from.Section, | 164 | Section: from.Section, |
165 | + Attachments: from.Attachments, | ||
165 | } | 166 | } |
166 | // err := copier.Copy(to, from) | 167 | // err := copier.Copy(to, from) |
167 | return to, nil | 168 | return to, nil |
@@ -185,6 +186,7 @@ func (repository *ArticleDraftRepository) DomainModelToModel(from *domain.Articl | @@ -185,6 +186,7 @@ func (repository *ArticleDraftRepository) DomainModelToModel(from *domain.Articl | ||
185 | Location: from.Location, | 186 | Location: from.Location, |
186 | MatchUrl: from.MatchUrl, | 187 | MatchUrl: from.MatchUrl, |
187 | Section: from.Section, | 188 | Section: from.Section, |
189 | + Attachments: from.Attachments, | ||
188 | } | 190 | } |
189 | // err := copier.Copy(to, from) | 191 | // err := copier.Copy(to, from) |
190 | return to, nil | 192 | return to, nil |
@@ -452,6 +452,7 @@ func (repository *ArticleRepository) ModelToDomainModel(from *models.Article) (* | @@ -452,6 +452,7 @@ func (repository *ArticleRepository) ModelToDomainModel(from *models.Article) (* | ||
452 | DeletedType: from.DeletedType, | 452 | DeletedType: from.DeletedType, |
453 | IsDel: int(from.IsDel), | 453 | IsDel: int(from.IsDel), |
454 | Cover: from.Cover, | 454 | Cover: from.Cover, |
455 | + Attachments: from.Attachments, | ||
455 | } | 456 | } |
456 | return to, nil | 457 | return to, nil |
457 | } | 458 | } |
@@ -485,6 +486,7 @@ func (repository *ArticleRepository) DomainModelToModel(from *domain.Article) (* | @@ -485,6 +486,7 @@ func (repository *ArticleRepository) DomainModelToModel(from *domain.Article) (* | ||
485 | Operator: from.Operator, | 486 | Operator: from.Operator, |
486 | DeletedType: from.DeletedType, | 487 | DeletedType: from.DeletedType, |
487 | Cover: from.Cover, | 488 | Cover: from.Cover, |
489 | + Attachments: from.Attachments, | ||
488 | } | 490 | } |
489 | // err := copier.Copy(to, from) | 491 | // err := copier.Copy(to, from) |
490 | return to, nil | 492 | return to, nil |
@@ -36,9 +36,15 @@ type Article struct { | @@ -36,9 +36,15 @@ type Article struct { | ||
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 | Cover string `json:"cover"` // 封面 |
39 | + Attachments []FileInfo `json:"attachments"` // 附件 | ||
39 | // ...more | 40 | // ...more |
40 | } | 41 | } |
41 | 42 | ||
43 | +type FileInfo struct { | ||
44 | + Name string `json:"name"` | ||
45 | + Url string `json:"url"` | ||
46 | +} | ||
47 | + | ||
42 | type ArticleRepository interface { | 48 | type ArticleRepository interface { |
43 | Insert(ctx context.Context, conn transaction.Conn, dm *Article) (*Article, error) | 49 | Insert(ctx context.Context, conn transaction.Conn, dm *Article) (*Article, error) |
44 | Update(ctx context.Context, conn transaction.Conn, dm *Article) (*Article, error) | 50 | Update(ctx context.Context, conn transaction.Conn, dm *Article) (*Article, error) |
@@ -31,6 +31,7 @@ type ArticleBackup struct { | @@ -31,6 +31,7 @@ type ArticleBackup struct { | ||
31 | Tags []int64 `json:"tags"` // 标签 | 31 | Tags []int64 `json:"tags"` // 标签 |
32 | MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 | 32 | MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 |
33 | Show ArticleShow `json:"show"` // 评论的展示状态(1显示,2不显示、) | 33 | Show ArticleShow `json:"show"` // 评论的展示状态(1显示,2不显示、) |
34 | + Attachments []FileInfo `json:"attachments"` // 附件 | ||
34 | } | 35 | } |
35 | 36 | ||
36 | type ArticleBackupRepository interface { | 37 | type ArticleBackupRepository interface { |
@@ -24,8 +24,8 @@ type ArticleDraft struct { | @@ -24,8 +24,8 @@ type ArticleDraft struct { | ||
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 | MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本 |
27 | - | ||
28 | Section []*ArticleSection `json:"section"` // 分段内容 | 27 | Section []*ArticleSection `json:"section"` // 分段内容 |
28 | + Attachments []FileInfo `json:"attachments"` // 附件 | ||
29 | } | 29 | } |
30 | type ArticleDraftRepository interface { | 30 | type ArticleDraftRepository interface { |
31 | Insert(ctx context.Context, conn transaction.Conn, dm *ArticleDraft) (*ArticleDraft, error) | 31 | Insert(ctx context.Context, conn transaction.Conn, dm *ArticleDraft) (*ArticleDraft, error) |
@@ -28,6 +28,7 @@ type ArticleDraftOperation struct { | @@ -28,6 +28,7 @@ type ArticleDraftOperation struct { | ||
28 | IsDel soft_delete.DeletedAt `json:"isDel,omitempty"` // 删除标记 | 28 | IsDel soft_delete.DeletedAt `json:"isDel,omitempty"` // 删除标记 |
29 | DeletedAt int64 `json:"deletedAt,omitempty"` // 删除时间 | 29 | DeletedAt int64 `json:"deletedAt,omitempty"` // 删除时间 |
30 | Section []*ArticleSection `json:"section"` // 分段内容 | 30 | Section []*ArticleSection `json:"section"` // 分段内容 |
31 | + Attachments []FileInfo `json:"attachments"` // 附件 | ||
31 | } | 32 | } |
32 | 33 | ||
33 | type ArticleDraftOperationRepository interface { | 34 | type ArticleDraftOperationRepository interface { |
-
请 注册 或 登录 后发表评论