| | |
| | | return toDetailVO(requireItem(id)); |
| | | } |
| | | |
| | | @Transactional |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AppVersionDetailVO create(AppVersionCreateRequest request) { |
| | | AppVersionConfig latest = latest(); |
| | | String androidFileUrl = normalizeOptionalText(request.getAndroidFileUrl()); |
| | |
| | | return vo; |
| | | } |
| | | |
| | | public AppVersionCheckVO checkUpdateNew(String platform) { |
| | | |
| | | String normalizedPlatform = normalizePlatform(platform); |
| | | AppVersionConfig latest = latest(); |
| | | AppVersionCheckVO vo = new AppVersionCheckVO(); |
| | | if (latest == null) { |
| | | vo.setHasUpdate(Boolean.FALSE); |
| | | return vo; |
| | | } |
| | | |
| | | String downloadUrl = AppVersionConfig.PLATFORM_ANDROID.equals(normalizedPlatform) |
| | | ? normalizeOptionalText(latest.getAndroidFileUrl()) |
| | | : normalizeOptionalText(latest.getIosFileUrl()); |
| | | boolean hasUpdate = downloadUrl != null; |
| | | vo.setHasUpdate(hasUpdate); |
| | | if (!hasUpdate) { |
| | | return vo; |
| | | } |
| | | vo.setLatestVersionNo(latest.getVersionNo()); |
| | | vo.setLatestVersionCode(defaultNumber(latest.getVersionCode())); |
| | | vo.setForceUpdate(integerToBoolean(latest.getForceUpdate())); |
| | | vo.setUpdateNotice(latest.getUpdateNotice()); |
| | | vo.setDownloadUrl(downloadUrl); |
| | | return vo; |
| | | } |
| | | |
| | | /** |
| | | * 判断后台最新版本是否高于当前 APP,兼容原生 versionCode 与展示 versionNo 不一致的历史包。 |
| | | */ |