正在显示
4 个修改的文件
包含
63 行增加
和
3 行删除
@@ -102,6 +102,7 @@ func HandlerSecurityContent(ctx context.Context, svcCtx *svc.ServiceContext, con | @@ -102,6 +102,7 @@ func HandlerSecurityContent(ctx context.Context, svcCtx *svc.ServiceContext, con | ||
102 | if status == domain.ReviewStatusPass { | 102 | if status == domain.ReviewStatusPass { |
103 | show = int(domain.ArticleShowEnable) | 103 | show = int(domain.ArticleShowEnable) |
104 | } | 104 | } |
105 | + mnl := NewMessageNoticeLogic(ctx, svcCtx) | ||
105 | if c.Type == domain.TypeArticle { | 106 | if c.Type == domain.TypeArticle { |
106 | if article, err = svcCtx.ArticleRepository.FindOne(ctx, conn, c.Id); err != nil { | 107 | if article, err = svcCtx.ArticleRepository.FindOne(ctx, conn, c.Id); err != nil { |
107 | return fmt.Errorf("文章不存在") | 108 | return fmt.Errorf("文章不存在") |
@@ -110,6 +111,9 @@ func HandlerSecurityContent(ctx context.Context, svcCtx *svc.ServiceContext, con | @@ -110,6 +111,9 @@ func HandlerSecurityContent(ctx context.Context, svcCtx *svc.ServiceContext, con | ||
110 | if _, err = svcCtx.ArticleRepository.UpdateWithVersion(ctx, conn, article); err != nil { | 111 | if _, err = svcCtx.ArticleRepository.UpdateWithVersion(ctx, conn, article); err != nil { |
111 | return err | 112 | return err |
112 | } | 113 | } |
114 | + if show == int(domain.ArticleShowIllegal) { | ||
115 | + mnl.ArticleIllegal(conn, article.CompanyId, article.AuthorId, time.Unix(article.CreatedAt, 0).Format("2006-01-02 15:04"), article.Title) | ||
116 | + } | ||
113 | } else if c.Type == domain.TypeComment { | 117 | } else if c.Type == domain.TypeComment { |
114 | if comment, err = svcCtx.ArticleCommentRepository.FindOne(ctx, conn, c.Id); err != nil { | 118 | if comment, err = svcCtx.ArticleCommentRepository.FindOne(ctx, conn, c.Id); err != nil { |
115 | return fmt.Errorf("评论不存在") | 119 | return fmt.Errorf("评论不存在") |
@@ -118,6 +122,9 @@ func HandlerSecurityContent(ctx context.Context, svcCtx *svc.ServiceContext, con | @@ -118,6 +122,9 @@ func HandlerSecurityContent(ctx context.Context, svcCtx *svc.ServiceContext, con | ||
118 | if _, err = svcCtx.ArticleCommentRepository.UpdateWithVersion(ctx, conn, comment); err != nil { | 122 | if _, err = svcCtx.ArticleCommentRepository.UpdateWithVersion(ctx, conn, comment); err != nil { |
119 | return err | 123 | return err |
120 | } | 124 | } |
125 | + if show == int(domain.CommentShowIllegal) { | ||
126 | + mnl.ArticleIllegal(conn, comment.CompanyId, comment.FromUserId, time.Unix(comment.CreatedAt, 0).Format("2006-01-02 15:04"), comment.Content) | ||
127 | + } | ||
121 | } | 128 | } |
122 | return nil | 129 | return nil |
123 | } | 130 | } |
1 | +package core | ||
2 | + | ||
3 | +import ( | ||
4 | + "context" | ||
5 | + "fmt" | ||
6 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" | ||
7 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction" | ||
8 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" | ||
9 | +) | ||
10 | + | ||
11 | +type MessageNotice struct { | ||
12 | + ctx context.Context | ||
13 | + svcCtx *svc.ServiceContext | ||
14 | +} | ||
15 | + | ||
16 | +func NewMessageNoticeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MessageNotice { | ||
17 | + return &MessageNotice{ | ||
18 | + ctx: ctx, | ||
19 | + svcCtx: svcCtx, | ||
20 | + } | ||
21 | +} | ||
22 | + | ||
23 | +func (l *MessageNotice) ArticleIllegal(conn transaction.Conn, companyId, at int64, createdTime, title string) (err error) { | ||
24 | + return l.createMessage(conn, companyId, at, domain.MsgTypeIllegal, "文本内容违规", fmt.Sprintf("你于%v发布的帖子[%v]含有违规信息,未通过审核,已被禁止发布。请自觉遵守相关规定,若有疑问,请咨询运营管理员了解详情。", createdTime, title)) | ||
25 | +} | ||
26 | + | ||
27 | +// CommentIllegal 评论违规 | ||
28 | +func (l *MessageNotice) CommentIllegal(conn transaction.Conn, at int64, companyId int64, createdTime, title string) (err error) { | ||
29 | + return l.createMessage(conn, companyId, at, domain.MsgTypeIllegal, "文本内容违规", fmt.Sprintf("你于%v发布的评论[%v]含有违规信息,未通过审核,已被禁止发布。请自觉遵守相关规定,若有疑问,请咨询运营管理员了解详情。", createdTime, title)) | ||
30 | +} | ||
31 | + | ||
32 | +func (l *MessageNotice) createMessage(conn transaction.Conn, companyId, at int64, msgType domain.MsgSystemType, title string, content string) (err error) { | ||
33 | + var msg = &domain.MessageSystem{ | ||
34 | + Type: msgType, | ||
35 | + CompanyId: companyId, | ||
36 | + RecipientId: at, | ||
37 | + Title: title, | ||
38 | + Content: content, | ||
39 | + } | ||
40 | + msg, err = l.svcCtx.MessageSystemRepository.Insert(l.ctx, conn, msg) | ||
41 | + return err | ||
42 | +} |
@@ -62,6 +62,11 @@ func (l *MiniSystemLogic) ArticleDeleted(conn transaction.Conn, companyId, at in | @@ -62,6 +62,11 @@ func (l *MiniSystemLogic) ArticleDeleted(conn transaction.Conn, companyId, at in | ||
62 | return l.createMessage(conn, companyId, at, domain.MsgTypeDeleted, "帖子已删除", fmt.Sprintf("你于%v发布的帖子[%v]已被删除,如有疑问,请联系运营管理员了解详情。", createdTime, title)) | 62 | return l.createMessage(conn, companyId, at, domain.MsgTypeDeleted, "帖子已删除", fmt.Sprintf("你于%v发布的帖子[%v]已被删除,如有疑问,请联系运营管理员了解详情。", createdTime, title)) |
63 | } | 63 | } |
64 | 64 | ||
65 | +// ArticleIllegal 帖子违规 | ||
66 | +func (l *MiniSystemLogic) ArticleIllegal(conn transaction.Conn, companyId, at int64, createdTime, title string) (err error) { | ||
67 | + return l.createMessage(conn, companyId, at, domain.MsgTypeDeleted, "文本内容违规", fmt.Sprintf("你于%v发布的帖子[%v]含有违规信息,未通过审核,已被禁止发布。请自觉遵守相关规定,若有疑问,请咨询运营管理员了解详情。", createdTime, title)) | ||
68 | +} | ||
69 | + | ||
65 | //// ArticleAuth 文章权限变更 | 70 | //// ArticleAuth 文章权限变更 |
66 | //func (l *MiniSystemLogic) ArticleAuth(conn transaction.Conn, companyId, at int64, item string) (err error) { | 71 | //func (l *MiniSystemLogic) ArticleAuth(conn transaction.Conn, companyId, at int64, item string) (err error) { |
67 | // return l.createMessage(conn, companyId, at, domain.MsgTypeAbnormal, "权限变更", fmt.Sprintf("您的帖子[%s]可见权限已添加,如有疑问,请联系运营管理员了解详情。", item)) | 72 | // return l.createMessage(conn, companyId, at, domain.MsgTypeAbnormal, "权限变更", fmt.Sprintf("您的帖子[%s]可见权限已添加,如有疑问,请联系运营管理员了解详情。", item)) |
@@ -92,6 +97,11 @@ func (l *MiniSystemLogic) AbnormalCommentHidden(conn transaction.Conn, companyId | @@ -92,6 +97,11 @@ func (l *MiniSystemLogic) AbnormalCommentHidden(conn transaction.Conn, companyId | ||
92 | return l.createMessage(conn, companyId, at, domain.MsgTypeAbnormal, "评论被隐藏", fmt.Sprintf("您的评论[%s]已被隐藏,如有疑问,请联系运营管理员了解详情。", item)) | 97 | return l.createMessage(conn, companyId, at, domain.MsgTypeAbnormal, "评论被隐藏", fmt.Sprintf("您的评论[%s]已被隐藏,如有疑问,请联系运营管理员了解详情。", item)) |
93 | } | 98 | } |
94 | 99 | ||
100 | +// CommentIllegal 评论违规 | ||
101 | +func (l *MiniSystemLogic) CommentIllegal(conn transaction.Conn, at int64, companyId int64, createdTime, title string) (err error) { | ||
102 | + return l.createMessage(conn, companyId, at, domain.MsgTypeIllegal, "文本内容违规", fmt.Sprintf("你于%v发布的评论[%v]含有违规信息,未通过审核,已被禁止发布。请自觉遵守相关规定,若有疑问,请咨询运营管理员了解详情。", createdTime, title)) | ||
103 | +} | ||
104 | + | ||
95 | func (l *MiniSystemLogic) createMessage(conn transaction.Conn, companyId, at int64, msgType domain.MsgSystemType, title string, content string) (err error) { | 105 | func (l *MiniSystemLogic) createMessage(conn transaction.Conn, companyId, at int64, msgType domain.MsgSystemType, title string, content string) (err error) { |
96 | var msg = &domain.MessageSystem{ | 106 | var msg = &domain.MessageSystem{ |
97 | Type: msgType, | 107 | Type: msgType, |
@@ -21,9 +21,10 @@ type MessageSystem struct { | @@ -21,9 +21,10 @@ type MessageSystem struct { | ||
21 | type MsgSystemType int | 21 | type MsgSystemType int |
22 | 22 | ||
23 | const ( | 23 | const ( |
24 | - MsgTypeNormal MsgSystemType = 1 //1业务正常通知 | ||
25 | - MsgTypeAbnormal MsgSystemType = 2 //2业务异常通知 | ||
26 | - MsgTypeDeleted MsgSystemType = 3 //3帖子删除通知 | 24 | + MsgTypeNormal MsgSystemType = 1 //1 业务正常通知(帖子定性) |
25 | + MsgTypeAbnormal MsgSystemType = 2 //2 业务异常通知(评论删除) | ||
26 | + MsgTypeDeleted MsgSystemType = 3 //3 帖子删除通知(帖子删除) | ||
27 | + MsgTypeIllegal MsgSystemType = 4 //4 内容违规 | ||
27 | ) | 28 | ) |
28 | 29 | ||
29 | type MessageSystemRepository interface { | 30 | type MessageSystemRepository interface { |
-
请 注册 或 登录 后发表评论