by Robin at 20241127

This commit is contained in:
Robin 2024-11-27 16:23:15 +08:00
parent deb84e1b4e
commit f85edfa766
4 changed files with 13 additions and 4 deletions

View File

@ -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())

View File

@ -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{

View File

@ -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
}

View File

@ -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)
}
}
}()