diff --git a/pom.xml b/pom.xml index 0372c7b..f0a8ca9 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ com.imyeyu.timiserverapi TimiServerAPI - 1.0.75 + 1.0.76 jar TimiServerAPI imyeyu.com API diff --git a/src/main/java/com/imyeyu/api/modules/app/service/AppVersionService.java b/src/main/java/com/imyeyu/api/modules/app/service/AppVersionService.java index 36ef6cb..008c131 100644 --- a/src/main/java/com/imyeyu/api/modules/app/service/AppVersionService.java +++ b/src/main/java/com/imyeyu/api/modules/app/service/AppVersionService.java @@ -114,8 +114,11 @@ public class AppVersionService { return new AppUpdateNotesResponse(null, Collections.emptyList()); } AppRelease target = resolveChannelRelease(product, req); - // 原生包更新走安装包,与热更日志无关 + // 安装包不属于更新日志:通道指向原生包时,改用最新发布的热更包做上界 if (target == null || target.getKind() == AppRelease.Kind.NATIVE) { + target = latestPublishedBundle(product); + } + if (target == null) { return new AppUpdateNotesResponse(null, Collections.emptyList()); } // 当前版本不低于通道版本:已是最新,或回滚后反而超前 @@ -269,6 +272,23 @@ public class AppVersionService { return latest; } + /// 取最近一次发布的热更包 + /// + /// 通道指向原生包时,更新日志没有「通道版本」可用,改用这里兜底。 + /// 日志是「这个产品最近发了什么」,与设备能不能装无关,所以不套灰度与兼容区间 + /// + /// @param product 产品 + /// @return 版本最高的已发布热更包,没有则返回 null + private AppRelease latestPublishedBundle(AppProduct product) { + AppRelease latest = null; + for (AppRelease item : releaseMapper.selectPublished(product.getId(), AppRelease.Kind.BUNDLE)) { + if (latest == null || 0 < compareVersion(item.getVersionName(), latest.getVersionName())) { + latest = item; + } + } + return latest; + } + /// 判断设备是否命中灰度 /// /// @param grayPermille 灰度比例,万分比