作者 yangfu

feat: 附件

正在显示 37 个修改的文件 包含 144 行增加7 行删除
... ... @@ -56,7 +56,7 @@ func main() {
}
// 服务启动
logx.Infof("Starting server at %s:%d... \n", c.Host, c.Port)
logx.Infof("Starting server version 1.0.4 at %s:%d... \n", c.Host, c.Port)
server.Start()
}
... ...
... ... @@ -41,12 +41,16 @@ type (
WhoReview []int64 `json:"whoReview,optional"` //谁可评论
Location Location `json:"location,optional"` //定位坐标
MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本
Attachments []FileInfo `json:"attachments,optional"` // 附件
Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落
}
MiniArticleCreateResponse {
Id int64 `json:"id"`
}
FileInfo struct {
Name string `json:"name"`
Url string `json:"url"`
}
)
//小程序端查看文章的详情
... ... @@ -78,6 +82,7 @@ type (
Tags []string `json:"tags"` // 文章的标签
MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本
Cover string `json:"cover"` //封面
Attachments []FileInfo `json:"attachments,optional"` // 附件
}
ArticleSection {
Id int64 `json:"id"` //段落id
... ... @@ -118,6 +123,7 @@ type (
IsDel int `json:"isDel"` //是否删除 1-删除 0-否
DeletedType int `json:"deletedType"` //类型 1-运营删除 2-用户删除
Cover string `json:"cover"` //封面
Attachments []FileInfo `json:"attachments,optional"` // 附件
}
SystemArticleSearchMeRequest {
... ... @@ -219,6 +225,7 @@ type (
Action string `json:"action"`
Show int `json:"show"`
Cover string `json:"cover"` //封面
Attachments []FileInfo `json:"attachments,optional"` // 附件
}
)
... ... @@ -239,6 +246,7 @@ type (
Action string `json:"action"`
Show int `json:"show"`
Cover string `json:"cover"` //封面
Attachments []FileInfo `json:"attachments,optional"` // 附件
}
)
... ... @@ -272,6 +280,7 @@ type (
MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本
Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落
Attachments []FileInfo `json:"attachments,optional"` // 附件
}
MiniArticleDraftCreateResponse {
... ... @@ -293,7 +302,7 @@ type (
WhoReview []int64 `json:"whoReview"` // 评论人
Location Location `json:"location"` // 坐标
MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本
Attachments []FileInfo `json:"attachments,optional"` // 附件
Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落
}
... ... @@ -325,6 +334,7 @@ type (
MatchUrl map[string]string `json:"matchUrl"` //匹配内容中的url文本
Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落
Cover string `json:"cover"` //封面
Attachments []FileInfo `json:"attachments,optional"` // 附件
}
)
... ... @@ -348,6 +358,7 @@ type (
MatchUrl map[string]string `json:"matchUrl"` //
Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落
Cover string `json:"cover"` //封面
Attachments []FileInfo `json:"attachments,optional"` // 附件
}
)
... ... @@ -454,6 +465,7 @@ type (
Tags []ArticleTagItem `json:"tags"` //标签
TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人]
Cover string `json:"cover"` //封面
Attachments []FileInfo `json:"attachments,optional"` // 附件
}
)
... ... @@ -491,6 +503,7 @@ type (
TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人]
Operator Operator `json:"operator"` //运营操作人
Source int `json:"source"` //来源[1用户发布、2运营发布]
Attachments []FileInfo `json:"attachments,optional"` // 附件
}
)
// 管理后台编辑文章
... ... @@ -509,6 +522,7 @@ type (
TargetUser int `json:"targetUser"` // 分发方式 [0分发给所有人、1分发给指定的人]
Tags []int64 `json:"tags"` // 标签
AccessToken string `header:"x-mmm-accesstoken"` // 授权token
Attachments []FileInfo `json:"attachments,optional"` // 附件
}
SystemArticleUpdateResponse {
Id int64 `json:"id"` //id
... ... @@ -538,7 +552,7 @@ type (
MatchUrl map[string]string `json:"matchUrl,optional"` // 匹配文章内容中的url文本
ArticleDraftId int64 `json:"articleDraftId"` // 草稿ID
AccessToken string `header:"x-mmm-accesstoken"` // 授权token
Attachments []FileInfo `json:"attachments,optional"` // 附件
Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落
}
SystemArticleCreateResponse {
... ... @@ -610,6 +624,7 @@ type (
TargetUser int `json:"targetUser"` // 分发方式 [0分发给所有人、1分发给指定的人]
Tags []int64 `json:"tags"` // 标签
Cover string `json:"cover"` //封面
Attachments []FileInfo `json:"attachments,optional"` // 附件
}
)
// 管理后台文章恢复
... ... @@ -676,6 +691,7 @@ type (
CreatedAt int64 `json:"createdAt"`
MeReadFlag int `json:"meReadFlag"` //已读标识 [0:未读] [1:已读]
Cover string `json:"cover"` //封面
Attachments []FileInfo `json:"attachments,optional"` // 附件
}
)
... ... @@ -694,6 +710,7 @@ type (
Tags []int64 `json:"tags"` // 标签
AccessToken string `header:"x-mmm-accesstoken"` // 授权token
Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落
Attachments []FileInfo `json:"attachments,optional"` // 附件
}
SystemArticleDraftCreateResponse {
Id int64 `json:"id"` //ID
... ... @@ -726,6 +743,7 @@ type (
Tags []int64 `json:"tags"` // 标签
AccessToken string `header:"x-mmm-accesstoken"` // 授权token
Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落
Attachments []FileInfo `json:"attachments,optional"` // 附件
}
SystemArticleDraftUpdateResponse {
Id int64 `json:"id"` //ID
... ... @@ -766,6 +784,7 @@ type (
Author string `json:"author"` //发布人
UpdatedAt int64 `json:"updatedAt"` //编辑时间
Cover string `json:"cover"` //封面
Attachments []FileInfo `json:"attachments,optional"` // 附件
}
)
... ... @@ -811,6 +830,7 @@ type (
Tags []int64 `json:"tags"` // 标签
Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落
Cover string `json:"cover"` //封面
Attachments []FileInfo `json:"attachments,optional"` // 附件
}
)
... ...
... ... @@ -237,6 +237,7 @@ type(
Images []string `json:"images"` // 图片列表
Author UserItem `json:"author"` // 作者
Cover string `json:"cover"` //封面
Attachments []FileInfo `json:"attachments,optional"` // 附件
}
MiniUserFollowedSearchRequest{
Page int `json:"page,optional"`
... ...
... ... @@ -77,6 +77,7 @@ func (l *MiniArticleBackupSearchLogic) MiniArticleBackupSearch(req *types.MiniAr
Action: backupList[i].Action,
Show: int(backupList[i].Show),
Cover: backupList[i].GetCover(),
Attachments: NewTypesAttachments(backupList[i].Attachments),
}
//根据修改的内容替换展示内容
changeFiled := []string{}
... ...
... ... @@ -56,6 +56,7 @@ func NewArticle(article *domain.Article) types.ArticleSearchMe {
Id: article.Id,
Title: article.Title,
Images: article.GetImages(),
Attachments: NewTypesAttachments(article.Attachments),
CreatedAt: article.CreatedAt,
CountLove: article.CountLove,
CountComment: article.CountComment,
... ...
... ... @@ -46,6 +46,7 @@ func (l *MiniCreateArticleDraftLogic) MiniCreateArticleDraft(req *types.MiniArti
AuthorId: req.AuthorId,
Title: req.Title,
Images: []domain.Image{},
Attachments: NewDomainAttachments(req.Attachments),
WhoRead: req.WhoRead,
WhoReview: req.WhoReview,
Location: domain.Location{
... ...
... ... @@ -350,6 +350,7 @@ func (l *MiniCreateArticleLogic) MiniCreateArticleBak(req *types.MiniArticleCrea
Author: articleAuthor,
Title: req.Title,
Images: images,
Attachments: NewDomainAttachments(req.Attachments),
WhoRead: whoRead,
WhoReview: whoReview,
Location: domain.Location{
... ... @@ -439,3 +440,25 @@ func (l *MiniCreateArticleLogic) validateTextLimit(req *types.MiniArticleCreateR
}
return nil
}
func NewDomainAttachments(from []types.FileInfo) []domain.FileInfo {
var to = make([]domain.FileInfo, 0)
lo.ForEach(from, func(item types.FileInfo, index int) {
to = append(to, domain.FileInfo{
Name: item.Name,
Url: item.Url,
})
})
return to
}
func NewTypesAttachments(from []domain.FileInfo) []types.FileInfo {
var to = make([]types.FileInfo, 0)
lo.ForEach(from, func(item domain.FileInfo, index int) {
to = append(to, types.FileInfo{
Name: item.Name,
Url: item.Url,
})
})
return to
}
... ...
... ... @@ -57,6 +57,7 @@ func (l *MiniGetArticleBackupLogic) MiniGetArticleBackup(req *types.MiniGetArtic
Title: backupInfo.Title,
Content: content.String(),
Images: images,
Attachments: NewTypesAttachments(backupInfo.Attachments),
Videos: videos,
CreatedAt: backupInfo.CreatedAt,
Location: types.Location{
... ...
... ... @@ -61,6 +61,7 @@ func (l *MiniGetArticleDraftMeLogic) MiniGetArticleDraftMe(req *types.MiniArticl
//Section: draftInfo.Content,
Title: draftInfo.Title,
Images: []string{},
Attachments: NewTypesAttachments(draftInfo.Attachments),
WhoRead: draftInfo.WhoRead,
WhoReview: draftInfo.WhoReview,
Location: types.Location{
... ...
... ... @@ -130,6 +130,7 @@ func (l *MiniGetArticleLogic) MiniGetArticle(req *types.MiniArticleGetRequest) (
CreatedAt: articleInfo.CreatedAt,
Section: articleSection,
Images: []string{},
Attachments: NewTypesAttachments(articleInfo.Attachments),
WhoRead: articleInfo.WhoRead,
WhoReview: articleInfo.WhoReview,
Location: types.Location{
... ...
... ... @@ -76,6 +76,7 @@ func (l *MiniSearchArticleDraftMeLogic) MiniSearchArticleDraftMe(req *types.Mini
MatchUrl: draftList[i].MatchUrl,
Paragraphs: paragraphs,
Cover: draftList[i].GetCover(),
Attachments: NewTypesAttachments(draftList[i].Attachments),
}
}
return resp, nil
... ...
... ... @@ -74,6 +74,7 @@ func (l *MiniSearchArticlePageLogic) MiniSearchArticlePage(req *types.MiniSearch
Author: author.Name,
Avatar: author.Avatar,
Images: val.GetImages(),
Attachments: NewTypesAttachments(val.Attachments),
CreatedAt: val.CreatedAt,
MeReadFlag: 0,
Cover: val.GetCover(),
... ...
... ... @@ -58,6 +58,7 @@ func (l *MiniUpdateArticleDraftLogic) MiniUpdateArticleDraft(req *types.MiniArti
Url: val,
})
}
draftInfo.Attachments = NewDomainAttachments(req.Attachments)
draftInfo.MatchUrl = make(map[string]string)
for k, v := range req.MatchUrl {
draftInfo.MatchUrl[k] = v
... ...
... ... @@ -42,6 +42,7 @@ func (l *SystemArticleGetHistoryLogic) SystemArticleGetHistory(req *types.System
CreatedAt: backup.CreatedAt,
Section: make([]types.ArticleSection, 0),
Images: make([]string, 0),
Attachments: NewTypesAttachments(backup.Attachments),
WhoRead: backup.WhoRead,
WhoReadInfo: make([]types.UserShowName, 0),
WhoReview: backup.WhoReview,
... ...
... ... @@ -64,6 +64,7 @@ func (l *SystemCreateArticleDraftLogic) SystemCreateArticleDraft(req *types.Syst
Title: req.Title,
Content: req.Content,
Images: images,
Attachments: NewDomainAttachments(req.Attachments),
Videos: videos,
TargetUser: domain.ArticleTarget(req.TargetUser),
WhoRead: req.WhoRead,
... ...
... ... @@ -84,6 +84,7 @@ func (l *SystemCreateArticleLogic) SystemCreateArticle(req *types.SystemArticleC
Author: articleAuthor,
Title: req.Title,
Images: images,
Attachments: NewDomainAttachments(req.Attachments),
Videos: videos,
WhoRead: make([]int64, 0),
WhoReview: make([]int64, 0),
... ...
... ... @@ -73,6 +73,7 @@ func (l *SystemGetArticleDraftLogic) SystemGetArticleDraft(req *types.SystemArti
Content: articleDraft.Content,
AuthorId: articleDraft.AuthorId,
Images: images,
Attachments: NewTypesAttachments(articleDraft.Attachments),
Videos: videos,
TargetUser: int(articleDraft.TargetUser),
WhoRead: articleDraft.WhoRead,
... ...
... ... @@ -52,6 +52,7 @@ func (l *SystemGetArticleLogic) SystemGetArticle(req *types.SystemArticleGetRequ
CreatedAt: article.CreatedAt,
Section: make([]types.ArticleSection, 0),
Images: images,
Attachments: NewTypesAttachments(article.Attachments),
WhoRead: article.WhoRead,
WhoReadInfo: make([]types.UserShowName, 0),
WhoReview: article.WhoReview,
... ...
... ... @@ -73,6 +73,7 @@ func (l *SystemSearchArticleDraftLogic) SystemSearchArticleDraft(req *types.Syst
Author: author,
UpdatedAt: item.UpdatedAt,
Cover: item.GetCover(),
Attachments: NewTypesAttachments(item.Attachments),
})
})
return
... ...
... ... @@ -89,6 +89,7 @@ func (l *SystemSearchArticleLogic) SystemSearchArticle(req *types.SystemArticleS
Name: item.Operator.Name,
},
Cover: item.GetCover(),
Attachments: NewTypesAttachments(item.Attachments),
})
})
return
... ...
... ... @@ -51,6 +51,7 @@ func (l *SystemUpdateArticleDraftLogic) SystemUpdateArticleDraft(req *types.Syst
return nil, xerr.NewErrMsg(err.Error())
}
articleDraft.Images = images
articleDraft.Attachments = NewDomainAttachments(req.Attachments)
//视频
videos, err := getVideos(req.Videos)
if err != nil {
... ...
... ... @@ -112,6 +112,7 @@ func (l *SystemUpdateArticleLogic) SystemUpdateArticle(req *types.SystemArticleU
article.Title = req.Title
article.Version = article.Version + 1
article.Images = images
article.Attachments = NewDomainAttachments(req.Attachments)
article.Videos = videos
article.WhoRead = whoRead
article.WhoReview = whoReview
... ...
... ... @@ -63,6 +63,7 @@ func (l *MiniUserNewsLogic) MiniUserNews(req *types.MiniUserNewsRequest) (resp *
Summary: item.Summary,
Time: item.CreatedAt,
Images: item.GetImages(),
Attachments: types.NewTypesAttachments(item.Attachments),
ReadFlag: false,
Cover: item.GetCover(),
}
... ...
package types
import (
"github.com/samber/lo"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
)
func NewDomainAttachments(from []FileInfo) []domain.FileInfo {
var to = make([]domain.FileInfo, 0)
lo.ForEach(from, func(item FileInfo, index int) {
to = append(to, domain.FileInfo{
Name: item.Name,
Url: item.Url,
})
})
return to
}
func NewTypesAttachments(from []domain.FileInfo) []FileInfo {
var to = make([]FileInfo, 0)
lo.ForEach(from, func(item domain.FileInfo, index int) {
to = append(to, FileInfo{
Name: item.Name,
Url: item.Url,
})
})
return to
}
... ...
... ... @@ -608,6 +608,7 @@ type UserNewsItem struct {
Images []string `json:"images"` // 图片列表
Author UserItem `json:"author"` // 作者
Cover string `json:"cover"` //封面
Attachments []FileInfo `json:"attachments,optional"` // 附件
}
type MiniUserFollowedSearchRequest struct {
... ... @@ -967,6 +968,7 @@ type MiniArticleCreateRequest struct {
WhoReview []int64 `json:"whoReview,optional"` //谁可评论
Location Location `json:"location,optional"` //定位坐标
MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本
Attachments []FileInfo `json:"attachments,optional"` // 附件
Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落
}
... ... @@ -974,6 +976,11 @@ type MiniArticleCreateResponse struct {
Id int64 `json:"id"`
}
type FileInfo struct {
Name string `json:"name"`
Url string `json:"url"`
}
type MiniArticleGetRequest struct {
Id int64 `path:"id"` //id
CompanyId int64 `path:",optional"` //当前公司
... ... @@ -1002,6 +1009,7 @@ type MiniArticleGetResponse struct {
Tags []string `json:"tags"` // 文章的标签
MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本
Cover string `json:"cover"` //封面
Attachments []FileInfo `json:"attachments,optional"` // 附件
}
type ArticleSection struct {
... ... @@ -1040,6 +1048,7 @@ type ArticleSearchMe struct {
IsDel int `json:"isDel"` //是否删除 1-删除 0-否
DeletedType int `json:"deletedType"` //类型 1-运营删除 2-用户删除
Cover string `json:"cover"` //封面
Attachments []FileInfo `json:"attachments,optional"` // 附件
}
type SystemArticleSearchMeRequest struct {
... ... @@ -1133,6 +1142,7 @@ type MiniArticleBackupItem struct {
Action string `json:"action"`
Show int `json:"show"`
Cover string `json:"cover"` //封面
Attachments []FileInfo `json:"attachments,optional"` // 附件
}
type MiniGetArticleBackupRequest struct {
... ... @@ -1152,6 +1162,7 @@ type MiniGetArticleBackupResponse struct {
Action string `json:"action"`
Show int `json:"show"`
Cover string `json:"cover"` //封面
Attachments []FileInfo `json:"attachments,optional"` // 附件
}
type MiniArticleMarkUserReadRequest struct {
... ... @@ -1176,6 +1187,7 @@ type MiniArticleDraftCreateRequest struct {
Location Location `json:"location"` // 坐标
MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本
Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落
Attachments []FileInfo `json:"attachments,optional"` // 附件
}
type MiniArticleDraftCreateResponse struct {
... ... @@ -1194,6 +1206,7 @@ type MiniArticleDraftUpdateRequest struct {
WhoReview []int64 `json:"whoReview"` // 评论人
Location Location `json:"location"` // 坐标
MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本
Attachments []FileInfo `json:"attachments,optional"` // 附件
Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落
}
... ... @@ -1223,6 +1236,7 @@ type MiniArticleDraftItem struct {
MatchUrl map[string]string `json:"matchUrl"` //匹配内容中的url文本
Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落
Cover string `json:"cover"` //封面
Attachments []FileInfo `json:"attachments,optional"` // 附件
}
type MiniArticleDraftGetMeRequest struct {
... ... @@ -1243,6 +1257,7 @@ type MiniArticleDraftGetMeResponse struct {
MatchUrl map[string]string `json:"matchUrl"` //
Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落
Cover string `json:"cover"` //封面
Attachments []FileInfo `json:"attachments,optional"` // 附件
}
type MiniArticleDraftDeleteMeRequest struct {
... ... @@ -1339,6 +1354,7 @@ type SystemArticleGetResponse struct {
Tags []ArticleTagItem `json:"tags"` //标签
TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人]
Cover string `json:"cover"` //封面
Attachments []FileInfo `json:"attachments,optional"` // 附件
}
type SystemArticleSearchRequest struct {
... ... @@ -1374,6 +1390,7 @@ type SystemArticleSearch struct {
TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人]
Operator Operator `json:"operator"` //运营操作人
Source int `json:"source"` //来源[1用户发布、2运营发布]
Attachments []FileInfo `json:"attachments,optional"` // 附件
}
type SystemArticleUpdateRequest struct {
... ... @@ -1389,6 +1406,7 @@ type SystemArticleUpdateRequest struct {
TargetUser int `json:"targetUser"` // 分发方式 [0分发给所有人、1分发给指定的人]
Tags []int64 `json:"tags"` // 标签
AccessToken string `header:"x-mmm-accesstoken"` // 授权token
Attachments []FileInfo `json:"attachments,optional"` // 附件
}
type SystemArticleUpdateResponse struct {
... ... @@ -1417,6 +1435,7 @@ type SystemArticleCreateRequest struct {
MatchUrl map[string]string `json:"matchUrl,optional"` // 匹配文章内容中的url文本
ArticleDraftId int64 `json:"articleDraftId"` // 草稿ID
AccessToken string `header:"x-mmm-accesstoken"` // 授权token
Attachments []FileInfo `json:"attachments,optional"` // 附件
Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落
}
... ... @@ -1486,6 +1505,7 @@ type SystemArticleGetHistoryResponse struct {
TargetUser int `json:"targetUser"` // 分发方式 [0分发给所有人、1分发给指定的人]
Tags []int64 `json:"tags"` // 标签
Cover string `json:"cover"` //封面
Attachments []FileInfo `json:"attachments,optional"` // 附件
}
type SystemArticleRestoreRequest struct {
... ... @@ -1546,6 +1566,7 @@ type MiniSearchArticleItem struct {
CreatedAt int64 `json:"createdAt"`
MeReadFlag int `json:"meReadFlag"` //已读标识 [0:未读] [1:已读]
Cover string `json:"cover"` //封面
Attachments []FileInfo `json:"attachments,optional"` // 附件
}
type SystemArticleDraftCreateRequest struct {
... ... @@ -1561,6 +1582,7 @@ type SystemArticleDraftCreateRequest struct {
Tags []int64 `json:"tags"` // 标签
AccessToken string `header:"x-mmm-accesstoken"` // 授权token
Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落
Attachments []FileInfo `json:"attachments,optional"` // 附件
}
type SystemArticleDraftCreateResponse struct {
... ... @@ -1591,6 +1613,7 @@ type SystemArticleDraftUpdateRequest struct {
Tags []int64 `json:"tags"` // 标签
AccessToken string `header:"x-mmm-accesstoken"` // 授权token
Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落
Attachments []FileInfo `json:"attachments,optional"` // 附件
}
type SystemArticleDraftUpdateResponse struct {
... ... @@ -1631,6 +1654,7 @@ type SystemArticleDraftSearch struct {
Author string `json:"author"` //发布人
UpdatedAt int64 `json:"updatedAt"` //编辑时间
Cover string `json:"cover"` //封面
Attachments []FileInfo `json:"attachments,optional"` // 附件
}
type SystemArticleDraftDeleteRequest struct {
... ... @@ -1672,6 +1696,7 @@ type SystemArticleDraftGetResponse struct {
Tags []int64 `json:"tags"` // 标签
Paragraphs []Paragraph `json:"paragraphs,optional"` // 段落
Cover string `json:"cover"` //封面
Attachments []FileInfo `json:"attachments,optional"` // 附件
}
type SystemArticleSearchDeletedRequest struct {
... ...
... ... @@ -36,6 +36,7 @@ type Article struct {
Operator domain.Operator `gorm:"type:jsonb;serializer:json"` // 运营操作人
DeletedType int `json:"deletedType"` // 删除类型 1-运营删除 2-用户删除
Cover string
Attachments []domain.FileInfo `gorm:"type:jsonb;serializer:json"`
}
func (m *Article) TableName() string {
... ...
... ... @@ -32,6 +32,7 @@ type ArticleBackup struct {
TargetUser int // 分发方式 0 分发给所有人 1 分发给指定的人
MatchUrl map[string]string `gorm:"type:jsonb;serializer:json"` // 匹配文章内容中的url文本
Show int
Attachments []domain.FileInfo `gorm:"type:jsonb;serializer:json"`
}
func (m *ArticleBackup) TableName() string {
... ...
... ... @@ -26,7 +26,7 @@ type ArticleDraft struct {
WhoReview []int64 `gorm:"type:jsonb;serializer:json"` // 评论人
Location domain.Location `gorm:"type:jsonb;serializer:json"` // 坐标
MatchUrl map[string]string `gorm:"type:jsonb;serializer:json"` // 匹配文章内容中的url文本
Attachments []domain.FileInfo `gorm:"type:jsonb;serializer:json"`
Section []*domain.ArticleSection `gorm:"type:jsonb;serializer:json"`
}
... ...
... ... @@ -29,7 +29,7 @@ type ArticleDraftOperation struct {
UpdatedAt int64 `gorm:"comment:编辑时间"` // 编辑时间
IsDel soft_delete.DeletedAt `gorm:"softDelete:flag,DeletedAtField:DeletedAt"` // 删除标记
DeletedAt int64 `gorm:"comment:删除时间"` // 删除时间
Attachments []domain.FileInfo `gorm:"type:jsonb;serializer:json"`
Section []*domain.ArticleSection `gorm:"type:jsonb;serializer:json"` // 分段内容
}
... ...
... ... @@ -178,6 +178,7 @@ func (repository *ArticleBackupRepository) ModelToDomainModel(from *models.Artic
ChangeField: from.ChangeField,
Videos: from.Videos,
Show: domain.ArticleShow(from.Show),
Attachments: from.Attachments,
}
// err := copier.Copy(to, from)
return to, nil
... ... @@ -207,6 +208,7 @@ func (repository *ArticleBackupRepository) DomainModelToModel(from *domain.Artic
Videos: from.Videos,
ChangeField: from.ChangeField,
Show: int(from.Show),
Attachments: from.Attachments,
}
// err := copier.Copy(to, from)
return to, nil
... ...
... ... @@ -162,6 +162,7 @@ func (repository *ArticleDraftRepository) ModelToDomainModel(from *models.Articl
Location: from.Location,
MatchUrl: from.MatchUrl,
Section: from.Section,
Attachments: from.Attachments,
}
// err := copier.Copy(to, from)
return to, nil
... ... @@ -185,6 +186,7 @@ func (repository *ArticleDraftRepository) DomainModelToModel(from *domain.Articl
Location: from.Location,
MatchUrl: from.MatchUrl,
Section: from.Section,
Attachments: from.Attachments,
}
// err := copier.Copy(to, from)
return to, nil
... ...
... ... @@ -452,6 +452,7 @@ func (repository *ArticleRepository) ModelToDomainModel(from *models.Article) (*
DeletedType: from.DeletedType,
IsDel: int(from.IsDel),
Cover: from.Cover,
Attachments: from.Attachments,
}
return to, nil
}
... ... @@ -485,6 +486,7 @@ func (repository *ArticleRepository) DomainModelToModel(from *domain.Article) (*
Operator: from.Operator,
DeletedType: from.DeletedType,
Cover: from.Cover,
Attachments: from.Attachments,
}
// err := copier.Copy(to, from)
return to, nil
... ...
... ... @@ -36,9 +36,15 @@ type Article struct {
Operator Operator `gorm:"type:jsonb;serializer:json"` // 运营操作人
DeletedType int `json:"deletedType"` // 删除类型 1-运营删除 2-用户删除
Cover string `json:"cover"` // 封面
Attachments []FileInfo `json:"attachments"` // 附件
// ...more
}
type FileInfo struct {
Name string `json:"name"`
Url string `json:"url"`
}
type ArticleRepository interface {
Insert(ctx context.Context, conn transaction.Conn, dm *Article) (*Article, error)
Update(ctx context.Context, conn transaction.Conn, dm *Article) (*Article, error)
... ...
... ... @@ -31,6 +31,7 @@ type ArticleBackup struct {
Tags []int64 `json:"tags"` // 标签
MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本
Show ArticleShow `json:"show"` // 评论的展示状态(1显示,2不显示、)
Attachments []FileInfo `json:"attachments"` // 附件
}
type ArticleBackupRepository interface {
... ...
... ... @@ -24,8 +24,8 @@ type ArticleDraft struct {
WhoReview []int64 `json:"whoReview"` // 评论人
Location Location `json:"location"` // 坐标
MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本
Section []*ArticleSection `json:"section"` // 分段内容
Attachments []FileInfo `json:"attachments"` // 附件
}
type ArticleDraftRepository interface {
Insert(ctx context.Context, conn transaction.Conn, dm *ArticleDraft) (*ArticleDraft, error)
... ...
... ... @@ -28,6 +28,7 @@ type ArticleDraftOperation struct {
IsDel soft_delete.DeletedAt `json:"isDel,omitempty"` // 删除标记
DeletedAt int64 `json:"deletedAt,omitempty"` // 删除时间
Section []*ArticleSection `json:"section"` // 分段内容
Attachments []FileInfo `json:"attachments"` // 附件
}
type ArticleDraftOperationRepository interface {
... ...
-- 附件
alter table article add column attachments jsonb;
alter table article_backup add column attachments jsonb;
alter table article_draft add column attachments jsonb;
alter table article_draft_operation add column attachments jsonb;
\ No newline at end of file
... ...