作者 tangxvhui

Merge branch 'dev' into test

... ... @@ -185,14 +185,15 @@ func (l *MiniCreateArticleCommentLogic) MiniCreateArticleComment(req *types.Mini
}
}
//增加评论回复计数
if pComment != nil {
err = l.svcCtx.ArticleCommentRepository.IncreaseCountReply(l.ctx, c, 1, pComment.Id)
if err != nil {
return err
}
}
// if pComment != nil {
// err = l.svcCtx.ArticleCommentRepository.IncreaseCountReply(l.ctx, c, 1, pComment.Id)
// if err != nil {
// return err
// }
// }
// 增加最顶层的评论回复计数
if newComment.TopId != 0 && newComment.Pid != newComment.TopId {
// if newComment.TopId != 0 && newComment.Pid != newComment.TopId {
if newComment.TopId != 0 {
err = l.svcCtx.ArticleCommentRepository.IncreaseCountReply(l.ctx, c, 1, newComment.TopId)
if err != nil {
return err
... ...
... ... @@ -2,6 +2,7 @@ package comment
import (
"context"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction"
... ... @@ -52,14 +53,15 @@ func (l *MiniDeleteArticleCommentLogic) MiniDeleteArticleComment(req *types.Mini
return err
}
// 减少上级评论的回复数量
if commentInfo.Pid != 0 {
err = l.svcCtx.ArticleCommentRepository.IncreaseCountReply(l.ctx, c, -1, commentInfo.Pid)
if err != nil {
return err
}
}
// if commentInfo.Pid != 0 {
// err = l.svcCtx.ArticleCommentRepository.IncreaseCountReply(l.ctx, c, -1, commentInfo.Pid)
// if err != nil {
// return err
// }
// }
// 减少最顶层的评论回复计数
if commentInfo.TopId != 0 && commentInfo.Pid != commentInfo.TopId {
// if commentInfo.TopId != 0 && commentInfo.Pid != commentInfo.TopId {
if commentInfo.TopId != 0 {
err = l.svcCtx.ArticleCommentRepository.IncreaseCountReply(l.ctx, c, -1, commentInfo.TopId)
if err != nil {
return err
... ... @@ -67,18 +69,32 @@ func (l *MiniDeleteArticleCommentLogic) MiniDeleteArticleComment(req *types.Mini
}
//减少加段落评论计数
if commentInfo.SectionId > 0 {
err = l.svcCtx.ArticleSectionRepository.IncreaseCountComment(ctx, c, -1, commentInfo.SectionId)
if err != nil {
return err
if commentInfo.TopId == 0 {
err = l.svcCtx.ArticleSectionRepository.IncreaseCountComment(ctx, c, -(commentInfo.CountReply + 1), commentInfo.SectionId)
if err != nil {
return err
}
} else {
err = l.svcCtx.ArticleSectionRepository.IncreaseCountComment(ctx, c, -1, commentInfo.SectionId)
if err != nil {
return err
}
}
}
// 减少文章的评论数
err = l.svcCtx.ArticleRepository.IncreaseCountComment(ctx, c, -1, commentInfo.ArticleId)
if err != nil {
return err
if commentInfo.TopId == 0 {
err = l.svcCtx.ArticleRepository.IncreaseCountComment(ctx, c, -(commentInfo.CountReply + 1), commentInfo.ArticleId)
if err != nil {
return err
}
} else {
err = l.svcCtx.ArticleRepository.IncreaseCountComment(ctx, c, -1, commentInfo.ArticleId)
if err != nil {
return err
}
}
//// 评论被隐藏消息
// 评论被隐藏消息
//var messageLogic = message.NewMiniSystemLogic(l.ctx, l.svcCtx)
//err = messageLogic.AbnormalCommentHidden(c, commentInfo.CompanyId, commentInfo.FromUserId, commentInfo.Content)
//if err != nil {
... ...
... ... @@ -70,13 +70,13 @@ func (l *SystemEditAticleCommentLogic) SystemEditAticleComment(req *types.System
// 设置为显示评论
if commetInfo.Show != domain.CommentShowEnable {
commetInfo.Show = domain.CommentShowEnable
increaseCount = 1
increaseCount = commetInfo.CountReply + 1
}
case 2:
// 设置为隐藏评论
if commetInfo.Show != domain.CommentShowDisable {
commetInfo.Show = domain.CommentShowDisable
increaseCount = -1
increaseCount = -(commetInfo.CountReply + 1)
}
}
... ... @@ -88,14 +88,15 @@ func (l *SystemEditAticleCommentLogic) SystemEditAticleComment(req *types.System
}
if increaseCount != 0 {
// 增加上级评论的回复数量
if commetInfo.Pid != 0 {
err = l.svcCtx.ArticleCommentRepository.IncreaseCountReply(l.ctx, c, increaseCount, commetInfo.Pid)
if err != nil {
return err
}
}
// if commetInfo.Pid != 0 {
// err = l.svcCtx.ArticleCommentRepository.IncreaseCountReply(l.ctx, c, increaseCount, commetInfo.Pid)
// if err != nil {
// return err
// }
// }
// 增加最顶层的评论回复计数
if commetInfo.TopId != 0 && commetInfo.Pid != commetInfo.TopId {
// if commetInfo.TopId != 0 && commetInfo.Pid != commetInfo.TopId {
if commetInfo.TopId != 0 {
err = l.svcCtx.ArticleCommentRepository.IncreaseCountReply(l.ctx, c, increaseCount, commetInfo.TopId)
if err != nil {
return err
... ...
... ... @@ -2,6 +2,7 @@ package comment
import (
"context"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/message"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
... ... @@ -80,14 +81,15 @@ func (l *SystemEditAticleCommentShowLogic) disableShow(commentId int64, companyI
return err
}
// 减少上级评论的回复数量
if commentInfo.Pid != 0 {
err = l.svcCtx.ArticleCommentRepository.IncreaseCountReply(l.ctx, c, -1, commentInfo.Pid)
if err != nil {
return err
}
}
// if commentInfo.Pid != 0 {
// err = l.svcCtx.ArticleCommentRepository.IncreaseCountReply(l.ctx, c, -1, commentInfo.Pid)
// if err != nil {
// return err
// }
// }
// 减少最顶层的评论回复计数
if commentInfo.TopId != 0 && commentInfo.Pid != commentInfo.TopId {
// if commentInfo.TopId != 0 && commentInfo.Pid != commentInfo.TopId {
if commentInfo.TopId != 0 {
err = l.svcCtx.ArticleCommentRepository.IncreaseCountReply(l.ctx, c, -1, commentInfo.TopId)
if err != nil {
return err
... ... @@ -95,15 +97,29 @@ func (l *SystemEditAticleCommentShowLogic) disableShow(commentId int64, companyI
}
//减少加段落评论计数
if commentInfo.SectionId > 0 {
err = l.svcCtx.ArticleSectionRepository.IncreaseCountComment(ctx, c, -1, commentInfo.SectionId)
if err != nil {
return err
if commentInfo.TopId == 0 {
err = l.svcCtx.ArticleSectionRepository.IncreaseCountComment(ctx, c, -(commentInfo.CountReply + 1), commentInfo.SectionId)
if err != nil {
return err
}
} else {
err = l.svcCtx.ArticleSectionRepository.IncreaseCountComment(ctx, c, -1, commentInfo.SectionId)
if err != nil {
return err
}
}
}
// 减少文章的评论数
err = l.svcCtx.ArticleRepository.IncreaseCountComment(ctx, c, -1, commentInfo.ArticleId)
if err != nil {
return err
if commentInfo.TopId == 0 {
err = l.svcCtx.ArticleRepository.IncreaseCountComment(ctx, c, -(commentInfo.CountReply + 1), commentInfo.ArticleId)
if err != nil {
return err
}
} else {
err = l.svcCtx.ArticleRepository.IncreaseCountComment(ctx, c, -1, commentInfo.ArticleId)
if err != nil {
return err
}
}
// 评论被隐藏消息
... ... @@ -142,14 +158,15 @@ func (l *SystemEditAticleCommentShowLogic) enableShow(commentId int64, companyId
return err
}
// 增加上级评论的回复数量
if commetInfo.Pid != 0 {
err = l.svcCtx.ArticleCommentRepository.IncreaseCountReply(l.ctx, c, 1, commetInfo.Pid)
if err != nil {
return err
}
}
// if commetInfo.Pid != 0 {
// err = l.svcCtx.ArticleCommentRepository.IncreaseCountReply(l.ctx, c, 1, commetInfo.Pid)
// if err != nil {
// return err
// }
// }
// 增加最顶层的评论回复计数
if commetInfo.TopId != 0 && commetInfo.Pid != commetInfo.TopId {
// if commetInfo.TopId != 0 && commetInfo.Pid != commetInfo.TopId {
if commetInfo.TopId != 0 {
err = l.svcCtx.ArticleCommentRepository.IncreaseCountReply(l.ctx, c, 1, commetInfo.TopId)
if err != nil {
return err
... ... @@ -157,15 +174,29 @@ func (l *SystemEditAticleCommentShowLogic) enableShow(commentId int64, companyId
}
//增加加段落评论计数
if commetInfo.SectionId > 0 {
err = l.svcCtx.ArticleSectionRepository.IncreaseCountComment(ctx, c, 1, commetInfo.SectionId)
if err != nil {
return err
if commetInfo.TopId == 0 {
err = l.svcCtx.ArticleSectionRepository.IncreaseCountComment(ctx, c, commetInfo.CountReply+1, commetInfo.SectionId)
if err != nil {
return err
}
} else {
err = l.svcCtx.ArticleSectionRepository.IncreaseCountComment(ctx, c, 1, commetInfo.SectionId)
if err != nil {
return err
}
}
}
// 增加文章的评论数
err = l.svcCtx.ArticleRepository.IncreaseCountComment(ctx, c, 1, commetInfo.ArticleId)
if err != nil {
return err
if commetInfo.TopId == 0 {
err = l.svcCtx.ArticleRepository.IncreaseCountComment(ctx, c, commetInfo.CountReply+1, commetInfo.ArticleId)
if err != nil {
return err
}
} else {
err = l.svcCtx.ArticleRepository.IncreaseCountComment(ctx, c, 1, commetInfo.ArticleId)
if err != nil {
return err
}
}
return nil
}, true)
... ...
... ... @@ -40,6 +40,9 @@ func (l *MiniUserAuditListLogic) MiniUserAuditList(req *types.UserSearchRequest)
MustWithKV("accountFrom", []string{domain.AccountFromSearchJoin})
if req.AuditFlag != nil && *req.AuditFlag >= 0 {
queryOptions.MustWithKV("auditStatus", []int{*req.AuditFlag})
if *req.AuditFlag == 2 {
queryOptions.MustWithKV("unscoped", true)
}
}
if total, users, err = l.svcCtx.UserRepository.Find(l.ctx, conn, queryOptions); err != nil {
return nil, xerr.NewErrMsgErr("查询审核列表失败", err)
... ...
... ... @@ -41,6 +41,11 @@ func (l *MiniUserAuditLogic) MiniUserAudit(req *types.MiniUserAuditRequest) (err
if user, err = l.svcCtx.UserRepository.UpdateWithVersion(ctx, conn, user); err != nil {
return err
}
if req.Status == domain.UserAuditStatusReject {
if user, err = l.svcCtx.UserRepository.Delete(ctx, conn, user); err != nil {
return err
}
}
return nil
}, true); err != nil {
return xerr.NewErrMsgErr("审核失败", err)
... ...
... ... @@ -144,6 +144,9 @@ func (repository *UserRepository) Find(ctx context.Context, conn transaction.Con
)
queryFunc := func() (interface{}, error) {
tx = tx.Model(&ms)
if v, ok := queryOptions["unscoped"]; ok && v.(bool) {
tx.Unscoped()
}
if v, ok := queryOptions["companyId"]; ok {
tx.Where("company_id = ?", v)
}
... ...