Skip to content

Commit

Permalink
mod: CR
Browse files Browse the repository at this point in the history
  • Loading branch information
yangrunkang committed Jun 17, 2023
1 parent b8aaa89 commit df2bf23
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ public CommentAd(List<CommentEnhance> 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()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,13 @@ public ContentAd(List<ContentEnhance> 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));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ public MemberAd(List<MemberEnhance> 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));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ public RadioAd(List<RadioEnhance> 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));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
}
Expand Down

0 comments on commit df2bf23

Please sign in to comment.