From b59fef5c00b15fdfdfa9d4be26e5bf6b41c75458 Mon Sep 17 00:00:00 2001 From: admin <2780501319@qq.com> Date: 星期日, 23 二月 2020 00:16:52 +0800 Subject: [PATCH] 2.0.7相关服务端功能添加 --- fanli/src/main/java/com/yeshi/fanli/controller/client/v1/HelpController.java | 51 ++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 36 insertions(+), 15 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/HelpController.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/HelpController.java index ab33d2e..fb61fd5 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/HelpController.java +++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/HelpController.java @@ -15,6 +15,7 @@ import com.yeshi.fanli.entity.accept.AcceptData; import com.yeshi.fanli.entity.bus.help.AppPageNotification; import com.yeshi.fanli.service.inter.help.AppPageNotificationService; +import com.yeshi.fanli.util.Constant; import com.yeshi.fanli.util.StringUtil; import com.yeshi.fanli.util.VersionUtil; @@ -42,9 +43,11 @@ return; } - AppPageNotification ap = appPageNotificationService.getAppPageNotificationByTypeCache(type); - if ("home".equalsIgnoreCase(type) - && VersionUtil.smallerThan_1_5_1(acceptData.getPlatform(), acceptData.getVersion()) && ap != null) { + String platform = acceptData.getPlatform(); + String version = acceptData.getVersion(); + + AppPageNotification ap = appPageNotificationService.getValidNotificationByTypeCache(type,platform, Integer.parseInt(version)); + if ("home".equalsIgnoreCase(type) && VersionUtil.smallerThan_1_5_1(platform, version) && ap != null) { AppPageNotification no = new AppPageNotification(); no.setContentUrl(""); no.setMd5("111111111111111111"); @@ -53,7 +56,7 @@ no.setType(ap.getType()); no.setUpdateTime(ap.getUpdateTime()); no.setCanClose(false); - no.setContent("灏婃暚鐨勭敤鎴凤紝涓烘洿鍔犲噯纭珮鏁堢殑涓轰綘杩斿埄銆佺渷閽憋紝璇峰崌绾у埌杩斿埄鍒告渶鏂扮増鏈�"); + no.setContent(String.format("灏婃暚鐨勭敤鎴凤紝涓烘洿鍔犲噯纭珮鏁堢殑涓轰綘杩斿埄銆佺渷閽憋紝璇峰崌绾у埌%s鏈�鏂扮増鏈�",Constant.getAppName(platform, version))); Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create(); out.print(JsonUtil.loadTrueResult(gson.toJson(no))); return; @@ -71,19 +74,37 @@ @RequestMapping(value = "updateApp") public void updateApp(AcceptData acceptData, PrintWriter out) { Map<String, String> params = new HashMap<>(); - params.put("method", "update"); - params.put("Platform", "Android"); - params.put("Version", acceptData.getVersion()); - params.put("device ", acceptData.getDevice()); - params.put("time", System.currentTimeMillis() + ""); - params.put("Package", acceptData.getPackages()); - params.put("device", acceptData.getDevice()); - params.put("platform", "Android"); - params.put("key", "a3f390d88e4c41f2747bfa2f1b5f87db"); - params.put("versionCode", acceptData.getVersion() + ""); + if ("android".equalsIgnoreCase(acceptData.getPlatform())) {// android鏇存柊 +// acceptData.setVersion("10"); + params.put("method", "update"); + params.put("Platform", "Android"); + params.put("Version", acceptData.getVersion()); + params.put("device ", acceptData.getDevice()); + params.put("time", System.currentTimeMillis() + ""); + params.put("Package", acceptData.getPackages()); + params.put("device", acceptData.getDevice()); + params.put("platform", "Android"); + params.put("key", "a3f390d88e4c41f2747bfa2f1b5f87db"); + params.put("versionCode", acceptData.getVersion() + ""); + } else {// IOS鏇存柊 + params.put("method", "update"); + params.put("Platform", "IOS"); + params.put("Version", acceptData.getVersion()); + params.put("device ", acceptData.getDevice()); + params.put("time", System.currentTimeMillis() + ""); + params.put("Package", acceptData.getPackages()); + params.put("device", acceptData.getDevice()); + params.put("platform", "IOS"); + params.put("key", "32bb90e8976aab5298d5da10fe66f21d"); + params.put("versionCode", acceptData.getVersion() + ""); + } String url = "http://update.yeshitv.com:8090/update/update"; String result = HttpUtil.post(url, params, null); - out.print(result); + try { + out.print(new String(result.getBytes("ISO-8859-1"), "UTF-8")); + } catch (UnsupportedEncodingException e) { + out.print(result); + } } } -- Gitblit v1.8.0