From 007cef3d1a8bbcb45f66a21b804151afe981c846 Mon Sep 17 00:00:00 2001 From: chenhao Date: Sat, 27 Apr 2024 17:22:02 +0800 Subject: [PATCH] revert 7dd5e042caa9c901bb7bd9831345e02a61c8137e revert by Robin at 20240427 --- api/consts/consts.go | 1 - apollostruct/restricted_visitor.go | 5 ----- app/mix/service/apiservice.go | 27 --------------------------- 3 files changed, 33 deletions(-) diff --git a/api/consts/consts.go b/api/consts/consts.go index 8ebf7a24..38ae7b2a 100644 --- a/api/consts/consts.go +++ b/api/consts/consts.go @@ -51,7 +51,6 @@ const ( DefaultMomentTextKey = "default_moment_text" MaxDailyZoneMomentCreateTimesKey = "max_daily_zone_moment_create_times" ReferentialZoneMomentKey = "referential_zone_moment" - RestrictedVisitorMomentKey = "restricted_visitor_moment" ) // del_flag diff --git a/apollostruct/restricted_visitor.go b/apollostruct/restricted_visitor.go index 16585ff7..1c0a25f1 100644 --- a/apollostruct/restricted_visitor.go +++ b/apollostruct/restricted_visitor.go @@ -5,8 +5,3 @@ type RestrictedVisitorCfg struct { RestrictedVisitorMids []int64 `json:"restricted_visitor_mids"` // 限制可见范围的访客mids RestrictedVisitorVisibleMids []int64 `json:"restricted_visitor_visible_mids"` // 限制访客可见的mids } - -type RestrictedVisitorMomentCfg struct { - RestrictedVisitorMids []int64 `json:"restricted_visitor_mids"` // 限制可见范围的访客mids - RestrictedVisitorVisibleMomentIds []int64 `json:"restricted_visitor_visible_moment_ids"` // 限制访客可见的动态ids -} diff --git a/app/mix/service/apiservice.go b/app/mix/service/apiservice.go index f418e669..721a5a07 100644 --- a/app/mix/service/apiservice.go +++ b/app/mix/service/apiservice.go @@ -2053,33 +2053,6 @@ func (s *Service) ApiGetMomentRecommList(ctx *gin.Context, req *momentproto.ApiR ids = append(ids, recommIds...) } - // 取apollo配置 - cfg := &apollostruct.RestrictedVisitorMomentCfg{} - err = apollo.GetJson(consts.RestrictedVisitorMomentKey, &cfg, apollo.ApolloOpts().SetNamespace("application")) - if err != nil { - logger.Error("Apollo read failed : %v", err) - return nil, errcode.ErrCodeApolloReadFail - } - - // 查询是否限制访客 - visitorMid := req.BaseRequest.Mid - for _, restricted_visitor_mid := range cfg.RestrictedVisitorMids { - if restricted_visitor_mid == visitorMid { // 是限制访问的访客 - recommMap := make(map[int64]int64) - for _, momentId := range ids { - recommMap[momentId] = 1 - } - restrictedRecommList := make([]int64, 0) - for _, restrictedVisitorVisibleMomentId := range cfg.RestrictedVisitorVisibleMomentIds { - if recommMap[restrictedVisitorVisibleMomentId] == 1 { - restrictedRecommList = append(restrictedRecommList, restrictedVisitorVisibleMomentId) - } - } - ids = restrictedRecommList - break - } - } - // 4.查询动态内容 recommMomentList, err = s.utilGetApiMomentVOListByIds(ctx, req.Mid, ids) if err != nil {