作者 庄敏学

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

... ... @@ -2,11 +2,13 @@ package article
import (
"context"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/message"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/gateway/authlib"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr"
"time"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
... ... @@ -75,6 +77,13 @@ func (l *SystemDeleteArticleLogic) SystemDeleteArticle(req *types.SystemArticleD
if err != nil {
return xerr.NewErrMsgErr("保存文章内容失败", err)
}
//消息通知
messageLogic := message.NewMiniSystemLogic(l.ctx, l.svcCtx)
mTime := time.Unix(article.CreatedAt, 0).Format("2006-01-02 15:04")
err = messageLogic.ArticleDeleted(conn, article.CompanyId, article.AuthorId, mTime)
if err != nil {
return xerr.NewErrMsgErr("删除失败", err)
}
return nil
}, true)
if err != nil {
... ...
... ... @@ -57,6 +57,11 @@ func (l *MiniSystemLogic) ArticleDefined(conn transaction.Conn, companyId, at in
return l.createMessage(conn, companyId, at, domain.MsgTypeNormal, "帖子已定性", fmt.Sprintf("您的帖子[%s]已被定性,如有疑问,请联系运营管理员了解详情。", item))
}
// ArticleDeleted 帖子删除
func (l *MiniSystemLogic) ArticleDeleted(conn transaction.Conn, companyId, at int64, item string) (err error) {
return l.createMessage(conn, companyId, at, domain.MsgTypeNormal, "帖子已删除", fmt.Sprintf("你于%v发布的帖子已被删除,如有疑问,请联系运营管理员了解详情。", item))
}
//// ArticleAuth 文章权限变更
//func (l *MiniSystemLogic) ArticleAuth(conn transaction.Conn, companyId, at int64, item string) (err error) {
// return l.createMessage(conn, companyId, at, domain.MsgTypeAbnormal, "权限变更", fmt.Sprintf("您的帖子[%s]可见权限已添加,如有疑问,请联系运营管理员了解详情。", item))
... ...