by Robin at 20241213

This commit is contained in:
Robin 2024-12-13 17:20:26 +08:00
parent efaefd15a7
commit 3bab569aa5
3 changed files with 11 additions and 0 deletions

View File

@ -130,10 +130,14 @@ func (s *NotifBcstCenter) pushNotifsToMids(ctx *gin.Context, nids []int64, objMi
s.tryToReplaceRecentReceive(midRecentReceiveMap[mid], notifReceive)
}
}
logger.Info("trying to update recent_receive...")
// 尝试更新最近接收消息记录
for mid, recentReceiveMap := range midRecentReceiveMap {
logger.Info("recent_receive_map: %v", recentReceiveMap)
for nType, recentReceive := range recentReceiveMap {
id := util.GetNotifRecentReceiveId(mid, nType)
logger.Info("trying to update recent_receive for %v to %v", id, recentReceive)
_, err := _DefaultNotifRecentReceive.GetAndUpdateNotifRecentReceive(ctx, id, recentReceive)
if err != nil {
logger.Error("GetAndUpdateNotifRecentReceive fail, err: %v", err)
@ -242,8 +246,10 @@ func (s *NotifBcstCenter) pullAllBcstedNotifs(ctx *gin.Context, vers, receiveVer
}
}
// 尝试更新最近接收消息记录
logger.Info("recent_receive_map: %v", recentReceiveMap)
for nType, recentReceive := range recentReceiveMap {
id := util.GetNotifRecentReceiveId(objMid, nType)
logger.Info("trying to update recent_receive for %v to %v", id, recentReceive)
_, err := _DefaultNotifRecentReceive.GetAndUpdateNotifRecentReceive(ctx, id, recentReceive)
if err != nil {
logger.Error("GetAndUpdateNotifRecentReceive fail, err: %v", err)

View File

@ -2364,6 +2364,7 @@ func (s *Service) utilBuildInwardHyperLink(ctx *gin.Context, frontendRouteId int
}
func (s *Service) utilIncrUrc(mid, nType, incr int64) error {
logger.Info("increasing urc_%v_%v by %v records", incr)
_, err := redis.GetRedisClient().IncrBy(util.GetNotifUrcIdForRedis(mid, nType), incr)
if err != nil {
logger.Error("Redis IncrBy fail, err: %v", err)
@ -2378,6 +2379,7 @@ func (s *Service) utilIncrUrc(mid, nType, incr int64) error {
}
func (s *Service) utilDecrUrc(mid, nType, incr int64) error {
logger.Info("decreasing urc_%v_%v by %v records", incr)
_, err := redis.GetRedisClient().DecrBy(util.GetNotifUrcIdForRedis(mid, nType), incr)
if err != nil {
logger.Error("Redis DecrBy fail, err: %v", err)

View File

@ -169,6 +169,9 @@ func AssembleNotification(ctx *gin.Context, notifBuilder *dbstruct.NotifBuilder)
msg := fmt.Sprintf(cfg.NotifTemplate, notifBuilder.TemplateParams...)
notification.Message = goproto.String(msg)
// 标题
notification.Title = goproto.String(cfg.Title)
// 超链接信息
hyperlinks := make([]*dbstruct.NotifHyperlink, 0)
if len(notifBuilder.HyperLinks) > 0 {