revert by Robin at 20240427
This commit is contained in:
chenhao 2024-04-27 17:22:02 +08:00
parent 7dd5e042ca
commit 007cef3d1a
3 changed files with 0 additions and 33 deletions

View File

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

View File

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

View File

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