From f537abe9f3646c739beaf15076246a2f71a347e9 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期四, 20 二月 2025 16:57:55 +0800 Subject: [PATCH] IOS广告增加区域屏蔽 --- src/main/java/com/yeshi/buwan/job/AdJob.java | 56 ++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 48 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/yeshi/buwan/job/AdJob.java b/src/main/java/com/yeshi/buwan/job/AdJob.java index 08861c6..fcd64b5 100644 --- a/src/main/java/com/yeshi/buwan/job/AdJob.java +++ b/src/main/java/com/yeshi/buwan/job/AdJob.java @@ -2,9 +2,9 @@ import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.handler.annotation.XxlJob; -import com.yeshi.buwan.domain.Config; -import com.yeshi.buwan.domain.DetailSystem; -import com.yeshi.buwan.service.imp.ConfigService; +import com.yeshi.buwan.domain.system.DetailSystemConfig; +import com.yeshi.buwan.domain.system.DetailSystem; +import com.yeshi.buwan.service.imp.DetailSystemConfigService; import com.yeshi.buwan.service.imp.SystemService; import com.yeshi.buwan.util.EHCacheManager; import net.sf.json.JSONObject; @@ -19,7 +19,7 @@ @Component public class AdJob { @Resource - private ConfigService configService; + private DetailSystemConfigService configService; @Resource private SystemService systemService; @Resource @@ -54,6 +54,34 @@ return ReturnT.SUCCESS; } + //鎵撳紑vivo搴旂敤甯傚満骞垮憡 + + //鎵撳紑鍗庝负搴旂敤甯傚満鐨勫箍鍛� + @XxlJob("ad-vivo-check") + public ReturnT<String> openVIVOAd(String params) throws Exception { + JSONObject paramsJson = JSONObject.fromObject(params); + String appId = paramsJson.optString("appId"); + String systemId = paramsJson.optString("detailSystemId"); + //搴旂敤甯傚満鐨勭増鏈� + Integer onLineVersion = AppMarketUtil.getVIVOLatestVersionCode(appId); + if (onLineVersion == null) { + throw new Exception("搴旂敤甯傚満鐗堟湰鑾峰彇澶辫触锛�" + appId); + } + + //鑾峰彇姝e湪涓婄嚎鐨勭増鏈� + DetailSystem detailSystem = systemService.getDetailSystemById(systemId); + Map<String, String> map = configService.getConfigAsMap(detailSystem, 1); + //姝e湪涓婄嚎鐨勭増鏈� + String onLiningVersionCode = map.get("ad_click_download_version"); + //鏄惁宸茬粡涓婄嚎瀹屾垚 + if (onLineVersion >= Integer.parseInt(onLiningVersionCode)) { + //宸茬粡涓婄嚎,璁剧疆 + showAd("vivo", detailSystem, onLineVersion + 1); + } + return ReturnT.SUCCESS; + } + + /** * 鎵撳紑骞垮憡 * @@ -61,7 +89,7 @@ * @param version */ public void showAd(String channel, DetailSystem detailSystem, int version) { - Config config = configService.getConfigByKey("video_detail_full_video_version_channel", detailSystem, version); + DetailSystemConfig config = configService.getConfigByKey("video_detail_full_video_version_channel", detailSystem, version); updateVersionConfig(channel, config, version); config = configService.getConfigByKey("ad_splash_config", detailSystem, version); updateVersionConfig(channel, config, version); @@ -71,10 +99,22 @@ } config = configService.getConfigByKey("ad_play_video_pre", detailSystem, version); updateVersionConfig(channel, config, version); + config = configService.getConfigByKey("ad_exit_app", detailSystem, version); updateVersionConfig(channel, config, version); config = configService.getConfigByKey("ad_video_detail_full_video", detailSystem, version); + updateVersionConfig(channel, config, version); + + config = configService.getConfigByKey("ad_video_search", detailSystem, version); + updateVersionConfig(channel, config, version); + + //鐑惎鍔ㄥ紑灞� + config = configService.getConfigByKey("ad_splash_hot_start", detailSystem, version); + updateVersionConfig(channel, config, version); + + //PPTV瑙嗛鍏嶅箍鍛婃潈鐩� + config = configService.getConfigByKey("pptv_no_ad_reward", detailSystem, version); updateVersionConfig(channel, config, version); //鍒犻櫎缂撳瓨 @@ -87,12 +127,12 @@ * @return */ public int getOnliningVersionCode(DetailSystem detailSystem) { - Config config = configService.getConfigByKey("ad_click_download_version", detailSystem, 1); + DetailSystemConfig config = configService.getConfigByKey("ad_click_download_version", detailSystem, 1); return Integer.parseInt(config.getValue()); } public void setOnliningVersionCode(int versionCode, DetailSystem detailSystem) { - Config config = configService.getConfigByKey("ad_click_download_version", detailSystem, 1); + DetailSystemConfig config = configService.getConfigByKey("ad_click_download_version", detailSystem, 1); config.setValue(versionCode + ""); configService.updateConfig(config); } @@ -103,7 +143,7 @@ * @param config * @param version */ - private void updateVersionConfig(String channel, Config config, int version) { + private void updateVersionConfig(String channel, DetailSystemConfig config, int version) { channel = channel.toLowerCase(); if (config == null) return; -- Gitblit v1.8.0