作者 yangfu

Merge branch 'dev' into test

@@ -258,7 +258,7 @@ type ( @@ -258,7 +258,7 @@ type (
258 MiniArticleDraftCreateRequest { 258 MiniArticleDraftCreateRequest {
259 CompanyId int64 `json:",optional"` 259 CompanyId int64 `json:",optional"`
260 AuthorId int64 `json:",optional"` // 发布人 260 AuthorId int64 `json:",optional"` // 发布人
261 - Template int `json:"template"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式 261 + Template int `json:"template"` // 使用哪个模板进行编辑 0、无 5、演绎式 3、归纳式 10、其他业务类型模板
262 Section []string `json:"section"` // 填写的内容 262 Section []string `json:"section"` // 填写的内容
263 Title string `json:"title"` // 标题 263 Title string `json:"title"` // 标题
264 Images []string `json:"images"` // 图片 264 Images []string `json:"images"` // 图片
@@ -319,6 +319,7 @@ type ( @@ -319,6 +319,7 @@ type (
319 Images []string `json:"images"` // 图片 319 Images []string `json:"images"` // 图片
320 CreatedAt int64 `json:"createdAt"`// 320 CreatedAt int64 `json:"createdAt"`//
321 MatchUrl map[string]string `json:"matchUrl"` //匹配内容中的url文本 321 MatchUrl map[string]string `json:"matchUrl"` //匹配内容中的url文本
  322 + Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落
322 } 323 }
323 ) 324 )
324 325
@@ -340,6 +341,7 @@ type ( @@ -340,6 +341,7 @@ type (
340 WhoReview []int64 `json:"whoReview"` // 评论人 341 WhoReview []int64 `json:"whoReview"` // 评论人
341 Location Location `json:"location"` // 坐标 342 Location Location `json:"location"` // 坐标
342 MatchUrl map[string]string `json:"matchUrl"` // 343 MatchUrl map[string]string `json:"matchUrl"` //
  344 + Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落
343 } 345 }
344 ) 346 )
345 347
@@ -681,6 +683,7 @@ type ( @@ -681,6 +683,7 @@ type (
681 MatchUrl map[string]string `json:"matchUrl,optional"` // 匹配文章内容中的url文本 683 MatchUrl map[string]string `json:"matchUrl,optional"` // 匹配文章内容中的url文本
682 Tags []int64 `json:"tags"` // 标签 684 Tags []int64 `json:"tags"` // 标签
683 AccessToken string `header:"x-mmm-accesstoken"` // 授权token 685 AccessToken string `header:"x-mmm-accesstoken"` // 授权token
  686 + Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落
684 } 687 }
685 SystemArticleDraftCreateResponse { 688 SystemArticleDraftCreateResponse {
686 Id int64 `json:"id"` //ID 689 Id int64 `json:"id"` //ID
@@ -712,6 +715,7 @@ type ( @@ -712,6 +715,7 @@ type (
712 MatchUrl map[string]string `json:"matchUrl,optional"` // 匹配文章内容中的url文本 715 MatchUrl map[string]string `json:"matchUrl,optional"` // 匹配文章内容中的url文本
713 Tags []int64 `json:"tags"` // 标签 716 Tags []int64 `json:"tags"` // 标签
714 AccessToken string `header:"x-mmm-accesstoken"` // 授权token 717 AccessToken string `header:"x-mmm-accesstoken"` // 授权token
  718 + Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落
715 } 719 }
716 SystemArticleDraftUpdateResponse { 720 SystemArticleDraftUpdateResponse {
717 Id int64 `json:"id"` //ID 721 Id int64 `json:"id"` //ID
@@ -794,6 +798,7 @@ type ( @@ -794,6 +798,7 @@ type (
794 WhoReviewInfo []UserShowName `json:"whoReviewInfo"` // 谁可评论 798 WhoReviewInfo []UserShowName `json:"whoReviewInfo"` // 谁可评论
795 MatchUrl map[string]string `json:"matchUrl,optional"` // 匹配文章内容中的url文本 799 MatchUrl map[string]string `json:"matchUrl,optional"` // 匹配文章内容中的url文本
796 Tags []int64 `json:"tags"` // 标签 800 Tags []int64 `json:"tags"` // 标签
  801 + Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落
797 } 802 }
798 ) 803 )
799 804
@@ -2,6 +2,9 @@ package article @@ -2,6 +2,9 @@ package article
2 2
3 import ( 3 import (
4 "context" 4 "context"
  5 + "github.com/samber/lo"
  6 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/core"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
5 8
6 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" 9 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
7 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" 10 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
@@ -37,10 +40,22 @@ func (l *MiniGetArticleDraftMeLogic) MiniGetArticleDraftMe(req *types.MiniArticl @@ -37,10 +40,22 @@ func (l *MiniGetArticleDraftMeLogic) MiniGetArticleDraftMe(req *types.MiniArticl
37 return nil, xerr.NewErrMsg("获取草稿失败") 40 return nil, xerr.NewErrMsg("获取草稿失败")
38 } 41 }
39 } 42 }
  43 +
  44 + var paragraphs = make([]types.Paragraph, 0)
  45 + lo.ForEach(draftInfo.Section, func(p *domain.ArticleSection, index int) {
  46 + paragraphs = append(paragraphs, core.NewTypesParagraph(p.ParagraphTemplate))
  47 + })
  48 +
  49 + if len(paragraphs) == 0 && len(draftInfo.Content) > 0 {
  50 + lo.ForEach(draftInfo.Content, func(item string, index int) {
  51 + paragraphs = append(paragraphs, core.NewNoneTypesParagraph(item))
  52 + })
  53 + }
  54 +
40 resp = &types.MiniArticleDraftGetMeResponse{ 55 resp = &types.MiniArticleDraftGetMeResponse{
41 Id: draftInfo.Id, 56 Id: draftInfo.Id,
42 Template: draftInfo.Template, 57 Template: draftInfo.Template,
43 - Section: draftInfo.Content, 58 + //Section: draftInfo.Content,
44 Title: draftInfo.Title, 59 Title: draftInfo.Title,
45 Images: []string{}, 60 Images: []string{},
46 WhoRead: draftInfo.WhoRead, 61 WhoRead: draftInfo.WhoRead,
@@ -51,6 +66,7 @@ func (l *MiniGetArticleDraftMeLogic) MiniGetArticleDraftMe(req *types.MiniArticl @@ -51,6 +66,7 @@ func (l *MiniGetArticleDraftMeLogic) MiniGetArticleDraftMe(req *types.MiniArticl
51 Descript: draftInfo.Location.Descript, 66 Descript: draftInfo.Location.Descript,
52 }, 67 },
53 MatchUrl: map[string]string{}, 68 MatchUrl: map[string]string{},
  69 + Paragraphs: paragraphs,
54 } 70 }
55 for k, v := range draftInfo.MatchUrl { 71 for k, v := range draftInfo.MatchUrl {
56 resp.MatchUrl[k] = v 72 resp.MatchUrl[k] = v
@@ -2,6 +2,8 @@ package article @@ -2,6 +2,8 @@ package article
2 2
3 import ( 3 import (
4 "context" 4 "context"
  5 + "github.com/samber/lo"
  6 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/core"
5 7
6 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" 8 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
7 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" 9 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
@@ -45,6 +47,18 @@ func (l *MiniSearchArticleDraftMeLogic) MiniSearchArticleDraftMe(req *types.Mini @@ -45,6 +47,18 @@ func (l *MiniSearchArticleDraftMeLogic) MiniSearchArticleDraftMe(req *types.Mini
45 } 47 }
46 48
47 for i := range draftList { 49 for i := range draftList {
  50 + draftInfo := draftList[i]
  51 + var paragraphs = make([]types.Paragraph, 0)
  52 + lo.ForEach(draftInfo.Section, func(p *domain.ArticleSection, index int) {
  53 + paragraphs = append(paragraphs, core.NewTypesParagraph(p.ParagraphTemplate))
  54 + })
  55 +
  56 + if len(paragraphs) == 0 && len(draftInfo.Content) > 0 {
  57 + lo.ForEach(draftInfo.Content, func(item string, index int) {
  58 + paragraphs = append(paragraphs, core.NewNoneTypesParagraph(item))
  59 + })
  60 + }
  61 +
48 images := []string{} 62 images := []string{}
49 for _, val := range draftList[i].Images { 63 for _, val := range draftList[i].Images {
50 images = append(images, val.Url) 64 images = append(images, val.Url)
@@ -52,11 +66,12 @@ func (l *MiniSearchArticleDraftMeLogic) MiniSearchArticleDraftMe(req *types.Mini @@ -52,11 +66,12 @@ func (l *MiniSearchArticleDraftMeLogic) MiniSearchArticleDraftMe(req *types.Mini
52 resp.List[i] = types.MiniArticleDraftItem{ 66 resp.List[i] = types.MiniArticleDraftItem{
53 Id: draftList[i].Id, 67 Id: draftList[i].Id,
54 Template: draftList[i].Template, 68 Template: draftList[i].Template,
55 - Section: draftList[i].Content, 69 + //Section: draftList[i].Content,
56 Title: draftList[i].Title, 70 Title: draftList[i].Title,
57 Images: images, 71 Images: images,
58 CreatedAt: draftList[i].CreatedAt, 72 CreatedAt: draftList[i].CreatedAt,
59 MatchUrl: draftList[i].MatchUrl, 73 MatchUrl: draftList[i].MatchUrl,
  74 + Paragraphs: paragraphs,
60 } 75 }
61 } 76 }
62 return resp, nil 77 return resp, nil
@@ -75,6 +75,7 @@ func (l *SystemCreateArticleDraftLogic) SystemCreateArticleDraft(req *types.Syst @@ -75,6 +75,7 @@ func (l *SystemCreateArticleDraftLogic) SystemCreateArticleDraft(req *types.Syst
75 Name: userMe.User.NickName, 75 Name: userMe.User.NickName,
76 }, 76 },
77 Tags: req.Tags, 77 Tags: req.Tags,
  78 + Section: NewArticleSectionFromParagraphs(req.Paragraphs, companyInfo.Id, 0),
78 } 79 }
79 err = transaction.UseTrans(l.ctx, l.conn.DB(), func(ctx context.Context, conn transaction.Conn) error { 80 err = transaction.UseTrans(l.ctx, l.conn.DB(), func(ctx context.Context, conn transaction.Conn) error {
80 _, err := l.svcCtx.ArticleDraftOperationRepository.Insert(ctx, conn, articleDraft) 81 _, err := l.svcCtx.ArticleDraftOperationRepository.Insert(ctx, conn, articleDraft)
@@ -3,6 +3,7 @@ package article @@ -3,6 +3,7 @@ package article
3 import ( 3 import (
4 "context" 4 "context"
5 "github.com/samber/lo" 5 "github.com/samber/lo"
  6 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/core"
6 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction" 7 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction"
7 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" 8 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
8 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata" 9 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
@@ -57,6 +58,15 @@ func (l *SystemGetArticleDraftLogic) SystemGetArticleDraft(req *types.SystemArti @@ -57,6 +58,15 @@ func (l *SystemGetArticleDraftLogic) SystemGetArticleDraft(req *types.SystemArti
57 Height: video.Height, 58 Height: video.Height,
58 }) 59 })
59 }) 60 })
  61 +
  62 + var paragraphs = make([]types.Paragraph, 0)
  63 + lo.ForEach(articleDraft.Section, func(p *domain.ArticleSection, index int) {
  64 + paragraphs = append(paragraphs, core.NewTypesParagraph(p.ParagraphTemplate))
  65 + })
  66 +
  67 + if len(paragraphs) == 0 && len(articleDraft.Content) > 0 {
  68 + paragraphs = append(paragraphs, core.NewNoneTypesParagraph(articleDraft.Content))
  69 + }
60 resp = &types.SystemArticleDraftGetResponse{ 70 resp = &types.SystemArticleDraftGetResponse{
61 Id: articleDraft.Id, 71 Id: articleDraft.Id,
62 Title: articleDraft.Title, 72 Title: articleDraft.Title,
@@ -68,6 +68,7 @@ func (l *SystemUpdateArticleDraftLogic) SystemUpdateArticleDraft(req *types.Syst @@ -68,6 +68,7 @@ func (l *SystemUpdateArticleDraftLogic) SystemUpdateArticleDraft(req *types.Syst
68 Id: userToken.UserId, 68 Id: userToken.UserId,
69 Name: userMe.User.NickName, 69 Name: userMe.User.NickName,
70 } 70 }
  71 + articleDraft.Section = NewArticleSectionFromParagraphs(req.Paragraphs, articleDraft.CompanyId, 0)
71 err = transaction.UseTrans(l.ctx, l.conn.DB(), func(ctx context.Context, conn transaction.Conn) error { 72 err = transaction.UseTrans(l.ctx, l.conn.DB(), func(ctx context.Context, conn transaction.Conn) error {
72 _, err := l.svcCtx.ArticleDraftOperationRepository.Update(ctx, conn, articleDraft) 73 _, err := l.svcCtx.ArticleDraftOperationRepository.Update(ctx, conn, articleDraft)
73 if err != nil { 74 if err != nil {
@@ -30,3 +30,14 @@ func NewTypesParagraph(item domain.Paragraph) types.Paragraph { @@ -30,3 +30,14 @@ func NewTypesParagraph(item domain.Paragraph) types.Paragraph {
30 Type: item.Type, 30 Type: item.Type,
31 } 31 }
32 } 32 }
  33 +
  34 +func NewNoneTypesParagraph(item string) types.Paragraph {
  35 + return types.Paragraph{
  36 + ID: "",
  37 + Title: "",
  38 + Prompt: "",
  39 + Required: false,
  40 + Type: 0,
  41 + Text: item,
  42 + }
  43 +}
@@ -1162,7 +1162,7 @@ type MiniArticleMarkUserReadResponse struct { @@ -1162,7 +1162,7 @@ type MiniArticleMarkUserReadResponse struct {
1162 type MiniArticleDraftCreateRequest struct { 1162 type MiniArticleDraftCreateRequest struct {
1163 CompanyId int64 `json:",optional"` 1163 CompanyId int64 `json:",optional"`
1164 AuthorId int64 `json:",optional"` // 发布人 1164 AuthorId int64 `json:",optional"` // 发布人
1165 - Template int `json:"template"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式 1165 + Template int `json:"template"` // 使用哪个模板进行编辑 0、无 5、演绎式 3、归纳式 10、其他业务类型模板
1166 Section []string `json:"section"` // 填写的内容 1166 Section []string `json:"section"` // 填写的内容
1167 Title string `json:"title"` // 标题 1167 Title string `json:"title"` // 标题
1168 Images []string `json:"images"` // 图片 1168 Images []string `json:"images"` // 图片
@@ -1216,6 +1216,7 @@ type MiniArticleDraftItem struct { @@ -1216,6 +1216,7 @@ type MiniArticleDraftItem struct {
1216 Images []string `json:"images"` // 图片 1216 Images []string `json:"images"` // 图片
1217 CreatedAt int64 `json:"createdAt"` // 1217 CreatedAt int64 `json:"createdAt"` //
1218 MatchUrl map[string]string `json:"matchUrl"` //匹配内容中的url文本 1218 MatchUrl map[string]string `json:"matchUrl"` //匹配内容中的url文本
  1219 + Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落
1219 } 1220 }
1220 1221
1221 type MiniArticleDraftGetMeRequest struct { 1222 type MiniArticleDraftGetMeRequest struct {
@@ -1234,6 +1235,7 @@ type MiniArticleDraftGetMeResponse struct { @@ -1234,6 +1235,7 @@ type MiniArticleDraftGetMeResponse struct {
1234 WhoReview []int64 `json:"whoReview"` // 评论人 1235 WhoReview []int64 `json:"whoReview"` // 评论人
1235 Location Location `json:"location"` // 坐标 1236 Location Location `json:"location"` // 坐标
1236 MatchUrl map[string]string `json:"matchUrl"` // 1237 MatchUrl map[string]string `json:"matchUrl"` //
  1238 + Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落
1237 } 1239 }
1238 1240
1239 type MiniArticleDraftDeleteMeRequest struct { 1241 type MiniArticleDraftDeleteMeRequest struct {
@@ -1547,6 +1549,7 @@ type SystemArticleDraftCreateRequest struct { @@ -1547,6 +1549,7 @@ type SystemArticleDraftCreateRequest struct {
1547 MatchUrl map[string]string `json:"matchUrl,optional"` // 匹配文章内容中的url文本 1549 MatchUrl map[string]string `json:"matchUrl,optional"` // 匹配文章内容中的url文本
1548 Tags []int64 `json:"tags"` // 标签 1550 Tags []int64 `json:"tags"` // 标签
1549 AccessToken string `header:"x-mmm-accesstoken"` // 授权token 1551 AccessToken string `header:"x-mmm-accesstoken"` // 授权token
  1552 + Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落
1550 } 1553 }
1551 1554
1552 type SystemArticleDraftCreateResponse struct { 1555 type SystemArticleDraftCreateResponse struct {
@@ -1576,6 +1579,7 @@ type SystemArticleDraftUpdateRequest struct { @@ -1576,6 +1579,7 @@ type SystemArticleDraftUpdateRequest struct {
1576 MatchUrl map[string]string `json:"matchUrl,optional"` // 匹配文章内容中的url文本 1579 MatchUrl map[string]string `json:"matchUrl,optional"` // 匹配文章内容中的url文本
1577 Tags []int64 `json:"tags"` // 标签 1580 Tags []int64 `json:"tags"` // 标签
1578 AccessToken string `header:"x-mmm-accesstoken"` // 授权token 1581 AccessToken string `header:"x-mmm-accesstoken"` // 授权token
  1582 + Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落
1579 } 1583 }
1580 1584
1581 type SystemArticleDraftUpdateResponse struct { 1585 type SystemArticleDraftUpdateResponse struct {
@@ -1654,6 +1658,7 @@ type SystemArticleDraftGetResponse struct { @@ -1654,6 +1658,7 @@ type SystemArticleDraftGetResponse struct {
1654 WhoReviewInfo []UserShowName `json:"whoReviewInfo"` // 谁可评论 1658 WhoReviewInfo []UserShowName `json:"whoReviewInfo"` // 谁可评论
1655 MatchUrl map[string]string `json:"matchUrl,optional"` // 匹配文章内容中的url文本 1659 MatchUrl map[string]string `json:"matchUrl,optional"` // 匹配文章内容中的url文本
1656 Tags []int64 `json:"tags"` // 标签 1660 Tags []int64 `json:"tags"` // 标签
  1661 + Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落
1657 } 1662 }
1658 1663
1659 type SystemArticleSearchDeletedRequest struct { 1664 type SystemArticleSearchDeletedRequest struct {
@@ -27,7 +27,7 @@ type ArticleDraft struct { @@ -27,7 +27,7 @@ type ArticleDraft struct {
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
30 - Section []domain.ArticleSection `gorm:"type:jsonb;serializer:json"` 30 + Section []*domain.ArticleSection `gorm:"type:jsonb;serializer:json"`
31 } 31 }
32 32
33 func (m *ArticleDraft) TableName() string { 33 func (m *ArticleDraft) TableName() string {
@@ -29,6 +29,8 @@ type ArticleDraftOperation struct { @@ -29,6 +29,8 @@ 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 +
  33 + Section []*domain.ArticleSection `gorm:"type:jsonb;serializer:json"` // 分段内容
32 } 34 }
33 35
34 func (m *ArticleDraftOperation) TableName() string { 36 func (m *ArticleDraftOperation) TableName() string {
@@ -161,6 +161,7 @@ func (repository *ArticleDraftRepository) ModelToDomainModel(from *models.Articl @@ -161,6 +161,7 @@ func (repository *ArticleDraftRepository) ModelToDomainModel(from *models.Articl
161 WhoReview: from.WhoReview, 161 WhoReview: from.WhoReview,
162 Location: from.Location, 162 Location: from.Location,
163 MatchUrl: from.MatchUrl, 163 MatchUrl: from.MatchUrl,
  164 + Section: from.Section,
164 } 165 }
165 // err := copier.Copy(to, from) 166 // err := copier.Copy(to, from)
166 return to, nil 167 return to, nil
@@ -183,6 +184,7 @@ func (repository *ArticleDraftRepository) DomainModelToModel(from *domain.Articl @@ -183,6 +184,7 @@ func (repository *ArticleDraftRepository) DomainModelToModel(from *domain.Articl
183 WhoReview: from.WhoReview, 184 WhoReview: from.WhoReview,
184 Location: from.Location, 185 Location: from.Location,
185 MatchUrl: from.MatchUrl, 186 MatchUrl: from.MatchUrl,
  187 + Section: from.Section,
186 } 188 }
187 // err := copier.Copy(to, from) 189 // err := copier.Copy(to, from)
188 return to, nil 190 return to, nil
@@ -27,6 +27,7 @@ type ArticleDraftOperation struct { @@ -27,6 +27,7 @@ type ArticleDraftOperation struct {
27 UpdatedAt int64 `json:"updatedAt,omitempty"` // 编辑时间 27 UpdatedAt int64 `json:"updatedAt,omitempty"` // 编辑时间
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 } 31 }
31 32
32 type ArticleDraftOperationRepository interface { 33 type ArticleDraftOperationRepository interface {
@@ -8,19 +8,19 @@ import ( @@ -8,19 +8,19 @@ import (
8 8
9 // 文章段落内容 9 // 文章段落内容
10 type ArticleSection struct { 10 type ArticleSection struct {
11 - Id int64 `json:"id"`  
12 - CompanyId int64 `json:"companyId"` 11 + Id int64 `json:"id,omitempty"`
  12 + CompanyId int64 `json:"companyId,omitempty"`
13 CreatedAt int64 `json:"createdAt,omitempty"` 13 CreatedAt int64 `json:"createdAt,omitempty"`
14 UpdatedAt int64 `json:"updatedAt,omitempty"` 14 UpdatedAt int64 `json:"updatedAt,omitempty"`
15 DeletedAt int64 `json:"deletedAt,omitempty"` 15 DeletedAt int64 `json:"deletedAt,omitempty"`
16 Version int `json:"version,omitempty"` 16 Version int `json:"version,omitempty"`
17 - ArticleId int64 `json:"articleId"` // 文章id  
18 - Content string `json:"content"` // 文本内容  
19 - SortBy int `json:"sortBy"` // 排序  
20 - TotalComment int `json:"totalComment"` // 评论的数量  
21 - Images []string `json:"images"` // 照片列表  
22 - ParagraphType int `json:"paragraphType"` // 段落类型 1:文本 2:图片  
23 - ParagraphTemplate Paragraph `json:"paragraphTemplate"` // 段落模板 17 + ArticleId int64 `json:"articleId,omitempty"` // 文章id
  18 + Content string `json:"content,omitempty"` // 文本内容
  19 + SortBy int `json:"sortBy,omitempty"` // 排序
  20 + TotalComment int `json:"totalComment,omitempty"` // 评论的数量
  21 + Images []string `json:"images,omitempty"` // 照片列表
  22 + ParagraphType int `json:"paragraphType,omitempty"` // 段落类型 1:文本 2:图片
  23 + ParagraphTemplate Paragraph `json:"paragraphTemplate,omitempty"` // 段落模板
24 } 24 }
25 25
26 type ArticleSectionRepository interface { 26 type ArticleSectionRepository interface {
@@ -4,3 +4,5 @@ alter table article_section add column paragraph_template jsonb; @@ -4,3 +4,5 @@ alter table article_section add column paragraph_template jsonb;
4 alter table article_section add column paragraph_type int8; 4 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 +
  8 +alter table article_draft_operation add column section jsonb;