作者 yangfu

Merge branch 'dev' into test

... ... @@ -7,6 +7,15 @@ type Location {
Descript string `json:"descript,optional"` //地点描述
}
type Video {
Url string `json:"url"` //视频文件的地址
Cover string `json:"cover"` //封面
Width int `json:"width"` //封面图片宽
Height int `json:"height"` //封面图片长
}
// 人员的简单展示信息
type ArticleAuthor {
Id int64 `json:"id"` // 人员id
... ... @@ -48,6 +57,7 @@ type (
CreatedAt int64 `json:"createdAt"` //文章的发布时间
Section []ArticleSection `json:"section"` //文章的文本内容
Images []string `json:"images"` //图片
Videos []Video `json:"videos"` //视频
WhoRead []int64 `json:"whoRead"` //谁可查看
WhoReview []int64 `json:"whoReview"` //谁可评论
Location Location `json:"location"` //定位坐标
... ... @@ -355,6 +365,7 @@ type (
CreatedAt int64 `json:"createdAt"` // 文章的发布时间
Section []ArticleSection `json:"section"` // 文章的文本内容
Images []string `json:"images"` // 图片
Videos []Video `json:"videos"` // 视频
WhoRead []int64 `json:"whoRead"` // 谁可查看
WhoReadInfo []UserShowName `json:"whoReadInfo"` // 谁可查看
WhoReview []int64 `json:"whoReview"` // 谁可评论
... ... @@ -410,6 +421,7 @@ type (
Section []ArticleSection `json:"section"` // 填写的内容
Title string `json:"title"` // 标题
Images []string `json:"images"` // 图片
Videos []Video `json:"video"` // 视频
WhoRead []int64 `json:"whoRead"` // 谁可以看
WhoReview []int64 `json:"whoReview"` // 评论人
TargetUser int `json:"targetUser"` // 分发方式 [0分发给所有人、1分发给指定的人]
... ... @@ -423,6 +435,7 @@ type (
Images []string `json:"images"` //图片
CreatedAt int64 `json:"createdAt"` //文章的创建日期
CountLove int `json:"countLove"` //点赞数量
Videos []Video `json:"video"` // 视频
CountComment int `json:"countComment"` //评论数量
Show int `json:"show"` //是否隐藏 [0显示、1不显示]
Tags []int64 `json:"tags"` //标签
... ... @@ -464,6 +477,7 @@ type (
CreatedAt int64 `json:"createdAt"` // 文章的发布时间
Section []ArticleSection `json:"section"` // 文章的文本内容
Images []string `json:"images"` // 图片
Videos []Video `json:"video"`
WhoRead []int64 `json:"whoRead"` // 谁可查看
WhoReadInfo []UserShowName `json:"whoReadInfo"` // 谁可查看
WhoReview []int64 `json:"whoReview"` // 谁可评论
... ...
... ... @@ -152,6 +152,7 @@ func (l *MiniGetArticleLogic) MiniGetArticle(req *types.MiniArticleGetRequest) (
MeFollowFlag: 0,
Tags: tags,
MatchUrl: map[string]string{},
Videos: []types.Video{},
}
if len(backupList) > 0 {
resp.Edit = 1
... ... @@ -171,6 +172,16 @@ func (l *MiniGetArticleLogic) MiniGetArticle(req *types.MiniArticleGetRequest) (
for _, val := range articleInfo.Images {
resp.Images = append(resp.Images, val.Url)
}
for _, val := range articleInfo.Videos {
resp.Videos = append(resp.Videos, types.Video{
Url: val.Url,
Cover: val.Cover,
Width: val.Width,
Height: val.Height,
})
}
if follow != nil {
resp.MeFollowFlag = 1
}
... ...
... ... @@ -52,7 +52,9 @@ func (l *SystemArticleGetHistoryLogic) SystemArticleGetHistory(req *types.System
},
TargetUser: int(backup.TargetUser),
Tags: backup.Tags,
Videos: make([]types.Video, 0),
}
//文章段落内容
lo.ForEach(backup.Section, func(item domain.ArticleSection, index int) {
resp.Section = append(resp.Section, types.ArticleSection{
... ... @@ -66,6 +68,16 @@ func (l *SystemArticleGetHistoryLogic) SystemArticleGetHistory(req *types.System
lo.ForEach(backup.Images, func(item domain.Image, index int) {
resp.Images = append(resp.Images, item.Url)
})
// 视频
for _, val := range backup.Videos {
resp.Videos = append(resp.Videos, types.Video{
Url: val.Url,
Cover: val.Cover,
Width: val.Width,
Height: val.Height,
})
}
//用户
userIds := lo.Union(resp.WhoRead, resp.WhoReview)
if len(userIds) > 0 {
... ...
... ... @@ -62,6 +62,7 @@ func (l *SystemArticleRestoreLogic) SystemArticleRestore(req *types.SystemArticl
article.Version = article.Version + 1
article.Images = backup.Images
article.Videos = backup.Videos
article.Title = backup.Title
article.MatchUrl = backup.MatchUrl
articleSections := make([]domain.ArticleSection, 0)
... ...
... ... @@ -66,6 +66,16 @@ func (l *SystemGetArticleLogic) SystemGetArticle(req *types.SystemArticleGetRequ
Show: int(article.Show),
Tags: make([]types.ArticleTagItem, 0),
TargetUser: int(article.TargetUser),
Videos: make([]types.Video, 0),
}
for _, val := range article.Videos {
resp.Videos = append(resp.Videos, types.Video{
Url: val.Url,
Cover: val.Cover,
Width: val.Width,
Height: val.Height,
})
}
//标签
if len(article.Tags) > 0 {
... ...
... ... @@ -44,6 +44,8 @@ func (l *MiniUserNewsLogic) MiniUserNews(req *types.MiniUserNewsRequest) (resp *
)
if req.AuthorId > 0 {
users = []int64{req.AuthorId}
} else {
users = append(users, user.Id)
}
if _, articles, err = l.svcCtx.ArticleRepository.FindAuthorsLatestArticle(l.ctx, conn, user.CompanyId, users, user.Id, req.LastArticleId, req.Size); err != nil {
return nil, xerr.NewErrMsgErr("获取快讯异常", err)
... ...
... ... @@ -825,6 +825,13 @@ type Location struct {
Descript string `json:"descript,optional"` //地点描述
}
type Video struct {
Url string `json:"url"` //视频文件的地址
Cover string `json:"cover"` //封面
Width int `json:"width"` //封面图片宽
Height int `json:"height"` //封面图片长
}
type ArticleAuthor struct {
Id int64 `json:"id"` // 人员id
Name string `json:"name"` // 人员的名字
... ... @@ -862,6 +869,7 @@ type MiniArticleGetResponse struct {
CreatedAt int64 `json:"createdAt"` //文章的发布时间
Section []ArticleSection `json:"section"` //文章的文本内容
Images []string `json:"images"` //图片
Videos []Video `json:"videos"` //视频
WhoRead []int64 `json:"whoRead"` //谁可查看
WhoReview []int64 `json:"whoReview"` //谁可评论
Location Location `json:"location"` //定位坐标
... ... @@ -1140,6 +1148,7 @@ type SystemArticleGetResponse struct {
CreatedAt int64 `json:"createdAt"` // 文章的发布时间
Section []ArticleSection `json:"section"` // 文章的文本内容
Images []string `json:"images"` // 图片
Videos []Video `json:"videos"` // 视频
WhoRead []int64 `json:"whoRead"` // 谁可查看
WhoReadInfo []UserShowName `json:"whoReadInfo"` // 谁可查看
WhoReview []int64 `json:"whoReview"` // 谁可评论
... ... @@ -1190,6 +1199,7 @@ type SystemArticleUpdateRequest struct {
Section []ArticleSection `json:"section"` // 填写的内容
Title string `json:"title"` // 标题
Images []string `json:"images"` // 图片
Videos []Video `json:"video"` // 视频
WhoRead []int64 `json:"whoRead"` // 谁可以看
WhoReview []int64 `json:"whoReview"` // 评论人
TargetUser int `json:"targetUser"` // 分发方式 [0分发给所有人、1分发给指定的人]
... ... @@ -1204,6 +1214,7 @@ type SystemArticleUpdateResponse struct {
Images []string `json:"images"` //图片
CreatedAt int64 `json:"createdAt"` //文章的创建日期
CountLove int `json:"countLove"` //点赞数量
Videos []Video `json:"video"` // 视频
CountComment int `json:"countComment"` //评论数量
Show int `json:"show"` //是否隐藏 [0显示、1不显示]
Tags []int64 `json:"tags"` //标签
... ... @@ -1243,6 +1254,7 @@ type SystemArticleGetHistoryResponse struct {
CreatedAt int64 `json:"createdAt"` // 文章的发布时间
Section []ArticleSection `json:"section"` // 文章的文本内容
Images []string `json:"images"` // 图片
Videos []Video `json:"video"`
WhoRead []int64 `json:"whoRead"` // 谁可查看
WhoReadInfo []UserShowName `json:"whoReadInfo"` // 谁可查看
WhoReview []int64 `json:"whoReview"` // 谁可评论
... ...
... ... @@ -22,6 +22,7 @@ type ArticleBackup struct {
Title string // 标题
Section []domain.ArticleSection `gorm:"type:jsonb;serializer:json"` // 分段内容
Images []domain.Image `gorm:"type:jsonb;serializer:json"` // 图片
Videos []domain.Video `gorm:"type:jsonb;serializer:json"` // 视频
Action string // 操作
WhoRead []int64 `gorm:"type:jsonb;serializer:json"` // 谁可以看
WhoReview []int64 `gorm:"type:jsonb;serializer:json"` // 评论人
... ...
... ... @@ -175,6 +175,7 @@ func (repository *ArticleBackupRepository) ModelToDomainModel(from *models.Artic
WhoReview: from.WhoReview,
Tags: from.Tags,
MatchUrl: from.MatchUrl,
Videos: from.Videos,
}
// err := copier.Copy(to, from)
return to, nil
... ... @@ -201,6 +202,7 @@ func (repository *ArticleBackupRepository) DomainModelToModel(from *domain.Artic
Location: from.Location,
TargetUser: int(from.TargetUser),
MatchUrl: from.MatchUrl,
Videos: from.Videos,
}
// err := copier.Copy(to, from)
return to, nil
... ...
... ... @@ -176,7 +176,7 @@ func (repository *ArticleRepository) FindAuthorsLatestArticle(ctx context.Contex
queryFunc := func() (interface{}, error) {
tx = tx.Model(&ms).
Where("company_id=?", companyId).
Where("author_id in (?)", append(authors, whoRead)). // 包含自己的文章
Where("author_id in (?)", authors). // 包含自己的文章
Where(fmt.Sprintf("author_id = %d or target_user=0 or who_read @>'[%d]'", whoRead, whoRead)).
Where("show = 1")
if lastId > 0 {
... ...
... ... @@ -49,6 +49,7 @@ func (repository *MessageSystemRepository) Update(ctx context.Context, conn tran
if _, err = repository.Query(queryFunc, m.CacheKeyFunc()); err != nil {
return nil, err
}
return repository.ModelToDomainModel(m)
}
... ...
... ... @@ -110,7 +110,8 @@ func (m *Article) MakeBackup(operator UserSimple, section []*ArticleSection) *Ar
ArticleId: m.Id,
Title: m.Title,
Section: sectionBackup,
Images: m.Images,
Images: make([]Image, len(m.Images)),
Videos: make([]Video, len(m.Videos)),
Action: "",
TargetUser: m.TargetUser,
WhoRead: m.WhoRead,
... ... @@ -118,7 +119,8 @@ func (m *Article) MakeBackup(operator UserSimple, section []*ArticleSection) *Ar
Tags: m.Tags,
MatchUrl: map[string]string{},
}
copy(b.Videos, m.Videos)
copy(b.Images, m.Images)
for k, v := range m.MatchUrl {
b.MatchUrl[k] = v
}
... ...
... ... @@ -19,6 +19,7 @@ type ArticleBackup struct {
Title string `json:"title"` // 标题
Section []ArticleSection `json:"section"` // 分段内容
Images []Image `json:"images"` // 图片
Videos []Video `json:"videos"` // 视频
Action string `json:"action"` // 操作
TargetUser ArticleTarget `json:"targetUser"` // 分发方式 0 分发给所有人 1 分发给指定的人
Location Location `json:"location"` // 定位坐标
... ...
... ... @@ -70,7 +70,9 @@ type ArticleCommentRepository interface {
Update(ctx context.Context, conn transaction.Conn, dm *ArticleComment) (*ArticleComment, error)
UpdateWithVersion(ctx context.Context, conn transaction.Conn, dm *ArticleComment) (*ArticleComment, error)
Delete(ctx context.Context, conn transaction.Conn, dm *ArticleComment) (*ArticleComment, error)
FindOne(ctx context.Context, conn transaction.Conn, id int64) (*ArticleComment, error)
Find(ctx context.Context, conn transaction.Conn, queryOptions map[string]interface{}) (int64, []*ArticleComment, error)
IncreaseCountUserLove(ctx context.Context, conn transaction.Conn, incr int, commentId int64) error //点赞数量变动
IncreaseCountReply(ctx context.Context, conn transaction.Conn, incr int, commentId int64) error // 评论回复数量变动
... ...