From 2ec42a5aacea35d2918f0e17f07685cf5b4d25c8 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期二, 12 五月 2020 20:20:41 +0800 Subject: [PATCH] 包名引用路径更改 --- fanli/src/main/java/com/yeshi/fanli/controller/client/v1/HelpController.java | 43 +++++++++++++++++++++++++++++++++++-------- 1 files changed, 35 insertions(+), 8 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 d82691e..82b2cfa 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 @@ -1,21 +1,23 @@ package com.yeshi.fanli.controller.client.v1; import java.io.PrintWriter; +import java.io.UnsupportedEncodingException; import javax.annotation.Resource; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; +import org.yeshi.utils.JsonUtil; import com.google.gson.Gson; import com.google.gson.GsonBuilder; 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.service.manger.AppUpdateManager; +import com.yeshi.fanli.util.Constant; import com.yeshi.fanli.util.StringUtil; import com.yeshi.fanli.util.VersionUtil; - -import org.yeshi.utils.JsonUtil; @Controller @RequestMapping("api/v1/help") @@ -23,6 +25,9 @@ @Resource private AppPageNotificationService appPageNotificationService; + + @Resource + private AppUpdateManager appUpdateManager; /** * 鑾峰彇app椤甸潰鐨勯�氱煡 @@ -38,13 +43,23 @@ return; } - AppPageNotification ap = appPageNotificationService.getAppPageNotificationByTypeCache(type); - if ("home".equalsIgnoreCase(type) - && VersionUtil.smallerThan_1_5_1(acceptData.getPlatform(), acceptData.getVersion()) && ap != null) { - ap.setCanClose(false); - ap.setContent("灏婃暚鐨勭敤鎴凤紝涓烘洿鍔犲噯纭珮鏁堢殑涓轰綘杩斿埄銆佺渷閽憋紝璇峰崌绾у埌杩斿埄鍒告渶鏂扮増鏈�"); + 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"); + no.setPageName(ap.getPageName()); + no.setShow(true); + no.setType(ap.getType()); + no.setUpdateTime(ap.getUpdateTime()); + no.setCanClose(false); + no.setContent(String.format("灏婃暚鐨勭敤鎴凤紝涓烘洿鍔犲噯纭珮鏁堢殑涓轰綘杩斿埄銆佺渷閽憋紝璇峰崌绾у埌%s鏈�鏂扮増鏈�", Constant.getAppName(platform, version))); Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create(); - out.print(JsonUtil.loadTrueResult(gson.toJson(ap))); + out.print(JsonUtil.loadTrueResult(gson.toJson(no))); return; } @@ -57,4 +72,16 @@ } } + @RequestMapping(value = "updateApp") + public void updateApp(AcceptData acceptData, PrintWriter out) { + if (Constant.IS_TEST) + acceptData.setVersion("20"); + String result = appUpdateManager.getUpdateInfoCache(acceptData); + try { + out.print(new String(result.getBytes("ISO-8859-1"), "UTF-8")); + } catch (UnsupportedEncodingException e) { + out.print(result); + } + } + } -- Gitblit v1.8.0