作者 郑周

1 系统消息,取消点赞 优化

@@ -102,7 +102,7 @@ func (l *MiniSetUserLikeLogic) cancelSetUserLikeArticle(req *types.MiniSetUserLi @@ -102,7 +102,7 @@ func (l *MiniSetUserLikeLogic) cancelSetUserLikeArticle(req *types.MiniSetUserLi
102 102
103 // 删除点赞文章消息 103 // 删除点赞文章消息
104 var messageLogic = message.NewMiniBusinessLogic(l.ctx, l.svcCtx) 104 var messageLogic = message.NewMiniBusinessLogic(l.ctx, l.svcCtx)
105 - err = messageLogic.UnLikeArticle(c, articleInfo.Id) 105 + err = messageLogic.UnLikeArticle(c, articleInfo.Id, articleInfo.AuthorId)
106 if err != nil { 106 if err != nil {
107 return err 107 return err
108 } 108 }
@@ -183,7 +183,7 @@ func (l *MiniSetUserLikeLogic) cancelSetUserLikeComment(req *types.MiniSetUserLi @@ -183,7 +183,7 @@ func (l *MiniSetUserLikeLogic) cancelSetUserLikeComment(req *types.MiniSetUserLi
183 183
184 // 删除点赞评论消息 184 // 删除点赞评论消息
185 var messageLogic = message.NewMiniBusinessLogic(l.ctx, l.svcCtx) 185 var messageLogic = message.NewMiniBusinessLogic(l.ctx, l.svcCtx)
186 - err = messageLogic.UnLikeComment(c, commentInfo.ArticleId, commentInfo.Id) 186 + err = messageLogic.UnLikeComment(c, commentInfo.ArticleId, commentInfo.Id, commentInfo.FromUserId)
187 if err != nil { 187 if err != nil {
188 return err 188 return err
189 } 189 }
@@ -248,13 +248,13 @@ func (l *MiniBusinessLogic) LikeComment(conn transaction.Conn, articleId int64, @@ -248,13 +248,13 @@ func (l *MiniBusinessLogic) LikeComment(conn transaction.Conn, articleId int64,
248 } 248 }
249 249
250 // UnLikeArticle 取消点赞文章 250 // UnLikeArticle 取消点赞文章
251 -func (l *MiniBusinessLogic) UnLikeArticle(conn transaction.Conn, articleId int64) (err error) {  
252 - return l.deleteMessage(conn, domain.OptTypeArticle, articleId, 0) 251 +func (l *MiniBusinessLogic) UnLikeArticle(conn transaction.Conn, articleId int64, recipientId int64) (err error) {
  252 + return l.deleteMessage(conn, domain.OptTypeArticle, articleId, 0, recipientId)
253 } 253 }
254 254
255 // UnLikeComment 取消点赞评论 255 // UnLikeComment 取消点赞评论
256 -func (l *MiniBusinessLogic) UnLikeComment(conn transaction.Conn, articleId int64, commentId int64) (err error) {  
257 - return l.deleteMessage(conn, domain.OptTypeComment, articleId, commentId) 256 +func (l *MiniBusinessLogic) UnLikeComment(conn transaction.Conn, articleId int64, commentId int64, recipientId int64) (err error) {
  257 + return l.deleteMessage(conn, domain.OptTypeComment, articleId, commentId, recipientId)
258 } 258 }
259 259
260 func (l *MiniBusinessLogic) createMessage( 260 func (l *MiniBusinessLogic) createMessage(
@@ -287,14 +287,14 @@ func (l *MiniBusinessLogic) createMessage( @@ -287,14 +287,14 @@ func (l *MiniBusinessLogic) createMessage(
287 return nil 287 return nil
288 } 288 }
289 289
290 -func (l *MiniBusinessLogic) deleteMessage(conn transaction.Conn, optType domain.MsgBusinessOpt, articleId int64, commentId int64) (err error) { 290 +func (l *MiniBusinessLogic) deleteMessage(conn transaction.Conn, optType domain.MsgBusinessOpt, articleId int64, commentId int64, recipientId int64) (err error) {
291 var userToken = contextdata.GetUserTokenFromCtx(l.ctx) 291 var userToken = contextdata.GetUserTokenFromCtx(l.ctx)
292 292
293 queryOption := domain.NewQueryOptions().WithFindOnly().WithOffsetLimit(1, 1). 293 queryOption := domain.NewQueryOptions().WithFindOnly().WithOffsetLimit(1, 1).
294 MustWithKV("type", domain.MsgTypeLike). 294 MustWithKV("type", domain.MsgTypeLike).
295 MustWithKV("optType", optType). 295 MustWithKV("optType", optType).
296 MustWithKV("companyId", userToken.CompanyId). 296 MustWithKV("companyId", userToken.CompanyId).
297 - MustWithKV("recipientId", userToken.UserId). 297 + MustWithKV("recipientId", recipientId).
298 MustWithKV("articleId", articleId). 298 MustWithKV("articleId", articleId).
299 MustWithKV("commentId", commentId) 299 MustWithKV("commentId", commentId)
300 300