...
|
...
|
@@ -267,22 +267,29 @@ func (l *MiniBusinessLogic) createMessage( |
|
|
at []int64) (err error) {
|
|
|
|
|
|
var userToken = contextdata.GetUserTokenFromCtx(l.ctx)
|
|
|
// 评论中携带了 @其他用户
|
|
|
var dupMap = make(map[int64]int64, 0)
|
|
|
// 评论中携带了 @用户
|
|
|
for i := range at {
|
|
|
var msg = &domain.MessageBusiness{
|
|
|
Type: msgType,
|
|
|
OptType: optType,
|
|
|
CompanyId: userToken.CompanyId,
|
|
|
UserId: userToken.UserId,
|
|
|
RecipientId: at[i],
|
|
|
ArticleId: articleId,
|
|
|
CommentId: commentId,
|
|
|
CommentParentId: commentParentId,
|
|
|
}
|
|
|
msg, err = l.svcCtx.MessageBusinessRepository.Insert(l.ctx, conn, msg)
|
|
|
if err != nil {
|
|
|
return err
|
|
|
if _, ok := dupMap[at[i]]; ok { /* ID去重 */
|
|
|
// do nothing ...
|
|
|
} else {
|
|
|
var msg = &domain.MessageBusiness{
|
|
|
Type: msgType,
|
|
|
OptType: optType,
|
|
|
CompanyId: userToken.CompanyId,
|
|
|
UserId: userToken.UserId,
|
|
|
RecipientId: at[i],
|
|
|
ArticleId: articleId,
|
|
|
CommentId: commentId,
|
|
|
CommentParentId: commentParentId,
|
|
|
}
|
|
|
msg, err = l.svcCtx.MessageBusinessRepository.Insert(l.ctx, conn, msg)
|
|
|
if err != nil {
|
|
|
return err
|
|
|
}
|
|
|
dupMap[at[i]] = at[i]
|
|
|
}
|
|
|
|
|
|
}
|
|
|
return nil
|
|
|
}
|
...
|
...
|
|