diff --git a/app/mix/controller/init.go b/app/mix/controller/init.go index da76d8a3..ed5a684b 100644 --- a/app/mix/controller/init.go +++ b/app/mix/controller/init.go @@ -631,6 +631,7 @@ func Init(r *gin.Engine) { opNotificationGroup.POST("delete", middleware.JSONParamValidator(notificationproto.OpDeleteReq{}), middleware.JwtAuthenticator(), OpDeleteNotification) opNotificationGroup.POST("list", middleware.JSONParamValidator(notificationproto.OpListReq{}), middleware.JwtAuthenticator(), OpGetNotificationList) opNotificationGroup.POST("cancel", middleware.JSONParamValidator(notificationproto.OpCancelReq{}), middleware.JwtAuthenticator(), OpCancelNotification) + opNotificationGroup.POST("reload", middleware.JSONParamValidator(base.BaseRequest{}), middleware.JwtAuthenticator(), OpReloadUnreadCount) // 前端页面路由表 opFrontendRouteGroup := r.Group("/op/frontend_route", PrepareOp()) diff --git a/app/mix/dao/mongo.go b/app/mix/dao/mongo.go index e2523e11..397b54d5 100644 --- a/app/mix/dao/mongo.go +++ b/app/mix/dao/mongo.go @@ -6633,7 +6633,7 @@ func (m *Mongo) GetNotifReceiveListByObjMid(ctx *gin.Context, req *notificationp return list, err } -func (m *Mongo) GetNotifReceiveUrc(ctx *gin.Context) (results []map[any]any, err error) { +func (m *Mongo) GetNotifReceiveUrc(ctx *gin.Context) (results []map[string]any, err error) { col := m.getColNotifReceive() filterClause := qmgo.M{ diff --git a/app/mix/service/logic/notif_receive.go b/app/mix/service/logic/notif_receive.go index a9702c94..4215b283 100644 --- a/app/mix/service/logic/notif_receive.go +++ b/app/mix/service/logic/notif_receive.go @@ -72,11 +72,11 @@ func (p *NotifReceive) OpListByObjMid(ctx *gin.Context, req *notificationproto.O return list, nil } -func (p *NotifReceive) OpGetUrc(ctx *gin.Context) ([]map[any]any, error) { +func (p *NotifReceive) OpGetUrc(ctx *gin.Context) ([]map[string]any, error) { results, err := p.store.GetNotifReceiveUrc(ctx) if err != nil { logger.Error("GetNotifReceiveUrc fail, err: %v", err) - return make([]map[any]any, 0), err + return make([]map[string]any, 0), err } return results, nil } diff --git a/app/mix/service/service.go b/app/mix/service/service.go index dce9a32d..63f1a019 100644 --- a/app/mix/service/service.go +++ b/app/mix/service/service.go @@ -5309,8 +5309,16 @@ func (s *Service) OpReloadNotificationUrc(ctx *gin.Context, req base.BaseRequest if err != nil { logger.Error("OpGetUrc fail, req: %v, err: %v", util.ToJson(req), err) } - for k, v := range results { + for _, mp := range results { + idMp := mp["_id"].(map[string]any) + count := mp["count"].(int32) + mid := idMp["mid"].(int64) + nType := idMp["n_type"].(int64) + _, err = redis.GetRedisClient().IncrBy(util.GetNotifUrcIdForRedis(mid, nType), int64(count)) + if err != nil { + logger.Error("Redis IncrBy fail, err: %v", err) + } } }()