by Robin at 20241204

This commit is contained in:
Robin 2024-12-04 16:55:33 +08:00
parent 3d34992b20
commit b9f7164a33
2 changed files with 18 additions and 1 deletions

View File

@ -74,6 +74,7 @@ const (
NotifBannerInfoKey = "notif_banner_info"
NTypeListKey = "n_type_list"
AcctPunishmentRealEndTimeKey = "acct_punishment_real_endtime"
DefaultNotifThumbnailIdKey = "default_notif_thumbnail_id"
)
// del_flag

View File

@ -5,9 +5,11 @@ import (
"service/apollostruct"
"service/app/mix/service"
"service/app/mix/service/logic"
"service/bizcommon/util"
"service/dbstruct"
"service/library/apollo"
"service/library/logger"
"service/library/mediafiller"
"service/api/consts"
notificationproto "service/api/proto/notification/proto"
@ -183,8 +185,22 @@ func AssembleNotification(ctx *gin.Context, notifBuilder *dbstruct.NotifBuilder)
if len(hyperlinks) > 0 {
linkText := fmt.Sprintf(cfg.LinkTextTemplate, notifBuilder.LinkTextTemplateParams...)
notification.LinkText = goproto.String(linkText)
notification.Thumbnail = notifBuilder.Thumbnail
notification.HyperLinks = hyperlinks
// 填充缩略图
if len(notifBuilder.Thumbnail.GetImageIds()) == 0 {
defaultThumbnailId, err := apollo.GetIntValue(consts.DefaultNotifThumbnailIdKey, apollo.ApolloOpts().SetNamespace("application"))
if err != nil {
logger.Error("Apollo read failed : %v", err)
} else {
notification.Thumbnail = &dbstruct.MediaComponent{
ImageIds: util.Int64Slice([]int64{int64(defaultThumbnailId)}),
}
}
} else {
notification.Thumbnail = notifBuilder.Thumbnail
}
mediafiller.FillEntity(ctx, notification.Thumbnail)
}
// 推送时间