This commit is contained in:
Robin 2024-12-17 13:51:55 +08:00
parent fefe5068ad
commit 91ec58186f
3 changed files with 14 additions and 2 deletions

View File

@ -5204,6 +5204,18 @@ func (s *Service) OpDeleteRavenIQTestVisit(ctx *gin.Context, id int64) (ec errco
func (s *Service) OpCreateNotification(ctx *gin.Context, req *notificationproto.OpCreateReq) (ec errcode.ErrCode) {
ec = errcode.ErrCodeNotificationSrvOk
// 默认缩略图
if len(req.Thumbnail.GetImageIds()) == 0 {
defaultThumbnailId, err := apollo.GetIntValue(consts.DefaultNotifThumbnailIdKey, apollo.ApolloOpts().SetNamespace("application"))
if err != nil {
logger.Error("Apollo read failed : %v", err)
return errcode.ErrCodeApolloReadFail
}
req.Thumbnail = &dbstruct.MediaComponent{
ImageIds: util.Int64Slice([]int64{int64(defaultThumbnailId)}),
}
}
// 首先将该通知的信息插入数据库获得nid
req.Notification.Status = goproto.Int64(consts.Notification_Created)
err := _DefaultNotification.OpCreate(ctx, req)

View File

@ -2332,7 +2332,7 @@ func (s *Service) utilBuildInwardHyperLink(ctx *gin.Context, frontendRouteId int
// 将跳转路径的占位符替换
appRoute, err := regexpcli.GetRegexp(consts.AppHyperlinkRegexp).ReplaceFunc(
frontendroute.GetAppRoutePath(), func(m regexp2.Match) string {
return fmt.Sprint(argsMap["app"][strings.ToUpper(m.Groups()[2].String())])
return fmt.Sprintf("%v=%v%v", m.Groups()[1].String(), argsMap["app"][strings.ToLower(m.Groups()[2].String())], m.Groups()[3].String())
}, -1, -1)
if err != nil {
logger.Error("regexp2 ReplaceFunc fail, err: %v", err)

View File

@ -16,7 +16,7 @@ func Init() {
defaultRegexpClient = new(Client)
defaultRegexpClient.regexpMap = make(map[string]*regexp2.Regexp)
defaultRegexpClient.regexpMap[consts.AppHyperlinkRegexp] = regexp2.MustCompile(`(.*?)=(.*?)&*`, 0)
defaultRegexpClient.regexpMap[consts.AppHyperlinkRegexp] = regexp2.MustCompile(`(.*?)=([A-Z]+)(&*)`, 0)
defaultRegexpClient.regexpMap[consts.H5HyperlinkRegexp] = regexp2.MustCompile(`\[(.*?)\]`, 0)
}