fix(app): lost update log for point to native package

This commit is contained in:
Timi
2026-11-17 16:37:33 +08:00
parent 7294e9050d
commit 5604edc00b
@@ -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 灰度比例,万分比