作者 tangxvhui

Merge branch 'dev' into test

... ... @@ -26,6 +26,7 @@ type (
WhoRead []int64 `json:"whoRead,optional"` //谁可查看
WhoReview []int64 `json:"whoReview,optional"` //谁可评论
Location Location `json:"location,optional"` //定位坐标
MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本
}
MiniArticleCreateResponse {
Id int64 `json:"id"`
... ... @@ -58,6 +59,7 @@ type (
MeLoveFlag int `json:"meLoveFlag"` // 当前人员对文章的点赞标识 (0 没有点赞 1有点赞)
MeFollowFlag int `json:"meFollowFlag"` // 当前人员对作者的关注标识 (0 没有关注 1有关注)
Tags []string `json:"tags"` // 文章的标签
MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本
}
ArticleSection {
Id int64 `json:"id"` //段落id
... ... @@ -189,6 +191,7 @@ type (
WhoRead []int64 `json:"whoRead"` // 谁可以看
WhoReview []int64 `json:"whoReview"` // 评论人
Location Location `json:"location"` // 坐标
MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本
}
MiniArticleDraftCreateResponse {
... ... @@ -209,6 +212,7 @@ type (
WhoRead []int64 `json:"whoRead"` // 谁可以看
WhoReview []int64 `json:"whoReview"` // 评论人
Location Location `json:"location"` // 坐标
MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本
}
MiniArticleDraftUpdateResponse {
... ... @@ -235,7 +239,8 @@ type (
Section []string `json:"section"` // 填写的内容
Title string `json:"title"` // 标题
Images []string `json:"images"` // 图片
CreatedAt int64 `json:"createdAt"`
CreatedAt int64 `json:"createdAt"`//
MatchUrl map[string]string `json:"matchUrl"` //匹配内容中的url文本
}
)
... ... @@ -256,6 +261,7 @@ type (
WhoRead []int64 `json:"whoRead"` // 谁可以看
WhoReview []int64 `json:"whoReview"` // 评论人
Location Location `json:"location"` // 坐标
MatchUrl map[string]string `json:"matchUrl"` //
}
)
... ...
... ... @@ -53,6 +53,7 @@ func (l *MiniCreateArticleDraftLogic) MiniCreateArticleDraft(req *types.MiniArti
Latitude: req.Location.Latitude,
Descript: req.Location.Descript,
},
MatchUrl: map[string]string{},
}
for _, val := range req.Images {
newDraft.Images = append(newDraft.Images, domain.Image{
... ... @@ -60,6 +61,10 @@ func (l *MiniCreateArticleDraftLogic) MiniCreateArticleDraft(req *types.MiniArti
})
}
for k, v := range req.MatchUrl {
newDraft.MatchUrl[k] = v
}
_, err = l.svcCtx.ArticleDraftRepository.Insert(l.ctx, conn, &newDraft)
if err != nil {
return nil, xerr.NewErrMsgErr("保存草稿失败", err)
... ...
... ... @@ -164,10 +164,14 @@ func (l *MiniCreateArticleLogic) MiniCreateArticle(req *types.MiniArticleCreateR
CountRead: 0,
Show: domain.ArticleShowEnable,
Tags: []int64{},
MatchUrl: map[string]string{},
}
if len(whoRead) > 0 {
newArticle.TargetUser = domain.ArticleTargetLimit
}
for k, v := range req.MatchUrl {
newArticle.MatchUrl[k] = v
}
//设置内容概要
if len(sectionList) > 0 {
// 截取内容 50个字
... ...
... ... @@ -50,6 +50,10 @@ func (l *MiniGetArticleDraftMeLogic) MiniGetArticleDraftMe(req *types.MiniArticl
Latitude: draftInfo.Location.Latitude,
Descript: draftInfo.Location.Descript,
},
MatchUrl: map[string]string{},
}
for k, v := range draftInfo.MatchUrl {
resp.MatchUrl[k] = v
}
for _, val := range draftInfo.Images {
resp.Images = append(resp.Images, val.Url)
... ...
... ... @@ -122,10 +122,15 @@ func (l *MiniGetArticleLogic) MiniGetArticle(req *types.MiniArticleGetRequest) (
MeLoveFlag: meLoveFlag,
MeFollowFlag: 0,
Tags: tags,
MatchUrl: map[string]string{},
}
if articleInfo.CreatedAt != articleInfo.UpdatedAt {
resp.Edit = 1
}
for k, v := range articleInfo.MatchUrl {
resp.MatchUrl[k] = v
}
for _, val := range articleInfo.Images {
resp.Images = append(resp.Images, val.Url)
}
... ...
... ... @@ -54,6 +54,7 @@ func (l *MiniSearchArticleDraftMeLogic) MiniSearchArticleDraftMe(req *types.Mini
Title: draftList[i].Title,
Images: images,
CreatedAt: draftList[i].CreatedAt,
MatchUrl: draftList[i].MatchUrl,
}
}
return resp, nil
... ...
... ... @@ -58,6 +58,10 @@ func (l *MiniUpdateArticleDraftLogic) MiniUpdateArticleDraft(req *types.MiniArti
Url: val,
})
}
draftInfo.MatchUrl = make(map[string]string)
for k, v := range req.MatchUrl {
draftInfo.MatchUrl[k] = v
}
_, err = l.svcCtx.ArticleDraftRepository.Update(l.ctx, conn, draftInfo)
if err != nil {
return nil, xerr.NewErrMsgErr("更新草稿失败", err)
... ...
... ... @@ -2,6 +2,7 @@ package article
import (
"context"
"github.com/samber/lo"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
... ... @@ -42,6 +43,7 @@ func (l *SystemArticleRestoreLogic) SystemArticleRestore(req *types.SystemArticl
article.Version = article.Version + 1
article.Images = backup.Images
article.Title = backup.Title
article.MatchUrl = backup.MatchUrl
articleSections := make([]domain.ArticleSection, 0)
lo.ForEach(backup.Section, func(item domain.ArticleSection, index int) {
articleSections = append(articleSections, domain.ArticleSection{
... ...
... ... @@ -804,6 +804,7 @@ type MiniArticleCreateRequest struct {
WhoRead []int64 `json:"whoRead,optional"` //谁可查看
WhoReview []int64 `json:"whoReview,optional"` //谁可评论
Location Location `json:"location,optional"` //定位坐标
MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本
}
type MiniArticleCreateResponse struct {
... ... @@ -835,6 +836,7 @@ type MiniArticleGetResponse struct {
MeLoveFlag int `json:"meLoveFlag"` // 当前人员对文章的点赞标识 (0 没有点赞 1有点赞)
MeFollowFlag int `json:"meFollowFlag"` // 当前人员对作者的关注标识 (0 没有关注 1有关注)
Tags []string `json:"tags"` // 文章的标签
MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本
}
type ArticleSection struct {
... ... @@ -955,6 +957,7 @@ type MiniArticleDraftCreateRequest struct {
WhoRead []int64 `json:"whoRead"` // 谁可以看
WhoReview []int64 `json:"whoReview"` // 评论人
Location Location `json:"location"` // 坐标
MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本
}
type MiniArticleDraftCreateResponse struct {
... ... @@ -972,6 +975,7 @@ type MiniArticleDraftUpdateRequest struct {
WhoRead []int64 `json:"whoRead"` // 谁可以看
WhoReview []int64 `json:"whoReview"` // 评论人
Location Location `json:"location"` // 坐标
MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本
}
type MiniArticleDraftUpdateResponse struct {
... ... @@ -996,7 +1000,8 @@ type MiniArticleDraftItem struct {
Section []string `json:"section"` // 填写的内容
Title string `json:"title"` // 标题
Images []string `json:"images"` // 图片
CreatedAt int64 `json:"createdAt"`
CreatedAt int64 `json:"createdAt"` //
MatchUrl map[string]string `json:"matchUrl"` //匹配内容中的url文本
}
type MiniArticleDraftGetMeRequest struct {
... ... @@ -1014,6 +1019,7 @@ type MiniArticleDraftGetMeResponse struct {
WhoRead []int64 `json:"whoRead"` // 谁可以看
WhoReview []int64 `json:"whoReview"` // 评论人
Location Location `json:"location"` // 坐标
MatchUrl map[string]string `json:"matchUrl"` //
}
type MiniArticleDraftDeleteMeRequest struct {
... ...
... ... @@ -31,6 +31,7 @@ type Article struct {
Tags []int64 `gorm:"type:jsonb;serializer:json"` //定性标签
Show int // 评论的展示状态(0显示、1不显示)
Summary string // 内容概要
MatchUrl map[string]string `gorm:"type:jsonb;serializer:json"` // 匹配文章内容中的url文本
}
func (m *Article) TableName() string {
... ...
... ... @@ -28,6 +28,7 @@ type ArticleBackup struct {
Tags []int64 `gorm:"type:jsonb;serializer:json"` // 标签
Location domain.Location `gorm:"type:jsonb;serializer:json"` // 坐标
TargetUser int // 分发方式 0 分发给所有人 1 分发给指定的人
MatchUrl map[string]string `gorm:"type:jsonb;serializer:json"` // 匹配文章内容中的url文本
}
func (m *ArticleBackup) TableName() string {
... ...
... ... @@ -25,6 +25,7 @@ type ArticleDraft struct {
WhoRead []int64 `gorm:"type:jsonb;serializer:json"` // 谁可以看
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文本
}
func (m *ArticleDraft) TableName() string {
... ...
... ... @@ -171,6 +171,7 @@ func (repository *ArticleBackupRepository) ModelToDomainModel(from *models.Artic
WhoRead: from.WhoRead,
WhoReview: from.WhoReview,
Tags: from.Tags,
MatchUrl: from.MatchUrl,
}
// err := copier.Copy(to, from)
return to, nil
... ... @@ -193,9 +194,10 @@ func (repository *ArticleBackupRepository) DomainModelToModel(from *domain.Artic
Action: from.Action,
WhoRead: from.WhoRead,
WhoReview: from.WhoReview,
Location: from.Location,
Tags: from.Tags,
Location: from.Location,
TargetUser: int(from.TargetUser),
MatchUrl: from.MatchUrl,
}
// err := copier.Copy(to, from)
return to, nil
... ...
... ... @@ -156,6 +156,7 @@ func (repository *ArticleDraftRepository) ModelToDomainModel(from *models.Articl
WhoRead: from.WhoRead,
WhoReview: from.WhoReview,
Location: from.Location,
MatchUrl: from.MatchUrl,
}
// err := copier.Copy(to, from)
return to, nil
... ... @@ -177,6 +178,7 @@ func (repository *ArticleDraftRepository) DomainModelToModel(from *domain.Articl
WhoRead: from.WhoRead,
WhoReview: from.WhoReview,
Location: from.Location,
MatchUrl: from.MatchUrl,
}
// err := copier.Copy(to, from)
return to, nil
... ...
... ... @@ -304,6 +304,7 @@ func (repository *ArticleRepository) ModelToDomainModel(from *models.Article) (*
Show: domain.ArticleShow(from.Show),
Tags: from.Tags,
Summary: from.Summary,
MatchUrl: from.MatchUrl,
}
return to, nil
}
... ... @@ -328,9 +329,10 @@ func (repository *ArticleRepository) DomainModelToModel(from *domain.Article) (*
CountLove: from.CountLove,
CountRead: from.CountRead,
CountComment: from.CountComment,
Show: int(from.Show),
Tags: from.Tags,
Show: int(from.Show),
Summary: from.Summary,
MatchUrl: from.MatchUrl,
}
// err := copier.Copy(to, from)
return to, nil
... ...
... ... @@ -28,6 +28,7 @@ type Article struct {
Show ArticleShow `json:"show"` // 评论的展示状态(1显示,2不显示、)
Tags []int64 `json:"tags"` // 定性标签
Summary string `json:"summary"` // 内容概要
MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本
// ...more
}
... ... @@ -110,6 +111,11 @@ func (m *Article) MakeBackup(operator UserSimple, section []ArticleSection) *Art
WhoRead: m.WhoRead,
WhoReview: m.WhoReview,
Tags: m.Tags,
MatchUrl: map[string]string{},
}
for k, v := range m.MatchUrl {
b.MatchUrl[k] = v
}
return &b
}
... ...
... ... @@ -25,6 +25,7 @@ type ArticleBackup struct {
WhoRead []int64 `json:"whoRead"` // 谁可以看
WhoReview []int64 `json:"whoReview"` // 评论人
Tags []int64 `json:"tags"` // 标签
MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本
}
type ArticleBackupRepository interface {
... ...
... ... @@ -23,6 +23,7 @@ type ArticleDraft struct {
WhoRead []int64 `json:"whoRead"` // 谁可以看
WhoReview []int64 `json:"whoReview"` // 评论人
Location Location `json:"location"` // 坐标
MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本
}
type ArticleDraftRepository interface {
Insert(ctx context.Context, conn transaction.Conn, dm *ArticleDraft) (*ArticleDraft, error)
... ...