| | |
| | | @RequestMapping(value = "getShowAd") |
| | | public void showAd(AcceptData acceptData, Long uid, PrintWriter out) { |
| | | String value = configService.getValue(ConfigKeyEnum.showSplashAd.getKey(), acceptData.getSystem()); |
| | | boolean huaweiShowAd = true; |
| | | if ("huawei".equalsIgnoreCase(acceptData.getChannel())) { |
| | | String version = configService.getValue(ConfigKeyEnum.huaweiOnLineVersionCode.getKey(), acceptData.getSystem()); |
| | | if (!StringUtil.isNullOrEmpty(version)) { |
| | | if (Integer.parseInt(version) == Integer.parseInt(acceptData.getVersion())) { |
| | | huaweiShowAd = false; |
| | | JSONObject configData = JSONObject.fromObject(value); |
| | | String channel = acceptData.getChannel().toLowerCase(); |
| | | if (configData.optString(channel) == null) { |
| | | channel = "qq"; |
| | | } |
| | | } |
| | | int version = configData.optInt(channel); |
| | | JSONObject data = new JSONObject(); |
| | | boolean show; |
| | | if (Integer.parseInt(acceptData.getVersion()) >= version) { |
| | | show = false; |
| | | } else { |
| | | show = true; |
| | | } |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | if ("0".equalsIgnoreCase(value.trim())) { |
| | | data.put("show", false); |
| | | } else { |
| | | if (huaweiShowAd) { |
| | | if (show) { |
| | | data.put("show", true); |
| | | //加载广告数据 |
| | | data.put("ad", configService.getValue(ConfigKeyEnum.gdtAdInfo, acceptData.getSystem())); |
| | | } else |
| | | data.put("show", false); |
| | | } |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | } |
| | | |