作者 tangxvhui

修复 4445 ;修复, 评论列表回复内容没有出来

@@ -7,6 +7,9 @@ @@ -7,6 +7,9 @@
7 管理后台“易数家“前端入口:https://digital-front-platform-dev.fjmaimaimai.com/ 7 管理后台“易数家“前端入口:https://digital-front-platform-dev.fjmaimaimai.com/
8 跳转后的实际管理后台地址: https://sumifcc-x-front-test.sumifcc.com 8 跳转后的实际管理后台地址: https://sumifcc-x-front-test.sumifcc.com
9 9
  10 + 样例账号 18860183050 密码 123456
  11 +
  12 +
10 ### 可设置环境变量 13 ### 可设置环境变量
11 - DataSource 14 - DataSource
12 数据库连接,样例 15 数据库连接,样例
@@ -5,6 +5,7 @@ import ( @@ -5,6 +5,7 @@ import (
5 "strconv" 5 "strconv"
6 "strings" 6 "strings"
7 "text/template" 7 "text/template"
  8 + "unicode"
8 9
9 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" 10 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
10 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" 11 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
@@ -34,6 +35,19 @@ func NewMiniCreateArticleLogic(ctx context.Context, svcCtx *svc.ServiceContext) @@ -34,6 +35,19 @@ func NewMiniCreateArticleLogic(ctx context.Context, svcCtx *svc.ServiceContext)
34 // 创建新文章 35 // 创建新文章
35 func (l *MiniCreateArticleLogic) MiniCreateArticle(req *types.MiniArticleCreateRequest) (resp *types.MiniArticleCreateResponse, err error) { 36 func (l *MiniCreateArticleLogic) MiniCreateArticle(req *types.MiniArticleCreateRequest) (resp *types.MiniArticleCreateResponse, err error) {
36 var conn = l.svcCtx.DefaultDBConn() 37 var conn = l.svcCtx.DefaultDBConn()
  38 +
  39 + // 检查文字数量
  40 + wordNum := 0
  41 + for i := range req.Section {
  42 + for _, word := range req.Section[i] {
  43 + if !unicode.IsSpace(word) {
  44 + wordNum++
  45 + }
  46 + }
  47 + }
  48 + if wordNum > 1000 {
  49 + return nil, xerr.NewErrMsgErr("最多只能输入1000字", err)
  50 + }
37 // 检查发布人 51 // 检查发布人
38 author, err := l.svcCtx.UserRepository.FindOne(l.ctx, conn, req.AuthorId) 52 author, err := l.svcCtx.UserRepository.FindOne(l.ctx, conn, req.AuthorId)
39 if err != nil { 53 if err != nil {
@@ -36,8 +36,8 @@ func (l *MiniListArticleCommentLogic) MiniListArticleComment(req *types.MiniList @@ -36,8 +36,8 @@ func (l *MiniListArticleCommentLogic) MiniListArticleComment(req *types.MiniList
36 if err != nil { 36 if err != nil {
37 return nil, xerr.NewErrMsgErr("获取评论信息失败", err) 37 return nil, xerr.NewErrMsgErr("获取评论信息失败", err)
38 } 38 }
39 - if req.Size > 40 {  
40 - req.Size = 40 39 + if req.Size > 100 {
  40 + req.Size = 100
41 } 41 }
42 42
43 queryOption := domain.NewQueryOptions(). 43 queryOption := domain.NewQueryOptions().
@@ -119,7 +119,7 @@ func (l *MiniListArticleCommentLogic) MiniListArticleComment(req *types.MiniList @@ -119,7 +119,7 @@ func (l *MiniListArticleCommentLogic) MiniListArticleComment(req *types.MiniList
119 } 119 }
120 120
121 //获取回复的评论 121 //获取回复的评论
122 - cntReply, reply := l.listCommentReply(item.Comment.Id, flagMap) 122 + cntReply, reply := l.listCommentReply(companyInfo.Id, item.Comment.Id, flagMap)
123 resp.List[i] = item 123 resp.List[i] = item
124 resp.List[i].Reply = reply 124 resp.List[i].Reply = reply
125 resp.List[i].TotalReply = cntReply 125 resp.List[i].TotalReply = cntReply
@@ -128,9 +128,9 @@ func (l *MiniListArticleCommentLogic) MiniListArticleComment(req *types.MiniList @@ -128,9 +128,9 @@ func (l *MiniListArticleCommentLogic) MiniListArticleComment(req *types.MiniList
128 } 128 }
129 129
130 // listCommentReply 130 // listCommentReply
131 -func (l *MiniListArticleCommentLogic) listCommentReply(commentId int64, loveFlagMap map[int64]struct{}) (cnt int64, replyList []types.ArticleCommentItem) { 131 +func (l *MiniListArticleCommentLogic) listCommentReply(companyId int64, commentId int64, loveFlagMap map[int64]struct{}) (cnt int64, replyList []types.ArticleCommentItem) {
132 var conn = l.svcCtx.DefaultDBConn() 132 var conn = l.svcCtx.DefaultDBConn()
133 - companyInfo, err := l.svcCtx.CompanyRepository.FindOne(l.ctx, conn, commentId) 133 + companyInfo, err := l.svcCtx.CompanyRepository.FindOne(l.ctx, conn, companyId)
134 if err != nil { 134 if err != nil {
135 return 0, []types.ArticleCommentItem{} 135 return 0, []types.ArticleCommentItem{}
136 } 136 }
@@ -2,8 +2,9 @@ package domain @@ -2,8 +2,9 @@ package domain
2 2
3 import ( 3 import (
4 "context" 4 "context"
5 - "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction"  
6 "reflect" 5 "reflect"
  6 +
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction"
7 ) 8 )
8 9
9 func OffsetLimit(page, size int) (offset int, limit int) { 10 func OffsetLimit(page, size int) (offset int, limit int) {