| | |
| | | package com.yeshi.fanli.service.manger;
|
| | |
|
| | | import java.util.HashMap;
|
| | | import java.util.Map;
|
| | |
|
| | | import org.springframework.cache.annotation.Cacheable;
|
| | | import org.springframework.stereotype.Component;
|
| | | import org.yeshi.utils.HttpUtil;
|
| | |
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | |
|
| | | @Component
|
| | | public class AppUpdateManager {
|
| | |
|
| | | public String getUpdateInfo(AcceptData acceptData) {
|
| | | Map<String, String> params = new HashMap<>();
|
| | | if ("android".equalsIgnoreCase(acceptData.getPlatform())) {// android更新
|
| | | 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);
|
| | | return result;
|
| | | }
|
| | |
|
| | | @Cacheable(value = "config", key = "#acceptData.platform+'-'+#acceptData.version")
|
| | | public String getUpdateInfoCache(AcceptData acceptData) {
|
| | | return getUpdateInfo(acceptData);
|
| | | }
|
| | |
|
| | | }
|
| | | package com.yeshi.fanli.service.manger; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | import org.springframework.cache.annotation.Cacheable; |
| | | import org.springframework.stereotype.Component; |
| | | import org.yeshi.utils.HttpUtil; |
| | | |
| | | import com.yeshi.fanli.entity.accept.AcceptData; |
| | | |
| | | @Component |
| | | public class AppUpdateManager { |
| | | |
| | | public String getUpdateInfo(AcceptData acceptData) { |
| | | Map<String, String> params = new HashMap<>(); |
| | | if ("android".equalsIgnoreCase(acceptData.getPlatform())) {// android更新 |
| | | 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); |
| | | return result; |
| | | } |
| | | |
| | | @Cacheable(value = "config", key = "#acceptData.platform+'-'+#acceptData.version") |
| | | public String getUpdateInfoCache(AcceptData acceptData) { |
| | | return getUpdateInfo(acceptData); |
| | | } |
| | | |
| | | } |