From 71ea6f93250eb0d17863c2a143f902e4a2a17d61 Mon Sep 17 00:00:00 2001 From: wangning <164851225@qq.com> Date: Thu, 29 Mar 2018 15:24:44 +0800 Subject: [PATCH] app Version --- .../core/impls/RetailAppServiceImp.java | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java index cd3d0e0de..60e64d11d 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java @@ -1112,17 +1112,21 @@ public class RetailAppServiceImp implements RetailAppService { Boolean isUpdate = PlatformEnvironment.getEnv().isAppUpdate(clientType); String updateContent = PlatformEnvironment.getEnv().getAppUpdateContent(clientType); int update_type = 0;// 0:不更新 1:更新 2:强制更新 - String versionInt = version.replace(".", ""); - String newAppVersionInt = newAppVersion.replace(".", ""); - if (Integer.valueOf(versionInt) < Integer.valueOf(newAppVersionInt)) { - update_type = 1; - if (isUpdate) { - update_type = 2; + String [] oldVersion = version.split("\\."); + String [] newVersion = newAppVersion.split("\\."); + JSONObject res = new JSONObject(); + res.put("update_content", updateContent); + for (int i = 0; i < newVersion.length; i++) { + if(Integer.valueOf(newVersion[i])>Integer.valueOf(oldVersion[i])){ + update_type = 1; + if (isUpdate) { + update_type = 2; + } + res.put("update_type", update_type); + return res; } } - JSONObject res = new JSONObject(); res.put("update_type", update_type); - res.put("update_content", updateContent); return res; } @@ -1428,4 +1432,5 @@ public class RetailAppServiceImp implements RetailAppService { } return sourceStr; } + }