作者 庄敏学

合并分支 'dev' 到 'test'

管理后台删除帖子发送消息通知



查看合并请求 !10
@@ -2,11 +2,13 @@ package article @@ -2,11 +2,13 @@ package article
2 2
3 import ( 3 import (
4 "context" 4 "context"
  5 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/message"
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/cmd/discuss/interanl/pkg/gateway/authlib" 8 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/gateway/authlib"
8 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata" 9 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
9 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr" 10 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr"
  11 + "time"
10 12
11 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" 13 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
12 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" 14 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
@@ -75,6 +77,13 @@ func (l *SystemDeleteArticleLogic) SystemDeleteArticle(req *types.SystemArticleD @@ -75,6 +77,13 @@ func (l *SystemDeleteArticleLogic) SystemDeleteArticle(req *types.SystemArticleD
75 if err != nil { 77 if err != nil {
76 return xerr.NewErrMsgErr("保存文章内容失败", err) 78 return xerr.NewErrMsgErr("保存文章内容失败", err)
77 } 79 }
  80 + //消息通知
  81 + messageLogic := message.NewMiniSystemLogic(l.ctx, l.svcCtx)
  82 + mTime := time.Unix(article.CreatedAt, 0).Format("2006-01-02 15:04")
  83 + err = messageLogic.ArticleDeleted(conn, article.CompanyId, article.AuthorId, mTime)
  84 + if err != nil {
  85 + return xerr.NewErrMsgErr("删除失败", err)
  86 + }
78 return nil 87 return nil
79 }, true) 88 }, true)
80 if err != nil { 89 if err != nil {
@@ -57,6 +57,11 @@ func (l *MiniSystemLogic) ArticleDefined(conn transaction.Conn, companyId, at in @@ -57,6 +57,11 @@ func (l *MiniSystemLogic) ArticleDefined(conn transaction.Conn, companyId, at in
57 return l.createMessage(conn, companyId, at, domain.MsgTypeNormal, "帖子已定性", fmt.Sprintf("您的帖子[%s]已被定性,如有疑问,请联系运营管理员了解详情。", item)) 57 return l.createMessage(conn, companyId, at, domain.MsgTypeNormal, "帖子已定性", fmt.Sprintf("您的帖子[%s]已被定性,如有疑问,请联系运营管理员了解详情。", item))
58 } 58 }
59 59
  60 +// ArticleDeleted 帖子删除
  61 +func (l *MiniSystemLogic) ArticleDeleted(conn transaction.Conn, companyId, at int64, item string) (err error) {
  62 + return l.createMessage(conn, companyId, at, domain.MsgTypeNormal, "帖子已删除", fmt.Sprintf("你于%v发布的帖子已被删除,如有疑问,请联系运营管理员了解详情。", item))
  63 +}
  64 +
60 //// ArticleAuth 文章权限变更 65 //// ArticleAuth 文章权限变更
61 //func (l *MiniSystemLogic) ArticleAuth(conn transaction.Conn, companyId, at int64, item string) (err error) { 66 //func (l *MiniSystemLogic) ArticleAuth(conn transaction.Conn, companyId, at int64, item string) (err error) {
62 // return l.createMessage(conn, companyId, at, domain.MsgTypeAbnormal, "权限变更", fmt.Sprintf("您的帖子[%s]可见权限已添加,如有疑问,请联系运营管理员了解详情。", item)) 67 // return l.createMessage(conn, companyId, at, domain.MsgTypeAbnormal, "权限变更", fmt.Sprintf("您的帖子[%s]可见权限已添加,如有疑问,请联系运营管理员了解详情。", item))