浏览代码

修改版本号

haungfuli 2 年之前
父节点
当前提交
ef46777aa7

+ 4 - 0
winsea-haixin-plugin-wangluohuoyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/HyAppVersion.java

@@ -52,6 +52,10 @@ public class HyAppVersion extends BaseModel<HyAppVersion> {
      * 版本code码
      */
     private String versionCode;
+    /**
+     * 更新类型(forcibly = 强制更新, solicit = 弹窗确认更新, silent = 静默更新)
+     */
+    private String updateType;
 
 
     @Override

+ 17 - 2
winsea-haixin-plugin-wangluohuoyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/AppVersionServiceImpl.java

@@ -24,12 +24,27 @@ public class AppVersionServiceImpl extends ServiceImpl<AppVersionMapper, HyAppVe
      */
     @Override
     public HyAppVersion selectInfo(String appid, String version, String imei, String type) {
+        HyAppVersion hyAppVersion1 = new HyAppVersion();
         if("hz".equals(type)){
             HyAppVersion hyAppVersion =this.selectById("1");
-            return hyAppVersion;
+            //将传入版本号转成int类型
+            String str = version.replace(".","");
+            int value1 = Integer.parseInt(str);
+            //数据库版本号与传入版本号比较,如果大于,更新
+            if (Integer.parseInt(hyAppVersion.getVersionCode()) > value1){
+                return hyAppVersion;
+            }
+            return hyAppVersion1;
         }else {
             HyAppVersion hyAppVersion =this.selectById("2");
-            return hyAppVersion;
+            //将传入版本号转成int类型
+            String str = version.replace(".","");
+            int value1 = Integer.parseInt(str);
+            //数据库版本号与传入版本号比较,如果大于,更新
+            if (Integer.parseInt(hyAppVersion.getVersionCode()) > value1){
+                return hyAppVersion;
+            }
+            return hyAppVersion1;
         }
     }
 }