作者 郑周

1 业务消息重 @用户 消息去重

@@ -267,8 +267,12 @@ func (l *MiniBusinessLogic) createMessage( @@ -267,8 +267,12 @@ 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 {
  273 + if _, ok := dupMap[at[i]]; ok { /* ID去重 */
  274 + // do nothing ...
  275 + } else {
272 var msg = &domain.MessageBusiness{ 276 var msg = &domain.MessageBusiness{
273 Type: msgType, 277 Type: msgType,
274 OptType: optType, 278 OptType: optType,
@@ -283,6 +287,9 @@ func (l *MiniBusinessLogic) createMessage( @@ -283,6 +287,9 @@ func (l *MiniBusinessLogic) createMessage(
283 if err != nil { 287 if err != nil {
284 return err 288 return err
285 } 289 }
  290 + dupMap[at[i]] = at[i]
  291 + }
  292 +
286 } 293 }
287 return nil 294 return nil
288 } 295 }