diff --git a/upupor-data/src/main/java/com/upupor/data/dto/page/ad/CommentAd.java b/upupor-data/src/main/java/com/upupor/data/dto/page/ad/CommentAd.java index 5ff9d872..dad137a3 100644 --- a/upupor-data/src/main/java/com/upupor/data/dto/page/ad/CommentAd.java +++ b/upupor-data/src/main/java/com/upupor/data/dto/page/ad/CommentAd.java @@ -47,13 +47,13 @@ public CommentAd(List comments) { @Override protected Boolean exists() { - return getVoList().parallelStream().anyMatch(t -> t.getComment().getCommentId().equals(CcConstant.GoogleAd.FEED_AD)); + return getVoList().parallelStream().anyMatch(t -> t.getComment().getCommentId().equals(CcConstant.GoogleAdConstant.FEED_AD)); } @Override protected void insertAd(int adIndex) { Comment empty = Comment.empty(); - empty.setCommentId(CcConstant.GoogleAd.FEED_AD); + empty.setCommentId(CcConstant.GoogleAdConstant.FEED_AD); getVoList().add(adIndex, Converter.commentEnhance(empty, new MemberEnhance())); } } diff --git a/upupor-data/src/main/java/com/upupor/data/dto/page/ad/ContentAd.java b/upupor-data/src/main/java/com/upupor/data/dto/page/ad/ContentAd.java index 51d559fe..32b06ea5 100644 --- a/upupor-data/src/main/java/com/upupor/data/dto/page/ad/ContentAd.java +++ b/upupor-data/src/main/java/com/upupor/data/dto/page/ad/ContentAd.java @@ -48,14 +48,13 @@ public ContentAd(List contentEnhanceList) { @Override protected Boolean exists() { - return getVoList().parallelStream().anyMatch(t -> t.getContent().getContentId().equals(CcConstant.GoogleAd.FEED_AD)); + return getVoList().parallelStream().anyMatch(t -> t.getContent().getContentId().equals(CcConstant.GoogleAdConstant.FEED_AD)); } @Override protected void insertAd(int adIndex) { Content ad = Content.init(); - ; - ad.setContentId(CcConstant.GoogleAd.FEED_AD); + ad.setContentId(CcConstant.GoogleAdConstant.FEED_AD); getVoList().add(adIndex, Converter.contentEnhance(ad)); } } diff --git a/upupor-data/src/main/java/com/upupor/data/dto/page/ad/MemberAd.java b/upupor-data/src/main/java/com/upupor/data/dto/page/ad/MemberAd.java index d5347bb6..c52079bb 100644 --- a/upupor-data/src/main/java/com/upupor/data/dto/page/ad/MemberAd.java +++ b/upupor-data/src/main/java/com/upupor/data/dto/page/ad/MemberAd.java @@ -47,13 +47,13 @@ public MemberAd(List memberEnhanceList) { @Override protected Boolean exists() { - return getVoList().parallelStream().anyMatch(t -> t.getMember().getUserId().equals(CcConstant.GoogleAd.FEED_AD)); + return getVoList().parallelStream().anyMatch(t -> t.getMember().getUserId().equals(CcConstant.GoogleAdConstant.FEED_AD)); } @Override protected void insertAd(int adIndex) { Member member = new Member(); - member.setUserId(CcConstant.GoogleAd.FEED_AD); + member.setUserId(CcConstant.GoogleAdConstant.FEED_AD); getVoList().add(adIndex, Converter.memberEnhance(member)); } } diff --git a/upupor-data/src/main/java/com/upupor/data/dto/page/ad/RadioAd.java b/upupor-data/src/main/java/com/upupor/data/dto/page/ad/RadioAd.java index 2afb8fde..18be9c28 100644 --- a/upupor-data/src/main/java/com/upupor/data/dto/page/ad/RadioAd.java +++ b/upupor-data/src/main/java/com/upupor/data/dto/page/ad/RadioAd.java @@ -48,14 +48,14 @@ public RadioAd(List radioEnhanceList) { @Override protected Boolean exists() { - return getVoList().parallelStream().anyMatch(t -> t.getRadio().getRadioId().equals(CcConstant.GoogleAd.FEED_AD)); + return getVoList().parallelStream().anyMatch(t -> t.getRadio().getRadioId().equals(CcConstant.GoogleAdConstant.FEED_AD)); } @Override protected void insertAd(int adIndex) { Radio radio = new Radio(); - radio.setRadioId(CcConstant.GoogleAd.FEED_AD); - radio.setUserId(CcConstant.GoogleAd.FEED_AD); + radio.setRadioId(CcConstant.GoogleAdConstant.FEED_AD); + radio.setUserId(CcConstant.GoogleAdConstant.FEED_AD); radio.setCreateTime(CcDateUtil.getCurrentTime()); getVoList().add(adIndex, Converter.radioEnhance(radio)); } diff --git a/upupor-framework/src/main/java/com/upupor/framework/CcConstant.java b/upupor-framework/src/main/java/com/upupor/framework/CcConstant.java index 83763306..79f4e45a 100644 --- a/upupor-framework/src/main/java/com/upupor/framework/CcConstant.java +++ b/upupor-framework/src/main/java/com/upupor/framework/CcConstant.java @@ -347,7 +347,7 @@ public static final class Time { /** * 缓存常量 */ - public static final class GoogleAd { + public static final class GoogleAdConstant { public static final String FEED_AD = "google-ad-feed"; public static final String CLIENT_ID = "googleClient"; public static final String RIGHT_SLOT = "googleRightSlot"; diff --git a/upupor-web/src/main/java/com/upupor/web/aspects/service/view/SetUpuporConfig.java b/upupor-web/src/main/java/com/upupor/web/aspects/service/view/SetUpuporConfig.java index 417d2d95..4927e21e 100644 --- a/upupor-web/src/main/java/com/upupor/web/aspects/service/view/SetUpuporConfig.java +++ b/upupor-web/src/main/java/com/upupor/web/aspects/service/view/SetUpuporConfig.java @@ -29,6 +29,7 @@ package com.upupor.web.aspects.service.view; +import com.upupor.framework.config.GoogleAd; import com.upupor.framework.config.UpuporConfig; import com.upupor.web.UpuporWebApplication; import lombok.RequiredArgsConstructor; @@ -60,9 +61,10 @@ public void prepare(ViewData viewData) { modelAndView.addObject(GOOGLE_TAG_ID, upuporConfig.getGoogleTagId()); modelAndView.addObject(GOOGLE_GA_4, upuporConfig.getGoogleGa4()); // 谷歌广告信息 - modelAndView.addObject(GoogleAd.CLIENT_ID, upuporConfig.getGoogleAd().getDataAdClientId()); - modelAndView.addObject(GoogleAd.RIGHT_SLOT, upuporConfig.getGoogleAd().getRightSlot()); - modelAndView.addObject(GoogleAd.FEED_SLOT, upuporConfig.getGoogleAd().getFeedSlot()); + GoogleAd googleAdConfig = upuporConfig.getGoogleAd(); + modelAndView.addObject(GoogleAdConstant.CLIENT_ID, googleAdConfig.getDataAdClientId()); + modelAndView.addObject(GoogleAdConstant.RIGHT_SLOT, googleAdConfig.getRightSlot()); + modelAndView.addObject(GoogleAdConstant.FEED_SLOT, googleAdConfig.getFeedSlot()); // 分析开关 modelAndView.addObject(ANALYZE_SWITCH, upuporConfig.getAnalyzeSwitch()); }