From e75aa66747873be99d1e88240e6bcad6d36b2427 Mon Sep 17 00:00:00 2001 From: XuqmGroup Date: Sat, 23 May 2026 03:48:02 +0800 Subject: [PATCH] =?UTF-8?q?refactor(update):=20=E7=A7=BB=E9=99=A4=E5=8C=85?= =?UTF-8?q?=E5=90=8D=E6=A0=A1=E9=AA=8C=E9=80=BB=E8=BE=91=E7=AE=80=E5=8C=96?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E6=A3=80=E6=9F=A5=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除了 AppVersionController 中的 packageName 参数验证 - 简化了 resolveAndValidate 方法的参数列表 - 删除了包名校验相关的业务逻辑和异常抛出 - 移除了对 tenantClient 平台信息的包名校验调用 - 更新了方法签名以减少参数传递复杂度 --- .../update/controller/AppVersionController.java | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/update-service/src/main/java/com/xuqm/update/controller/AppVersionController.java b/update-service/src/main/java/com/xuqm/update/controller/AppVersionController.java index e28d91a..f28c00c 100644 --- a/update-service/src/main/java/com/xuqm/update/controller/AppVersionController.java +++ b/update-service/src/main/java/com/xuqm/update/controller/AppVersionController.java @@ -60,11 +60,10 @@ public class AppVersionController { @RequestParam(required = false) String appKey, @RequestParam AppVersionEntity.Platform platform, @RequestParam int currentVersionCode, - @RequestParam @jakarta.validation.constraints.NotBlank String packageName, @RequestParam(required = false) String licenseFile, @RequestParam(required = false) String userId) { - String resolvedAppKey = resolveAndValidate(appKey, platform, packageName, licenseFile); + String resolvedAppKey = resolveAndValidate(appKey, platform, licenseFile); boolean allowAnonymousCheck = publishConfigService.allowAnonymousUpdateCheck(resolvedAppKey); Optional latest = versionRepository @@ -494,26 +493,14 @@ public class AppVersionController { return currentStatus == AppVersionEntity.PublishStatus.PUBLISHED ? "PUBLISH" : "SAVE_DRAFT"; } - private String resolveAndValidate(String appKey, AppVersionEntity.Platform platform, String packageName, String licenseFile) { + private String resolveAndValidate(String appKey, AppVersionEntity.Platform platform, String licenseFile) { if (hasText(licenseFile)) { LicenseFileCrypto.LicensePayload payload = LicenseFileCrypto.decrypt(licenseFile); - if (!payload.matchesPackageName(packageName)) { - throw new BusinessException(403, "包名与应用配置不匹配"); - } return payload.appKey(); } if (!hasText(appKey)) { throw new BusinessException(400, "appKey 或 licenseFile 必须提供其中一个"); } - UpdateTenantClient.PlatformInfo info = tenantClient.getPlatformInfo(appKey); - String registered = switch (platform) { - case IOS -> info.iosBundleId(); - case HARMONY -> info.harmonyBundleName(); - default -> info.androidPackageName(); - }; - if (hasText(registered) && !registered.equals(packageName)) { - throw new BusinessException(403, "包名与应用配置不匹配"); - } return appKey; }