Przeglądaj źródła

杭州ip隐藏实物

zoujiajian 2 lat temu
rodzic
commit
c6025980c6

+ 23 - 2
netflix-web/src/main/java/com/cyksj/web/controller/goods/GoodsDonController.java

@@ -537,10 +537,12 @@ public class GoodsDonController {
 			yhsId = yhShopFrontService.getYhsIdByCustomId(customId);
 			key = RedisService.key.YH_HOME_PAGHE_CACHE_SHOP.getEnvName() + yhsId + ":homeManage";
 		}
-		//List<Long> filter_goodsIds = getFilterGoodsIds();
+//		List<Long> filter_goodsIds = getFilterGoodsIds();
 		List<Long> filter_goodsIds = null;
-		if (CollUtil.isNotEmpty(filter_goodsIds)) {
+		AtomicBoolean isRemoveRg = new AtomicBoolean(false);
+		if (isHzIp()) {
 			key += ":hz-ip";
+			isRemoveRg.set(true);
 		}
 		Long fUid = StpUserUtil.getUserIdAfterLogin();
 		Object o = redisService.get(key);
@@ -553,6 +555,9 @@ public class GoodsDonController {
 			final String conditionSql = condition;
 			Stream.of(HomeManagementConfig.Type.values())
 					.forEach(type -> {
+						if (isRemoveRg.get() && type == HomeManagementConfig.Type.rg) {
+							return;
+						}
 						MapBuilder builder = MapUtils.builder()
 								.field(HomeManagementFrontView::getType, type.name());
 						if (type == HomeManagementConfig.Type.ex || type == HomeManagementConfig.Type.vg) {
@@ -616,6 +621,13 @@ public class GoodsDonController {
         return filter_goodsIds;
     }
 
+	public Boolean isHzIp() {
+		if (StringUtil.getRealAddressByIP(ServletUtil.getClientIP(request)).contains("杭州")) {
+			return true;
+		}
+		return false;
+	}
+
     /**
      * @param goodsId
      * @param type    1、普通,2、注册平台
@@ -1078,10 +1090,19 @@ public class GoodsDonController {
 	@GetMapping("/get/pc/homeManage")
 	public Result<Map<String, List<HomeManagementFrontView>>> getPcHomeManagementFrontPage() {
 		String key = RedisService.key.YH_HOME_PAGHE_CACHE.getEnvName() + "pc:homeManage";
+		//移除奈飞客厅 临时
+		Long filterConfigId = null;
+		if (isHzIp()) {
+			key += ":hz_ip";
+			filterConfigId = 55l;
+		}
 		Object o = redisService.get(key);
 		if (o == null) {
 			MapBuilder builder = MapUtils.builder()
 					.field(HomeManagementFrontView::getAdType, List.of(HomeManagementConfig.AdType.pc.name(), HomeManagementConfig.AdType.pcSec.name(), HomeManagementConfig.AdType.pcDis.name())).op(Operator.InList);
+			if (filterConfigId != null) {
+				builder.field(HomeManagementFrontView::getHomeManageConfigId, filterConfigId).op(Operator.NotEqual);
+			}
 			List<HomeManagementFrontView> homeManagementFrontViews = beanSearcher.searchAll(HomeManagementFrontView.class, builder.build());
 			Map<HomeManagementConfig.AdType, List<HomeManagementFrontView>> map = homeManagementFrontViews.stream().collect(Collectors.groupingBy(HomeManagementFrontView::getAdType));
 			redisService.setNx(key, map, 50 * 60l);