正在显示
8 个修改的文件
包含
89 行增加
和
43 行删除
| @@ -374,7 +374,7 @@ type ( | @@ -374,7 +374,7 @@ type ( | ||
| 374 | SystemArticleSearchRequest { | 374 | SystemArticleSearchRequest { |
| 375 | CompanyId int64 `json:"companyId,optional"` | 375 | CompanyId int64 `json:"companyId,optional"` |
| 376 | Title string `json:"title,optional"` //标题 | 376 | Title string `json:"title,optional"` //标题 |
| 377 | - Author string `json:"author,optional"` //发布人 | 377 | + Author int64 `json:"author,optional"` //发布人 |
| 378 | BeginTime int64 `json:"beginTime,optional"` //开始时间 | 378 | BeginTime int64 `json:"beginTime,optional"` //开始时间 |
| 379 | EndTime int64 `json:"endTime,optional"` //结束时间 | 379 | EndTime int64 `json:"endTime,optional"` //结束时间 |
| 380 | Tags []int64 `json:"tags,optional"` //标签 | 380 | Tags []int64 `json:"tags,optional"` //标签 |
| @@ -389,6 +389,7 @@ type ( | @@ -389,6 +389,7 @@ type ( | ||
| 389 | SystemArticleSearch { | 389 | SystemArticleSearch { |
| 390 | Id int64 `json:"id"` //id | 390 | Id int64 `json:"id"` //id |
| 391 | Title string `json:"title"` //标题 | 391 | Title string `json:"title"` //标题 |
| 392 | + AuthorId int64 `json:"author"` //发布人ID | ||
| 392 | Author string `json:"author"` //发布人 | 393 | Author string `json:"author"` //发布人 |
| 393 | Images []string `json:"images"` //图片 | 394 | Images []string `json:"images"` //图片 |
| 394 | CreatedAt int64 `json:"createdAt"` //文章的创建日期 | 395 | CreatedAt int64 `json:"createdAt"` //文章的创建日期 |
| @@ -258,7 +258,7 @@ type ( | @@ -258,7 +258,7 @@ type ( | ||
| 258 | Size int `json:"size"` | 258 | Size int `json:"size"` |
| 259 | ArticleId int64 `json:"articleId"` // 文章ID | 259 | ArticleId int64 `json:"articleId"` // 文章ID |
| 260 | TopId int64 `json:"topId,optional"` // 文章顶层ID | 260 | TopId int64 `json:"topId,optional"` // 文章顶层ID |
| 261 | - Author string `json:"author,optional"` // 用户 | 261 | + Author int64 `json:"author,optional"` // 用户 |
| 262 | Show int `json:"show,optional"` // 显示状态 | 262 | Show int `json:"show,optional"` // 显示状态 |
| 263 | BeginTime int64 `json:"beginTime,optional"` // 开始时间 | 263 | BeginTime int64 `json:"beginTime,optional"` // 开始时间 |
| 264 | EndTime int64 `json:"endTime,optional"` // 结束时间 | 264 | EndTime int64 `json:"endTime,optional"` // 结束时间 |
| @@ -30,7 +30,7 @@ func (l *SystemSearchArticleLogic) SystemSearchArticle(req *types.SystemArticleS | @@ -30,7 +30,7 @@ func (l *SystemSearchArticleLogic) SystemSearchArticle(req *types.SystemArticleS | ||
| 30 | queryOptions := domain.NewQueryOptions(). | 30 | queryOptions := domain.NewQueryOptions(). |
| 31 | WithOffsetLimit(req.Page, req.Size). | 31 | WithOffsetLimit(req.Page, req.Size). |
| 32 | WithKV("title", req.Title). | 32 | WithKV("title", req.Title). |
| 33 | - WithKV("author", req.Author). | 33 | + WithKV("authorId", req.Author). |
| 34 | WithKV("beginCreatedAt", req.BeginTime). | 34 | WithKV("beginCreatedAt", req.BeginTime). |
| 35 | WithKV("endCreatedAt", req.EndTime) | 35 | WithKV("endCreatedAt", req.EndTime) |
| 36 | total, articles, err := l.svcCtx.ArticleRepository.Find(l.ctx, conn, req.CompanyId, queryOptions) | 36 | total, articles, err := l.svcCtx.ArticleRepository.Find(l.ctx, conn, req.CompanyId, queryOptions) |
| @@ -41,6 +41,7 @@ func (l *SystemSearchArticleLogic) SystemSearchArticle(req *types.SystemArticleS | @@ -41,6 +41,7 @@ func (l *SystemSearchArticleLogic) SystemSearchArticle(req *types.SystemArticleS | ||
| 41 | Total: int(total), | 41 | Total: int(total), |
| 42 | List: make([]types.SystemArticleSearch, 0), | 42 | List: make([]types.SystemArticleSearch, 0), |
| 43 | } | 43 | } |
| 44 | + authorIds := make([]int64, 0) | ||
| 44 | lo.ForEach(articles, func(item *domain.Article, index int) { | 45 | lo.ForEach(articles, func(item *domain.Article, index int) { |
| 45 | images := make([]string, 0) | 46 | images := make([]string, 0) |
| 46 | lo.ForEach(item.Images, func(img domain.Image, n int) { | 47 | lo.ForEach(item.Images, func(img domain.Image, n int) { |
| @@ -49,6 +50,7 @@ func (l *SystemSearchArticleLogic) SystemSearchArticle(req *types.SystemArticleS | @@ -49,6 +50,7 @@ func (l *SystemSearchArticleLogic) SystemSearchArticle(req *types.SystemArticleS | ||
| 49 | resp.List = append(resp.List, types.SystemArticleSearch{ | 50 | resp.List = append(resp.List, types.SystemArticleSearch{ |
| 50 | Id: item.Id, | 51 | Id: item.Id, |
| 51 | Title: item.Title, | 52 | Title: item.Title, |
| 53 | + AuthorId: item.AuthorId, | ||
| 52 | Author: item.Author.Name, | 54 | Author: item.Author.Name, |
| 53 | Images: images, | 55 | Images: images, |
| 54 | CreatedAt: item.CreatedAt, | 56 | CreatedAt: item.CreatedAt, |
| @@ -58,6 +60,16 @@ func (l *SystemSearchArticleLogic) SystemSearchArticle(req *types.SystemArticleS | @@ -58,6 +60,16 @@ func (l *SystemSearchArticleLogic) SystemSearchArticle(req *types.SystemArticleS | ||
| 58 | Tags: nil, | 60 | Tags: nil, |
| 59 | TargetUser: int(item.TargetUser), | 61 | TargetUser: int(item.TargetUser), |
| 60 | }) | 62 | }) |
| 63 | + authorIds = append(authorIds, item.AuthorId) | ||
| 64 | + }) | ||
| 65 | + //查询用户数据,重新赋值更新用户名称 | ||
| 66 | + _, users, _ := l.svcCtx.UserRepository.Find(l.ctx, conn, domain.NewQueryOptions().WithFindOnly().WithKV("ids", authorIds)) | ||
| 67 | + lo.ForEach(resp.List, func(item types.SystemArticleSearch, index int) { | ||
| 68 | + for _, user := range users { | ||
| 69 | + if user.Id == item.AuthorId { | ||
| 70 | + resp.List[index].Author = user.Name | ||
| 71 | + } | ||
| 72 | + } | ||
| 61 | }) | 73 | }) |
| 62 | return resp, nil | 74 | return resp, nil |
| 63 | } | 75 | } |
| @@ -2,7 +2,6 @@ package comment | @@ -2,7 +2,6 @@ package comment | ||
| 2 | 2 | ||
| 3 | import ( | 3 | import ( |
| 4 | "context" | 4 | "context" |
| 5 | - | ||
| 6 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" | 5 | "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" | 6 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" |
| 8 | "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" |
| @@ -29,61 +28,69 @@ func NewMiniDeleteArticleCommentLogic(ctx context.Context, svcCtx *svc.ServiceCo | @@ -29,61 +28,69 @@ func NewMiniDeleteArticleCommentLogic(ctx context.Context, svcCtx *svc.ServiceCo | ||
| 29 | // 小程序端人人员删除评论 | 28 | // 小程序端人人员删除评论 |
| 30 | func (l *MiniDeleteArticleCommentLogic) MiniDeleteArticleComment(req *types.MiniDeleteArticleCommentRequest) (resp *types.MiniDeleteArticleCommentResponse, err error) { | 29 | func (l *MiniDeleteArticleCommentLogic) MiniDeleteArticleComment(req *types.MiniDeleteArticleCommentRequest) (resp *types.MiniDeleteArticleCommentResponse, err error) { |
| 31 | var conn = l.svcCtx.DefaultDBConn() | 30 | var conn = l.svcCtx.DefaultDBConn() |
| 32 | - commetInfo, err := l.svcCtx.ArticleCommentRepository.FindOne(l.ctx, conn, req.CommentId) | 31 | + commentInfo, err := l.svcCtx.ArticleCommentRepository.FindOne(l.ctx, conn, req.CommentId) |
| 33 | if err != nil { | 32 | if err != nil { |
| 34 | return nil, xerr.NewErrMsgErr("删除评论信息失败", err) | 33 | return nil, xerr.NewErrMsgErr("删除评论信息失败", err) |
| 35 | } | 34 | } |
| 36 | 35 | ||
| 37 | - if commetInfo.FromUserId != req.UserId { | 36 | + if commentInfo.FromUserId != req.UserId { |
| 38 | return nil, xerr.NewErrMsg("没有操作权限") | 37 | return nil, xerr.NewErrMsg("没有操作权限") |
| 39 | } | 38 | } |
| 40 | 39 | ||
| 41 | - if commetInfo.Show == domain.CommentShowDisable { | 40 | + if commentInfo.Show == domain.CommentShowDisable { |
| 42 | resp = &types.MiniDeleteArticleCommentResponse{ | 41 | resp = &types.MiniDeleteArticleCommentResponse{ |
| 43 | - Id: commetInfo.Id, | 42 | + Id: commentInfo.Id, |
| 44 | } | 43 | } |
| 45 | return resp, nil | 44 | return resp, nil |
| 46 | } | 45 | } |
| 47 | - commetInfo.Show = domain.CommentShowDisable | 46 | + commentInfo.Show = domain.CommentShowDisable |
| 48 | 47 | ||
| 49 | // 变更回复数量 | 48 | // 变更回复数量 |
| 50 | err = transaction.UseTrans(l.ctx, conn.DB(), func(ctx context.Context, c transaction.Conn) error { | 49 | err = transaction.UseTrans(l.ctx, conn.DB(), func(ctx context.Context, c transaction.Conn) error { |
| 51 | - _, err = l.svcCtx.ArticleCommentRepository.Update(ctx, c, commetInfo) | 50 | + _, err = l.svcCtx.ArticleCommentRepository.Update(ctx, c, commentInfo) |
| 52 | if err != nil { | 51 | if err != nil { |
| 53 | return err | 52 | return err |
| 54 | } | 53 | } |
| 55 | // 减少上级评论的回复数量 | 54 | // 减少上级评论的回复数量 |
| 56 | - if commetInfo.Pid != 0 { | ||
| 57 | - err = l.svcCtx.ArticleCommentRepository.IncreaseCountReply(l.ctx, c, -1, commetInfo.Pid) | 55 | + if commentInfo.Pid != 0 { |
| 56 | + err = l.svcCtx.ArticleCommentRepository.IncreaseCountReply(l.ctx, c, -1, commentInfo.Pid) | ||
| 58 | if err != nil { | 57 | if err != nil { |
| 59 | return err | 58 | return err |
| 60 | } | 59 | } |
| 61 | } | 60 | } |
| 62 | // 减少最顶层的评论回复计数 | 61 | // 减少最顶层的评论回复计数 |
| 63 | - if commetInfo.TopId != 0 && commetInfo.Pid != commetInfo.TopId { | ||
| 64 | - err = l.svcCtx.ArticleCommentRepository.IncreaseCountReply(l.ctx, c, -1, commetInfo.TopId) | 62 | + if commentInfo.TopId != 0 && commentInfo.Pid != commentInfo.TopId { |
| 63 | + err = l.svcCtx.ArticleCommentRepository.IncreaseCountReply(l.ctx, c, -1, commentInfo.TopId) | ||
| 65 | if err != nil { | 64 | if err != nil { |
| 66 | return err | 65 | return err |
| 67 | } | 66 | } |
| 68 | } | 67 | } |
| 69 | //减少加段落评论计数 | 68 | //减少加段落评论计数 |
| 70 | - if commetInfo.SectionId > 0 { | ||
| 71 | - err = l.svcCtx.ArticleSectionRepository.IncreaseCountComment(ctx, c, -1, commetInfo.SectionId) | 69 | + if commentInfo.SectionId > 0 { |
| 70 | + err = l.svcCtx.ArticleSectionRepository.IncreaseCountComment(ctx, c, -1, commentInfo.SectionId) | ||
| 72 | if err != nil { | 71 | if err != nil { |
| 73 | return err | 72 | return err |
| 74 | } | 73 | } |
| 75 | } | 74 | } |
| 76 | // 减少文章的评论数 | 75 | // 减少文章的评论数 |
| 77 | - err = l.svcCtx.ArticleRepository.IncreaseCountComment(ctx, c, -1, commetInfo.ArticleId) | 76 | + err = l.svcCtx.ArticleRepository.IncreaseCountComment(ctx, c, -1, commentInfo.ArticleId) |
| 78 | if err != nil { | 77 | if err != nil { |
| 79 | return err | 78 | return err |
| 80 | } | 79 | } |
| 80 | + | ||
| 81 | + //// 评论被隐藏消息 | ||
| 82 | + //var messageLogic = message.NewMiniSystemLogic(l.ctx, l.svcCtx) | ||
| 83 | + //err = messageLogic.AbnormalCommentHidden(c, commentInfo.CompanyId, commentInfo.FromUserId, commentInfo.Content) | ||
| 84 | + //if err != nil { | ||
| 85 | + // return err | ||
| 86 | + //} | ||
| 87 | + | ||
| 81 | return nil | 88 | return nil |
| 82 | }, true) | 89 | }, true) |
| 83 | 90 | ||
| 84 | if err != nil { | 91 | if err != nil { |
| 85 | return nil, xerr.NewErrMsgErr("删除评论信息失败", err) | 92 | return nil, xerr.NewErrMsgErr("删除评论信息失败", err) |
| 86 | } | 93 | } |
| 87 | - resp = &types.MiniDeleteArticleCommentResponse{Id: commetInfo.Id} | 94 | + resp = &types.MiniDeleteArticleCommentResponse{Id: commentInfo.Id} |
| 88 | return resp, nil | 95 | return resp, nil |
| 89 | } | 96 | } |
| @@ -35,9 +35,11 @@ func (l *SystemArticleCommentSearchLogic) SystemArticleCommentSearch(req *types. | @@ -35,9 +35,11 @@ func (l *SystemArticleCommentSearchLogic) SystemArticleCommentSearch(req *types. | ||
| 35 | WithKV("articleId", req.ArticleId). | 35 | WithKV("articleId", req.ArticleId). |
| 36 | WithKV("topId", req.TopId). | 36 | WithKV("topId", req.TopId). |
| 37 | WithKV("show", req.Show). | 37 | WithKV("show", req.Show). |
| 38 | - WithKV("fromUserName", req.Author). | ||
| 39 | WithKV("beginCreatedAt", req.BeginTime). | 38 | WithKV("beginCreatedAt", req.BeginTime). |
| 40 | WithKV("endCreatedAt", req.EndTime) | 39 | WithKV("endCreatedAt", req.EndTime) |
| 40 | + if req.Author > 0 { | ||
| 41 | + queryOptions = queryOptions.WithKV("fromUserId", req.Author) | ||
| 42 | + } | ||
| 41 | total, comments, err := l.svcCtx.ArticleCommentRepository.Find(l.ctx, conn, queryOptions) | 43 | total, comments, err := l.svcCtx.ArticleCommentRepository.Find(l.ctx, conn, queryOptions) |
| 42 | if err != nil { | 44 | if err != nil { |
| 43 | return nil, xerr.NewErrMsgErr("获取文章评论失败", err) | 45 | return nil, xerr.NewErrMsgErr("获取文章评论失败", err) |
| @@ -46,6 +48,7 @@ func (l *SystemArticleCommentSearchLogic) SystemArticleCommentSearch(req *types. | @@ -46,6 +48,7 @@ func (l *SystemArticleCommentSearchLogic) SystemArticleCommentSearch(req *types. | ||
| 46 | Total: total, | 48 | Total: total, |
| 47 | List: make([]types.SystemArticleCommentSearchItem, 0), | 49 | List: make([]types.SystemArticleCommentSearchItem, 0), |
| 48 | } | 50 | } |
| 51 | + authorIds := make([]int64, 0) | ||
| 49 | lo.ForEach(comments, func(item *domain.ArticleComment, index int) { | 52 | lo.ForEach(comments, func(item *domain.ArticleComment, index int) { |
| 50 | resp.List = append(resp.List, types.SystemArticleCommentSearchItem{ | 53 | resp.List = append(resp.List, types.SystemArticleCommentSearchItem{ |
| 51 | Id: item.Id, | 54 | Id: item.Id, |
| @@ -68,6 +71,22 @@ func (l *SystemArticleCommentSearchLogic) SystemArticleCommentSearch(req *types. | @@ -68,6 +71,22 @@ func (l *SystemArticleCommentSearchLogic) SystemArticleCommentSearch(req *types. | ||
| 68 | Content: item.Content, | 71 | Content: item.Content, |
| 69 | Show: int(item.Show), | 72 | Show: int(item.Show), |
| 70 | }) | 73 | }) |
| 74 | + authorIds = append(authorIds, item.FromUserId) | ||
| 75 | + }) | ||
| 76 | + //查询用户数据,重新赋值更新用户名称 | ||
| 77 | + _, users, _ := l.svcCtx.UserRepository.Find(l.ctx, conn, domain.NewQueryOptions().WithFindOnly().WithKV("ids", authorIds)) | ||
| 78 | + lo.ForEach(resp.List, func(item types.SystemArticleCommentSearchItem, index int) { | ||
| 79 | + for _, user := range users { | ||
| 80 | + if user.Id == item.FromUserId { | ||
| 81 | + resp.List[index].FromUser = types.CommentAuthor{ | ||
| 82 | + Id: user.Id, | ||
| 83 | + Name: user.Name, | ||
| 84 | + Avatar: user.Avatar, | ||
| 85 | + Position: user.Position, | ||
| 86 | + Company: item.FromUser.Company, | ||
| 87 | + } | ||
| 88 | + } | ||
| 89 | + } | ||
| 71 | }) | 90 | }) |
| 72 | return | 91 | return |
| 73 | } | 92 | } |
| @@ -2,6 +2,7 @@ package comment | @@ -2,6 +2,7 @@ package comment | ||
| 2 | 2 | ||
| 3 | import ( | 3 | import ( |
| 4 | "context" | 4 | "context" |
| 5 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/message" | ||
| 5 | 6 | ||
| 6 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" | 7 | "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" | 8 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" |
| @@ -61,49 +62,57 @@ func (l *SystemEditAticleCommentShowLogic) SystemEditAticleCommentShow(req *type | @@ -61,49 +62,57 @@ func (l *SystemEditAticleCommentShowLogic) SystemEditAticleCommentShow(req *type | ||
| 61 | 62 | ||
| 62 | func (l *SystemEditAticleCommentShowLogic) disableShow(commentId int64, companyId int64) error { | 63 | func (l *SystemEditAticleCommentShowLogic) disableShow(commentId int64, companyId int64) error { |
| 63 | var conn = l.svcCtx.DefaultDBConn() | 64 | var conn = l.svcCtx.DefaultDBConn() |
| 64 | - commetInfo, err := l.svcCtx.ArticleCommentRepository.FindOne(l.ctx, conn, commentId) | 65 | + commentInfo, err := l.svcCtx.ArticleCommentRepository.FindOne(l.ctx, conn, commentId) |
| 65 | if err != nil { | 66 | if err != nil { |
| 66 | return xerr.NewErrMsgErr("删除评论信息失败", err) | 67 | return xerr.NewErrMsgErr("删除评论信息失败", err) |
| 67 | } | 68 | } |
| 68 | - if commetInfo.CompanyId != companyId { | 69 | + if commentInfo.CompanyId != companyId { |
| 69 | return xerr.NewErrMsg("没有操作权限") | 70 | return xerr.NewErrMsg("没有操作权限") |
| 70 | } | 71 | } |
| 71 | - if commetInfo.Show == domain.CommentShowDisable { | 72 | + if commentInfo.Show == domain.CommentShowDisable { |
| 72 | return nil | 73 | return nil |
| 73 | } | 74 | } |
| 74 | - commetInfo.Show = domain.CommentShowDisable | 75 | + commentInfo.Show = domain.CommentShowDisable |
| 75 | // 变更回复数量 | 76 | // 变更回复数量 |
| 76 | err = transaction.UseTrans(l.ctx, conn.DB(), func(ctx context.Context, c transaction.Conn) error { | 77 | err = transaction.UseTrans(l.ctx, conn.DB(), func(ctx context.Context, c transaction.Conn) error { |
| 77 | - _, err = l.svcCtx.ArticleCommentRepository.Update(ctx, c, commetInfo) | 78 | + _, err = l.svcCtx.ArticleCommentRepository.Update(ctx, c, commentInfo) |
| 78 | if err != nil { | 79 | if err != nil { |
| 79 | return err | 80 | return err |
| 80 | } | 81 | } |
| 81 | // 减少上级评论的回复数量 | 82 | // 减少上级评论的回复数量 |
| 82 | - if commetInfo.Pid != 0 { | ||
| 83 | - err = l.svcCtx.ArticleCommentRepository.IncreaseCountReply(l.ctx, c, -1, commetInfo.Pid) | 83 | + if commentInfo.Pid != 0 { |
| 84 | + err = l.svcCtx.ArticleCommentRepository.IncreaseCountReply(l.ctx, c, -1, commentInfo.Pid) | ||
| 84 | if err != nil { | 85 | if err != nil { |
| 85 | return err | 86 | return err |
| 86 | } | 87 | } |
| 87 | } | 88 | } |
| 88 | // 减少最顶层的评论回复计数 | 89 | // 减少最顶层的评论回复计数 |
| 89 | - if commetInfo.TopId != 0 && commetInfo.Pid != commetInfo.TopId { | ||
| 90 | - err = l.svcCtx.ArticleCommentRepository.IncreaseCountReply(l.ctx, c, -1, commetInfo.TopId) | 90 | + if commentInfo.TopId != 0 && commentInfo.Pid != commentInfo.TopId { |
| 91 | + err = l.svcCtx.ArticleCommentRepository.IncreaseCountReply(l.ctx, c, -1, commentInfo.TopId) | ||
| 91 | if err != nil { | 92 | if err != nil { |
| 92 | return err | 93 | return err |
| 93 | } | 94 | } |
| 94 | } | 95 | } |
| 95 | //减少加段落评论计数 | 96 | //减少加段落评论计数 |
| 96 | - if commetInfo.SectionId > 0 { | ||
| 97 | - err = l.svcCtx.ArticleSectionRepository.IncreaseCountComment(ctx, c, -1, commetInfo.SectionId) | 97 | + if commentInfo.SectionId > 0 { |
| 98 | + err = l.svcCtx.ArticleSectionRepository.IncreaseCountComment(ctx, c, -1, commentInfo.SectionId) | ||
| 98 | if err != nil { | 99 | if err != nil { |
| 99 | return err | 100 | return err |
| 100 | } | 101 | } |
| 101 | } | 102 | } |
| 102 | // 减少文章的评论数 | 103 | // 减少文章的评论数 |
| 103 | - err = l.svcCtx.ArticleRepository.IncreaseCountComment(ctx, c, -1, commetInfo.ArticleId) | 104 | + err = l.svcCtx.ArticleRepository.IncreaseCountComment(ctx, c, -1, commentInfo.ArticleId) |
| 104 | if err != nil { | 105 | if err != nil { |
| 105 | return err | 106 | return err |
| 106 | } | 107 | } |
| 108 | + | ||
| 109 | + // 评论被隐藏消息 | ||
| 110 | + var messageLogic = message.NewMiniSystemLogic(l.ctx, l.svcCtx) | ||
| 111 | + err = messageLogic.AbnormalCommentHidden(c, commentInfo.CompanyId, commentInfo.FromUserId, commentInfo.Content) | ||
| 112 | + if err != nil { | ||
| 113 | + return err | ||
| 114 | + } | ||
| 115 | + | ||
| 107 | return nil | 116 | return nil |
| 108 | }, true) | 117 | }, true) |
| 109 | 118 |
| @@ -165,14 +165,14 @@ type SystemArticleCommentSearchMeResponse struct { | @@ -165,14 +165,14 @@ type SystemArticleCommentSearchMeResponse struct { | ||
| 165 | } | 165 | } |
| 166 | 166 | ||
| 167 | type SystemArticleCommentSearchRequest struct { | 167 | type SystemArticleCommentSearchRequest struct { |
| 168 | - Page int `json:"page"` | ||
| 169 | - Size int `json:"size"` | ||
| 170 | - ArticleId int64 `json:"articleId"` // 文章ID | ||
| 171 | - TopId int64 `json:"topId,optional"` // 文章顶层ID | ||
| 172 | - Author string `json:"author,optional"` // 用户 | ||
| 173 | - Show int `json:"show,optional"` // 显示状态 | ||
| 174 | - BeginTime int64 `json:"beginTime,optional"` // 开始时间 | ||
| 175 | - EndTime int64 `json:"endTime,optional"` // 结束时间 | 168 | + Page int `json:"page"` |
| 169 | + Size int `json:"size"` | ||
| 170 | + ArticleId int64 `json:"articleId"` // 文章ID | ||
| 171 | + TopId int64 `json:"topId,optional"` // 文章顶层ID | ||
| 172 | + Author int64 `json:"author,optional"` // 用户 | ||
| 173 | + Show int `json:"show,optional"` // 显示状态 | ||
| 174 | + BeginTime int64 `json:"beginTime,optional"` // 开始时间 | ||
| 175 | + EndTime int64 `json:"endTime,optional"` // 结束时间 | ||
| 176 | } | 176 | } |
| 177 | 177 | ||
| 178 | type SystemArticleCommentSearchResponse struct { | 178 | type SystemArticleCommentSearchResponse struct { |
| @@ -1156,7 +1156,7 @@ type SystemArticleGetResponse struct { | @@ -1156,7 +1156,7 @@ type SystemArticleGetResponse struct { | ||
| 1156 | type SystemArticleSearchRequest struct { | 1156 | type SystemArticleSearchRequest struct { |
| 1157 | CompanyId int64 `json:"companyId,optional"` | 1157 | CompanyId int64 `json:"companyId,optional"` |
| 1158 | Title string `json:"title,optional"` //标题 | 1158 | Title string `json:"title,optional"` //标题 |
| 1159 | - Author string `json:"author,optional"` //发布人 | 1159 | + Author int64 `json:"author,optional"` //发布人 |
| 1160 | BeginTime int64 `json:"beginTime,optional"` //开始时间 | 1160 | BeginTime int64 `json:"beginTime,optional"` //开始时间 |
| 1161 | EndTime int64 `json:"endTime,optional"` //结束时间 | 1161 | EndTime int64 `json:"endTime,optional"` //结束时间 |
| 1162 | Tags []int64 `json:"tags,optional"` //标签 | 1162 | Tags []int64 `json:"tags,optional"` //标签 |
| @@ -1172,6 +1172,7 @@ type SystemArticleSearchResponse struct { | @@ -1172,6 +1172,7 @@ type SystemArticleSearchResponse struct { | ||
| 1172 | type SystemArticleSearch struct { | 1172 | type SystemArticleSearch struct { |
| 1173 | Id int64 `json:"id"` //id | 1173 | Id int64 `json:"id"` //id |
| 1174 | Title string `json:"title"` //标题 | 1174 | Title string `json:"title"` //标题 |
| 1175 | + AuthorId int64 `json:"author"` //发布人ID | ||
| 1175 | Author string `json:"author"` //发布人 | 1176 | Author string `json:"author"` //发布人 |
| 1176 | Images []string `json:"images"` //图片 | 1177 | Images []string `json:"images"` //图片 |
| 1177 | CreatedAt int64 `json:"createdAt"` //文章的创建日期 | 1178 | CreatedAt int64 `json:"createdAt"` //文章的创建日期 |
| @@ -127,9 +127,6 @@ func (repository *ArticleRepository) Find(ctx context.Context, conn transaction. | @@ -127,9 +127,6 @@ func (repository *ArticleRepository) Find(ctx context.Context, conn transaction. | ||
| 127 | if v, ok := queryOptions["title"]; ok && v.(string) != "" { | 127 | if v, ok := queryOptions["title"]; ok && v.(string) != "" { |
| 128 | tx = tx.Where("title like ?", "%"+v.(string)+"%") | 128 | tx = tx.Where("title like ?", "%"+v.(string)+"%") |
| 129 | } | 129 | } |
| 130 | - if v, ok := queryOptions["author"]; ok && v.(string) != "" { | ||
| 131 | - tx = tx.Where(`author #>> '{"name"}' like ?`, "%"+v.(string)+"%") | ||
| 132 | - } | ||
| 133 | if v, ok := queryOptions["beginCreatedAt"]; ok { | 130 | if v, ok := queryOptions["beginCreatedAt"]; ok { |
| 134 | tx = tx.Where("created_at >= ?", v) | 131 | tx = tx.Where("created_at >= ?", v) |
| 135 | } | 132 | } |
-
请 注册 或 登录 后发表评论