...
|
...
|
@@ -47,6 +47,35 @@ func (l *SystemEditAticleCommentLoveLogic) SystemEditAticleCommentLove(req *type |
|
|
if err != nil {
|
|
|
return nil, xerr.NewErrMsgErr("编辑评论信息失败", err)
|
|
|
}
|
|
|
|
|
|
for _, commetInfo := range commetList {
|
|
|
//检查运营点赞的值
|
|
|
//查找对应的文章
|
|
|
articleInfo, err := l.svcCtx.ArticleRepository.FindOne(l.ctx, conn, commetInfo.ArticleId)
|
|
|
if err != nil {
|
|
|
return nil, xerr.NewErrMsgErr("没有找到对应的文章", err)
|
|
|
}
|
|
|
var maxCount int
|
|
|
//获取文章可以被多少人查看
|
|
|
if articleInfo.TargetUser == domain.ArticleTargetLimit {
|
|
|
maxCount = commetInfo.MaxCountAdminLove(len(articleInfo.WhoRead))
|
|
|
} else {
|
|
|
//统计全员人数
|
|
|
queryOption := domain.NewQueryOptions().WithCountOnly().MustWithKV("companyId", req.CompanyId)
|
|
|
cnt, _, err := l.svcCtx.UserRepository.Find(l.ctx, conn, queryOption)
|
|
|
if err != nil {
|
|
|
return nil, xerr.NewErrMsgErr("获取人员数据失败", err)
|
|
|
}
|
|
|
maxCount = commetInfo.MaxCountAdminLove(int(cnt))
|
|
|
}
|
|
|
|
|
|
if paramCountData, ok := paramMap[commetInfo.Id]; ok {
|
|
|
if maxCount < paramCountData {
|
|
|
return nil, xerr.NewErrMsg("运营点数设置错误")
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
// 更新运营点赞数
|
|
|
resp = &types.SystemEditCommentLoveResponse{}
|
|
|
for _, val := range commetList {
|
|
|
if val.CompanyId != req.CompanyId {
|
...
|
...
|
|