From 2d88839407045d9f483cf2ab4aed149a59e22df4 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期五, 17 六月 2022 18:38:27 +0800 Subject: [PATCH] bug修改(后台管理页面) --- app/src/main/java/com/yeshi/makemoney/app/controller/client/api/ConfigController.java | 51 +++++++++++++++++++++++++++++++++------------------ 1 files changed, 33 insertions(+), 18 deletions(-) diff --git a/app/src/main/java/com/yeshi/makemoney/app/controller/client/api/ConfigController.java b/app/src/main/java/com/yeshi/makemoney/app/controller/client/api/ConfigController.java index d98fcc8..d215259 100644 --- a/app/src/main/java/com/yeshi/makemoney/app/controller/client/api/ConfigController.java +++ b/app/src/main/java/com/yeshi/makemoney/app/controller/client/api/ConfigController.java @@ -1,5 +1,7 @@ package com.yeshi.makemoney.app.controller.client.api; +import com.google.gson.Gson; +import com.yeshi.makemoney.app.dto.config.AdSourceConfig; import com.yeshi.makemoney.app.entity.config.SystemConfigKey; import com.yeshi.makemoney.app.service.inter.config.SystemConfigService; import com.yeshi.makemoney.app.vo.AcceptData; @@ -42,47 +44,60 @@ SystemConfigKey.course, SystemConfigKey.unRegister, SystemConfigKey.privacyComplain, - SystemConfigKey.vipLink + SystemConfigKey.helpLink, + SystemConfigKey.disclaimerLink }; for (SystemConfigKey config : configs) { String value = systemConfigService.getValueCache(acceptData.getSystem(), config); data.put(config.name(), value); } + //杩斿洖姝e湪涓婄嚎鐨勭増鏈� + try { + String value = systemConfigService.getValueCache(acceptData.getSystem(), SystemConfigKey.onLiningVersion); + JSONObject json = JSONObject.fromObject(value); + String channel = acceptData.getChannel(); + if (json.optJSONObject(channel.toLowerCase()) == null) { + channel = "qq"; + } + json = json.optJSONObject(channel.toLowerCase()); + int onliningVersion = json.optInt("version"); + if (onliningVersion <= acceptData.getVersion()) { + //姝e湪涓婄嚎 + data.put("onLining", true); + } else { + //灏氭湭涓婄嚎 + data.put("onLining", false); + } + } catch (Exception e) { + data.put("onLining", false); + } - //TODO 骞垮憡K鎺ュ彛閰嶇疆 SystemConfigKey[] ads = new SystemConfigKey[]{ - + SystemConfigKey.splashAd, + SystemConfigKey.rewardAd, + SystemConfigKey.exitAppAd }; + JSONObject adConfig = new JSONObject(); for (SystemConfigKey ad : ads) { String value = systemConfigService.getValueCache(acceptData.getSystem(), ad); JSONObject valueJSON = JSONObject.fromObject(value); - String channel = acceptData.getChannel(); + String channel = acceptData.getChannel().toLowerCase(); if (StringUtil.isNullOrEmpty(channel) || valueJSON.optJSONObject(channel) == null) { channel = "qq"; } valueJSON = valueJSON.optJSONObject(channel.toLowerCase()); if (valueJSON != null) { - if (acceptData.getVersion() <= valueJSON.optInt("version")) { - String pid = valueJSON.optString("pid"); - String type = valueJSON.optString("type"); - valueJSON = new JSONObject(); - valueJSON.put("pid", pid); - valueJSON.put("type", type); - } else { - valueJSON = null; + AdSourceConfig adSourceConfig = new Gson().fromJson(valueJSON.toString(), AdSourceConfig.class); + if (acceptData.getVersion() <= adSourceConfig.getVersion()) { + adConfig.put(ad.name(), new Gson().toJson(adSourceConfig.getTypes())); } } - - if (valueJSON != null) { - data.put(ad.name().replace("ad_", ""), valueJSON.toString()); - } } - - + data.put("ad", adConfig); return JsonUtil.loadTrueResult(data); } -- Gitblit v1.8.0