by Robin at 20241211

This commit is contained in:
Robin 2024-12-11 15:01:24 +08:00
parent 16b2d31fb5
commit 7ffa6ba385
4 changed files with 32 additions and 19 deletions

View File

@ -30,9 +30,12 @@ const (
AudNotifTemp_NameChangeApplied = 1732523339 // 用户修改昵称
AudNotifTemp_NamePassed = 1732523340 // 用户修改昵称成功(todo)
AudNotifTemp_NameRollbacked = 1732523341 // 用户修改昵称被驳回(todo)
AudNotifTemp_StreamerBasicInfoApplied = 1732523342 // 提交申请入驻材料
AudNotifTemp_StreamerBasicInfoPassed = 1732523343 // 运营后台审核通过申请入驻
AudNotifTemp_StreamerBasicInfoRejected = 1732523344 // 运营后台审核未通过申请入驻
AudNotifTemp_StreamerBasicInfoApplied = 1732523342 // 提交达人入驻材料
AudNotifTemp_StreamerBasicInfoPassed = 1732523343 // 运营后台审核通过达人入驻
AudNotifTemp_StreamerBasicInfoRejected = 1732523344 // 运营后台审核未通过达人入驻
AudNotifTemp_GuildRegisApplied = 1733900290 // 提交公会入驻材料
AudNotifTemp_GuildRegisPassed = 1733900291 // 运营后台审核通过公会入驻
AudNotifTemp_GuildRegisRejected = 1733900292 // 运营后台审核未通过公会入驻
AudNotifTemp_StreamerDetailsApplied = 1732523345 // 提交完善资料材料
AudNotifTemp_StreamerDetailsPassed = 1732523346 // 运营后台审核通过完善资料
AudNotifTemp_StreamerDetailsRejected = 1732523347 // 运营后台审核写上备注并未通过完善资料

View File

@ -2284,7 +2284,12 @@ func (s *Service) utilWriteNotifInfoByMap(ctx *gin.Context, notifTempId int64, o
buildHyperLink, ok := mp["build_hyperlink"]
if ok {
notifBuilder.BuildHyperLink = buildHyperLink.(func(ctx *gin.Context, frontendRouteId int64) ([]*dbstruct.NotifHyperlink, error))
notifBuilder.BuildHyperLink = buildHyperLink.(func(ctx *gin.Context, frontendRouteId int64, argsMap map[string][]any) ([]*dbstruct.NotifHyperlink, error))
}
hyperLinkParamsMap, ok := mp["hyperlink_params_map"]
if ok {
notifBuilder.HyperLinkParamsMap = hyperLinkParamsMap.(map[string][]any)
}
notifBuilders = append(notifBuilders, notifBuilder)
@ -2312,7 +2317,8 @@ func (s *Service) utilCalcAccountPunishmentEndNotifTime(acctpunishment *dbstruct
return notifTime, nil
}
func (s *Service) utilBuildInwardHyperLink(ctx *gin.Context, frontendRouteId int64) ([]*dbstruct.NotifHyperlink, error) {
func (s *Service) utilBuildInwardHyperLink(ctx *gin.Context, frontendRouteId int64,
argsMap map[string][]any) ([]*dbstruct.NotifHyperlink, error) {
// 获取跳转路径
frontendroute, err := _DefaultFrontendRoute.GetById(ctx, frontendRouteId)
@ -2321,16 +2327,19 @@ func (s *Service) utilBuildInwardHyperLink(ctx *gin.Context, frontendRouteId int
return make([]*dbstruct.NotifHyperlink, 0), err
}
appRoute := fmt.Sprintf(frontendroute.GetAppRoutePath(), argsMap["app"]...)
h5Route := fmt.Sprintf(frontendroute.GetH5RoutePath(), argsMap["app"]...)
hyperlinks := make([]*dbstruct.NotifHyperlink, 0)
hyperlinks = append(hyperlinks, &dbstruct.NotifHyperlink{
Action: goproto.String(consts.FrontendRouteAction_Inward),
Params: frontendroute.AppRoutePath,
Params: goproto.String(appRoute),
})
hyperlinks = append(hyperlinks, &dbstruct.NotifHyperlink{
Action: goproto.String(consts.FrontendRouteAction_Inward),
Params: frontendroute.H5RoutePath,
Params: goproto.String(h5Route),
})
return hyperlinks, nil

View File

@ -127,17 +127,18 @@ type NotifRecentReceive struct {
}
type NotifBuilder struct {
TemplateId int64 // 模板id
TemplateParams []any // 模板参数
ObjMids []int64 // 目标Mids
ObjType int64 // 目标类型
LinkTextTemplateParams []any // 链接模板参数
Thumbnail *MediaComponent // 缩略图
HyperLinks []*NotifHyperlink // 超链接数组
PushTime int64 // 推送时间
SetNid func(ctx *gin.Context, nid int64) error // nid存储函数一般用于取消推送
GetNid func() int64 // nid访问器
BuildHyperLink func(ctx *gin.Context, frontendRouteId int64) ([]*NotifHyperlink, error) // 超链接组装函数
TemplateId int64 // 模板id
TemplateParams []any // 模板参数
ObjMids []int64 // 目标Mids
ObjType int64 // 目标类型
LinkTextTemplateParams []any // 链接模板参数
Thumbnail *MediaComponent // 缩略图
HyperLinks []*NotifHyperlink // 超链接数组
PushTime int64 // 推送时间
SetNid func(ctx *gin.Context, nid int64) error // nid存储函数一般用于取消推送
GetNid func() int64 // nid访问器
BuildHyperLink func(ctx *gin.Context, frontendRouteId int64, argsMap map[string][]any) ([]*NotifHyperlink, error) // 超链接组装函数
HyperLinkParamsMap map[string][]any // 超链接参数map
}
// 消息内超链接信息

View File

@ -174,7 +174,7 @@ func AssembleNotification(ctx *gin.Context, notifBuilder *dbstruct.NotifBuilder)
if len(notifBuilder.HyperLinks) > 0 {
hyperlinks = notifBuilder.HyperLinks
} else if notifBuilder.BuildHyperLink != nil && cfg.FrontendRouteId > 0 {
hyperlinks, err = notifBuilder.BuildHyperLink(ctx, cfg.FrontendRouteId)
hyperlinks, err = notifBuilder.BuildHyperLink(ctx, cfg.FrontendRouteId, notifBuilder.HyperLinkParamsMap)
if err != nil {
logger.Error("BuildHyperLink fail, err: %v", err)
}