作者 tangxvhui

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

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