Merge pull request 'feat-IRONFANS-212-Robin' (#910) from feat-IRONFANS-212-Robin into test
Reviewed-on: https://git.wishpal.cn/wishpal_ironfan/service/pulls/910
This commit is contained in:
commit
36f8391ce5
|
@ -709,7 +709,7 @@ func (handler *NotifBuilderHandler) handleVasZoneSuperfanshipPurchased_User() {
|
|||
|
||||
argsMap := make(map[string]any)
|
||||
argsMap["template_params"] = []any{streamerAcct.GetName(), util.FormatTsAsNotifT(order.GetSuperfanshipUntil())}
|
||||
argsMap["thumbnail"] = streamer.Album
|
||||
argsMap["thumbnail"] = streamer.Cover
|
||||
argsMap["build_hyperlink"] = DefaultService.utilBuildInwardHyperLink
|
||||
argsMap["hyperlink_params_map"] = util.NewHyperLinkParamsMapBuilder().NewEnds("app", "h5").WriteParamToAllEnd("mid", order.GetUid()).Map()
|
||||
argsMap["link_text_template_params"] = []any{streamerAcct.GetName()}
|
||||
|
|
|
@ -5254,6 +5254,18 @@ func (s *Service) OpGetSingleDistributeHisList(ctx *gin.Context, req *single_dis
|
|||
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)
|
||||
|
|
|
@ -2347,7 +2347,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"][m.Groups()[1].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)
|
||||
|
@ -2356,7 +2356,7 @@ func (s *Service) utilBuildInwardHyperLink(ctx *gin.Context, frontendRouteId int
|
|||
|
||||
h5Route, err := regexpcli.GetRegexp(consts.H5HyperlinkRegexp).ReplaceFunc(
|
||||
frontendroute.GetH5RoutePath(), func(m regexp2.Match) string {
|
||||
return fmt.Sprintf("%v%v", m.String(), argsMap["h5"][m.Groups()[2].String()])
|
||||
return fmt.Sprint(argsMap["h5"][m.Groups()[1].String()])
|
||||
}, -1, -1)
|
||||
if err != nil {
|
||||
logger.Error("regexp2 ReplaceFunc fail, err: %v", err)
|
||||
|
|
|
@ -16,8 +16,8 @@ func Init() {
|
|||
defaultRegexpClient = new(Client)
|
||||
|
||||
defaultRegexpClient.regexpMap = make(map[string]*regexp2.Regexp)
|
||||
defaultRegexpClient.regexpMap[consts.AppHyperlinkRegexp] = regexp2.MustCompile(`\[(.*?)\]`, 0)
|
||||
defaultRegexpClient.regexpMap[consts.H5HyperlinkRegexp] = regexp2.MustCompile(`(\?|&)(.*?)=`, 0)
|
||||
defaultRegexpClient.regexpMap[consts.AppHyperlinkRegexp] = regexp2.MustCompile(`(.*?)=([A-Z]+)(&*)`, 0)
|
||||
defaultRegexpClient.regexpMap[consts.H5HyperlinkRegexp] = regexp2.MustCompile(`\[(.*?)\]`, 0)
|
||||
}
|
||||
|
||||
func GetRegexp(str string) *regexp2.Regexp {
|
||||
|
|
Loading…
Reference in New Issue