Merge branch 'dev' of http://gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss into dev
正在显示
6 个修改的文件
包含
38 行增加
和
19 行删除
@@ -42,7 +42,10 @@ func (l *MiniArticleCommentAtWhoLogic) MiniArticleCommentAtWho(req *types.MiniAr | @@ -42,7 +42,10 @@ func (l *MiniArticleCommentAtWhoLogic) MiniArticleCommentAtWho(req *types.MiniAr | ||
42 | var userList []*domain.User | 42 | var userList []*domain.User |
43 | if articleInfo.TargetUser == domain.ArticleTargetAll { | 43 | if articleInfo.TargetUser == domain.ArticleTargetAll { |
44 | //获取所有人 | 44 | //获取所有人 |
45 | - queryOption := domain.NewQueryOptions().WithFindOnly().MustWithKV("companyId", articleInfo.CompanyId) | 45 | + queryOption := domain.NewQueryOptions().WithFindOnly(). |
46 | + MustWithKV("companyId", articleInfo.CompanyId). | ||
47 | + MustWithKV("auditStatus", []int{domain.UserAuditStatusPassed}) | ||
48 | + | ||
46 | _, userList, err = l.svcCtx.UserRepository.Find(l.ctx, conn, queryOption) | 49 | _, userList, err = l.svcCtx.UserRepository.Find(l.ctx, conn, queryOption) |
47 | if err != nil { | 50 | if err != nil { |
48 | resp = &types.MiniArticleCommentAtWhoResponse{} | 51 | resp = &types.MiniArticleCommentAtWhoResponse{} |
@@ -91,7 +91,9 @@ func (l *MiniCreateArticleCommentLogic) MiniCreateArticleComment(req *types.Mini | @@ -91,7 +91,9 @@ func (l *MiniCreateArticleCommentLogic) MiniCreateArticleComment(req *types.Mini | ||
91 | atWhoIds = append(atWhoIds, val.Id) | 91 | atWhoIds = append(atWhoIds, val.Id) |
92 | } | 92 | } |
93 | atWhoIds = lo.Uniq(atWhoIds) | 93 | atWhoIds = lo.Uniq(atWhoIds) |
94 | - queryOption := domain.NewQueryOptions().WithFindOnly().WithKV("ids", atWhoIds) | 94 | + queryOption := domain.NewQueryOptions().WithFindOnly(). |
95 | + WithKV("ids", atWhoIds). | ||
96 | + MustWithKV("auditStatus", []int{domain.UserAuditStatusPassed}) | ||
95 | _, atWhoList, err = l.svcCtx.UserRepository.Find(l.ctx, conn, queryOption) | 97 | _, atWhoList, err = l.svcCtx.UserRepository.Find(l.ctx, conn, queryOption) |
96 | if err != nil { | 98 | if err != nil { |
97 | return nil, xerr.NewErrMsgErr("检查@的人员失败", err) | 99 | return nil, xerr.NewErrMsgErr("检查@的人员失败", err) |
@@ -49,7 +49,9 @@ func (l *SystemEditAticleCommentLogic) SystemEditAticleComment(req *types.System | @@ -49,7 +49,9 @@ func (l *SystemEditAticleCommentLogic) SystemEditAticleComment(req *types.System | ||
49 | maxCount = commetInfo.MaxCountAdminLove(len(articleInfo.WhoRead)) | 49 | maxCount = commetInfo.MaxCountAdminLove(len(articleInfo.WhoRead)) |
50 | } else { | 50 | } else { |
51 | //统计全员人数 | 51 | //统计全员人数 |
52 | - queryOption := domain.NewQueryOptions().WithCountOnly().MustWithKV("companyId", req.CompanyId) | 52 | + queryOption := domain.NewQueryOptions().WithCountOnly(). |
53 | + MustWithKV("auditStatus", []int{domain.UserAuditStatusPassed}). | ||
54 | + MustWithKV("companyId", req.CompanyId) | ||
53 | cnt, _, err := l.svcCtx.UserRepository.Find(l.ctx, conn, queryOption) | 55 | cnt, _, err := l.svcCtx.UserRepository.Find(l.ctx, conn, queryOption) |
54 | if err != nil { | 56 | if err != nil { |
55 | return nil, xerr.NewErrMsgErr("获取人员数据失败", err) | 57 | return nil, xerr.NewErrMsgErr("获取人员数据失败", err) |
@@ -61,7 +61,9 @@ func (l *SystemEditAticleCommentLoveLogic) SystemEditAticleCommentLove(req *type | @@ -61,7 +61,9 @@ func (l *SystemEditAticleCommentLoveLogic) SystemEditAticleCommentLove(req *type | ||
61 | maxCount = commetInfo.MaxCountAdminLove(len(articleInfo.WhoRead)) | 61 | maxCount = commetInfo.MaxCountAdminLove(len(articleInfo.WhoRead)) |
62 | } else { | 62 | } else { |
63 | //统计全员人数 | 63 | //统计全员人数 |
64 | - queryOption := domain.NewQueryOptions().WithCountOnly().MustWithKV("companyId", req.CompanyId) | 64 | + queryOption := domain.NewQueryOptions().WithCountOnly(). |
65 | + MustWithKV("auditStatus", []int{domain.UserAuditStatusPassed}). | ||
66 | + MustWithKV("companyId", req.CompanyId) | ||
65 | cnt, _, err := l.svcCtx.UserRepository.Find(l.ctx, conn, queryOption) | 67 | cnt, _, err := l.svcCtx.UserRepository.Find(l.ctx, conn, queryOption) |
66 | if err != nil { | 68 | if err != nil { |
67 | return nil, xerr.NewErrMsgErr("获取人员数据失败", err) | 69 | return nil, xerr.NewErrMsgErr("获取人员数据失败", err) |
@@ -2,6 +2,7 @@ package department | @@ -2,6 +2,7 @@ package department | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "context" | 4 | "context" |
5 | + | ||
5 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction" | 6 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction" |
6 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" | 7 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" |
7 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata" | 8 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata" |
@@ -58,7 +59,9 @@ func (l *SystemUpdateLogic) SystemUpdate(req *types.DepartmentUpdateRequest) (re | @@ -58,7 +59,9 @@ func (l *SystemUpdateLogic) SystemUpdate(req *types.DepartmentUpdateRequest) (re | ||
58 | // 获取公司下的所有用户 | 59 | // 获取公司下的所有用户 |
59 | _, users, err := l.svcCtx.UserRepository.Find(l.ctx, conn, domain.NewQueryOptions(). | 60 | _, users, err := l.svcCtx.UserRepository.Find(l.ctx, conn, domain.NewQueryOptions(). |
60 | WithFindOnly(). | 61 | WithFindOnly(). |
61 | - WithKV("companyId", one.CompanyId)) | 62 | + WithKV("companyId", one.CompanyId).MustWithKV("auditStatus", []int{domain.UserAuditStatusPassed}), |
63 | + ) | ||
64 | + | ||
62 | if err != nil { | 65 | if err != nil { |
63 | return nil, err | 66 | return nil, err |
64 | } | 67 | } |
@@ -267,22 +267,29 @@ func (l *MiniBusinessLogic) createMessage( | @@ -267,22 +267,29 @@ func (l *MiniBusinessLogic) createMessage( | ||
267 | at []int64) (err error) { | 267 | at []int64) (err error) { |
268 | 268 | ||
269 | var userToken = contextdata.GetUserTokenFromCtx(l.ctx) | 269 | var userToken = contextdata.GetUserTokenFromCtx(l.ctx) |
270 | - // 评论中携带了 @其他用户 | 270 | + var dupMap = make(map[int64]int64, 0) |
271 | + // 评论中携带了 @用户 | ||
271 | for i := range at { | 272 | for i := range at { |
272 | - var msg = &domain.MessageBusiness{ | ||
273 | - Type: msgType, | ||
274 | - OptType: optType, | ||
275 | - CompanyId: userToken.CompanyId, | ||
276 | - UserId: userToken.UserId, | ||
277 | - RecipientId: at[i], | ||
278 | - ArticleId: articleId, | ||
279 | - CommentId: commentId, | ||
280 | - CommentParentId: commentParentId, | ||
281 | - } | ||
282 | - msg, err = l.svcCtx.MessageBusinessRepository.Insert(l.ctx, conn, msg) | ||
283 | - if err != nil { | ||
284 | - return err | 273 | + if _, ok := dupMap[at[i]]; ok { /* ID去重 */ |
274 | + // do nothing ... | ||
275 | + } else { | ||
276 | + var msg = &domain.MessageBusiness{ | ||
277 | + Type: msgType, | ||
278 | + OptType: optType, | ||
279 | + CompanyId: userToken.CompanyId, | ||
280 | + UserId: userToken.UserId, | ||
281 | + RecipientId: at[i], | ||
282 | + ArticleId: articleId, | ||
283 | + CommentId: commentId, | ||
284 | + CommentParentId: commentParentId, | ||
285 | + } | ||
286 | + msg, err = l.svcCtx.MessageBusinessRepository.Insert(l.ctx, conn, msg) | ||
287 | + if err != nil { | ||
288 | + return err | ||
289 | + } | ||
290 | + dupMap[at[i]] = at[i] | ||
285 | } | 291 | } |
292 | + | ||
286 | } | 293 | } |
287 | return nil | 294 | return nil |
288 | } | 295 | } |
-
请 注册 或 登录 后发表评论