...
|
...
|
@@ -153,7 +153,8 @@ func (l *MiniSubscribeLogic) ReplyComment(conn transaction.Conn, article *domain |
|
|
msg.ToUser = openId
|
|
|
msg.Page = fmt.Sprintf("/pages/detail/more-comment?id=%v", article.Id) //跳转页面 帖子评论聚合页
|
|
|
//备注
|
|
|
msg.Data["thing9"] = &subscribe.DataItem{Value: fmt.Sprintf("您的帖子最近已有%v人评论,点击查看详情", article.CountComment)}
|
|
|
userCount, _ := l.svcCtx.ArticleCommentRepository.CommentUserCount(l.ctx, conn, comment.CompanyId, comment.ArticleId)
|
|
|
msg.Data["thing9"] = &subscribe.DataItem{Value: fmt.Sprintf("您的帖子最近已有%v人评论,点击查看详情", userCount)}
|
|
|
//发送微信订阅消息
|
|
|
err = subCtx.Send(msg)
|
|
|
err = l.saveAndDecrease(conn, comment.CompanyId, article.AuthorId, domain.SubscribeTypeReplyComment, msg, err)
|
...
|
...
|
@@ -168,9 +169,9 @@ func (l *MiniSubscribeLogic) ReplyComment(conn transaction.Conn, article *domain |
|
|
msg.ToUser = toOpenId
|
|
|
msg.Page = fmt.Sprintf("/pages/detail/reply-comment?id=%v&commentId=%v", article.Id, comment.Pid) //跳转页面评论聚合页
|
|
|
//备注
|
|
|
parent, err := l.svcCtx.ArticleCommentRepository.FindOne(l.ctx, conn, comment.Pid)
|
|
|
if err == nil && parent.Id > 0 {
|
|
|
msg.Data["thing9"] = &subscribe.DataItem{Value: fmt.Sprintf("您的评论最近已有%v人回复,点击查看详情", parent.CountReply)}
|
|
|
replyCount, err := l.svcCtx.ArticleCommentRepository.ReplyUserCount(l.ctx, conn, comment.CompanyId, comment.Pid)
|
|
|
if err == nil {
|
|
|
msg.Data["thing9"] = &subscribe.DataItem{Value: fmt.Sprintf("您的评论最近已有%v人回复,点击查看详情", replyCount)}
|
|
|
//发送微信订阅消息
|
|
|
err = subCtx.Send(msg)
|
|
|
err = l.saveAndDecrease(conn, comment.CompanyId, comment.ToUserId, domain.SubscribeTypeReplyComment, msg, err)
|
...
|
...
|
@@ -210,6 +211,10 @@ func (l *MiniSubscribeLogic) LikeArticle(conn transaction.Conn, article *domain. |
|
|
if err != nil || openId == "" {
|
|
|
return nil
|
|
|
}
|
|
|
newArticle, err := l.svcCtx.ArticleRepository.FindOne(l.ctx, conn, article.Id)
|
|
|
if err != nil {
|
|
|
return xerr.NewErrMsgErr("未获取到帖子信息", err)
|
|
|
}
|
|
|
msg := &subscribe.Message{
|
|
|
ToUser: openId,
|
|
|
TemplateID: domain.SubscribeTemplateLike,
|
...
|
...
|
@@ -222,7 +227,7 @@ func (l *MiniSubscribeLogic) LikeArticle(conn transaction.Conn, article *domain. |
|
|
//动态内容
|
|
|
"thing8": &subscribe.DataItem{Value: article.GetSubscribeMessageTitle()},
|
|
|
//被赞次数
|
|
|
"number4": &subscribe.DataItem{Value: article.CountLove},
|
|
|
"number4": &subscribe.DataItem{Value: newArticle.CountLove},
|
|
|
//温馨提示
|
|
|
"thing5": &subscribe.DataItem{Value: "这条内容很受欢迎哦,快来看看吧"},
|
|
|
},
|
...
|
...
|
@@ -243,6 +248,11 @@ func (l *MiniSubscribeLogic) LikeComment(conn transaction.Conn, comment *domain. |
|
|
if err != nil || openId == "" {
|
|
|
return nil
|
|
|
}
|
|
|
//获取被赞次数
|
|
|
newComment, err := l.svcCtx.ArticleCommentRepository.FindOne(l.ctx, conn, comment.Id)
|
|
|
if err != nil {
|
|
|
return xerr.NewErrMsgErr("未获取到评论信息", err)
|
|
|
}
|
|
|
msg := &subscribe.Message{
|
|
|
ToUser: openId,
|
|
|
TemplateID: domain.SubscribeTemplateLike,
|
...
|
...
|
@@ -255,7 +265,7 @@ func (l *MiniSubscribeLogic) LikeComment(conn transaction.Conn, comment *domain. |
|
|
//动态内容
|
|
|
"thing8": &subscribe.DataItem{Value: comment.GetSubscribeMessageContent()},
|
|
|
//被赞次数
|
|
|
"number4": &subscribe.DataItem{Value: comment.CountUserLove},
|
|
|
"number4": &subscribe.DataItem{Value: newComment.CountUserLove},
|
|
|
//温馨提示
|
|
|
"thing5": &subscribe.DataItem{Value: "这条内容很受欢迎哦,快来看看吧"},
|
|
|
},
|
...
|
...
|
|