From cc132c7ce7db458db1bd23906454c3bd51010312 Mon Sep 17 00:00:00 2001 From: XuqmGroup Date: Thu, 21 May 2026 15:25:13 +0800 Subject: [PATCH] =?UTF-8?q?feat(license):=20license=20=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=20serverUrl=20=E5=AD=97=E6=AE=B5=EF=BC=8C?= =?UTF-8?q?=E7=A7=81=E6=9C=89=E5=8C=96=E9=83=A8=E7=BD=B2=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=86=99=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 私有化模式下生成的 license 文件包含 serverUrl,SDK 通过 XuqmSDK.autoInitialize() 读取后可自动配置所有服务端点, 无需在 App 层硬编码 appKey 或 serverUrl。 Co-Authored-By: Claude Sonnet 4.6 --- .../com/xuqm/tenant/controller/AppController.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tenant-service/src/main/java/com/xuqm/tenant/controller/AppController.java b/tenant-service/src/main/java/com/xuqm/tenant/controller/AppController.java index 7d02378..2ee207d 100644 --- a/tenant-service/src/main/java/com/xuqm/tenant/controller/AppController.java +++ b/tenant-service/src/main/java/com/xuqm/tenant/controller/AppController.java @@ -12,6 +12,7 @@ import com.xuqm.tenant.service.AppUserClient; import com.xuqm.tenant.service.EmailService; import com.xuqm.tenant.service.FeatureServiceManager; import com.xuqm.tenant.service.LicenseFileCrypto; +import com.xuqm.tenant.config.PrivateDeploymentProperties; import com.xuqm.tenant.service.OperationLogService; import jakarta.validation.Valid; import org.springframework.beans.factory.annotation.Value; @@ -43,6 +44,7 @@ public class AppController { private final TenantRepository tenantRepository; private final FeatureServiceManager featureServiceManager; private final AppUserClient appUserClient; + private final PrivateDeploymentProperties deployProps; @Value("${license.public-base-url:https://auth.dev.xuqinmin.com/}") private String licensePublicBaseUrl; @@ -51,13 +53,15 @@ public class AppController { OperationLogService operationLogService, TenantRepository tenantRepository, FeatureServiceManager featureServiceManager, - AppUserClient appUserClient) { + AppUserClient appUserClient, + PrivateDeploymentProperties deployProps) { this.appService = appService; this.emailService = emailService; this.operationLogService = operationLogService; this.tenantRepository = tenantRepository; this.featureServiceManager = featureServiceManager; this.appUserClient = appUserClient; + this.deployProps = deployProps; } @GetMapping @@ -178,6 +182,11 @@ public class AppController { payload.put("appName", app.getName()); payload.put("packageName", app.getPackageName()); payload.put("baseUrl", normalizeBaseUrl(licensePublicBaseUrl)); + // serverUrl is set only for private deployments; the SDK uses it to configure all service + // endpoints automatically via XuqmSDK.autoInitialize(). Public deployments use default endpoints. + if (deployProps.isPrivate()) { + payload.put("serverUrl", normalizeBaseUrl(licensePublicBaseUrl)); + } payload.put("issuedAt", java.time.Instant.now().toString()); String encrypted = LicenseFileCrypto.encrypt(new com.fasterxml.jackson.databind.ObjectMapper().valueToTree(payload).toString()); String filename = sanitizeFileName(app.getName()) + ".xuqmlicense";