作者 yangfu

Merge branch 'dev' into test

... ... @@ -40,3 +40,4 @@ ApiAuth:
Wechat:
AppID: wxae5b305849343ec8
AppSecret: f584adb68f7d784425b60e1ebb2ffd4b
QrcodeEnv: "develop"
\ No newline at end of file
... ...
... ... @@ -292,15 +292,19 @@ func (l *SystemCreateArticleLogic) getSections(req *types.SystemArticleCreateReq
sortBy := 1
sections := strings.Split(req.Content, "\n")
lo.ForEach(sections, func(item string, index int) {
section := domain.ArticleSection{
CompanyId: article.CompanyId,
Version: article.Version,
ArticleId: article.Id,
Content: item,
SortBy: sortBy,
//去除空
item = strings.TrimSpace(item)
if item != "" {
section := domain.ArticleSection{
CompanyId: article.CompanyId,
Version: article.Version,
ArticleId: article.Id,
Content: item,
SortBy: sortBy,
}
articleSections = append(articleSections, &section)
sortBy++
}
articleSections = append(articleSections, &section)
sortBy++
})
return articleSections
}
... ...
... ... @@ -80,7 +80,7 @@ func (l *SystemDeleteArticleLogic) SystemDeleteArticle(req *types.SystemArticleD
//消息通知
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)
err = messageLogic.ArticleDeleted(conn, article.CompanyId, article.AuthorId, mTime, article.Title)
if err != nil {
return xerr.NewErrMsgErr("删除失败", err)
}
... ...
... ... @@ -56,7 +56,7 @@ func (l *MiniQrcodeInviteLogic) MiniQrcodeInvite(req *types.MiniQrCodeRequest) (
Path: req.Page,
Scene: req.Scene,
CheckPath: lo.ToPtr(false),
EnvVersion: "release",
EnvVersion: l.svcCtx.Config.Wechat.QrcodeEnv,
})
if err != nil {
return nil, xerr.NewErr(err)
... ...
... ... @@ -58,8 +58,8 @@ func (l *MiniSystemLogic) ArticleDefined(conn transaction.Conn, companyId, at in
}
// 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))
func (l *MiniSystemLogic) ArticleDeleted(conn transaction.Conn, companyId, at int64, createdTime, title string) (err error) {
return l.createMessage(conn, companyId, at, domain.MsgTypeDeleted, "帖子已删除", fmt.Sprintf("你于%v发布的帖子[%v]已被删除,如有疑问,请联系运营管理员了解详情。", createdTime, title))
}
//// ArticleAuth 文章权限变更
... ...
... ... @@ -21,8 +21,9 @@ type MessageSystem struct {
type MsgSystemType int
const (
MsgTypeNormal MsgSystemType = 1
MsgTypeAbnormal MsgSystemType = 2
MsgTypeNormal MsgSystemType = 1 //1业务正常通知
MsgTypeAbnormal MsgSystemType = 2 //2业务异常通知
MsgTypeDeleted MsgSystemType = 3 //3帖子删除通知
)
type MessageSystemRepository interface {
... ...
... ... @@ -72,6 +72,7 @@ type Wechat struct {
AppName string `json:",optional"`
AppID string
AppSecret string
QrcodeEnv string `json:",optional,default=release"`
MsgTemplates []Template `json:",optional"`
}
... ...