fix(update-service): 服务开通检查改为查 t_feature_service.enabled,而非 existsByAppKey
existsByAppKey 在服务关闭但历史版本仍存在时会误判为已开通。
改为调 tenant-service 内部接口 /services/{platform}/UPDATE 查 enabled 字段。
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
这个提交包含在:
父节点
3cf5e294aa
当前提交
d127ce785f
@ -75,7 +75,7 @@ public class AppVersionController {
|
||||
@RequestParam(required = false) String userId) {
|
||||
|
||||
String resolvedAppKey = resolveAndValidate(appKey, platform, licenseFile);
|
||||
boolean serviceActivated = versionRepository.existsByAppKey(resolvedAppKey);
|
||||
boolean serviceActivated = tenantClient.isUpdateServiceEnabled(resolvedAppKey, platform.name());
|
||||
boolean allowAnonymousCheck = publishConfigService.allowAnonymousUpdateCheck(resolvedAppKey);
|
||||
|
||||
if (!serviceActivated) {
|
||||
|
||||
@ -56,6 +56,4 @@ public interface AppVersionRepository extends JpaRepository<AppVersionEntity, St
|
||||
List<AppVersionEntity> findByAppKeyAndPlatformAndPackageNameAndVersionCodeAndPublishStatus(
|
||||
String appKey, AppVersionEntity.Platform platform, String packageName, int versionCode,
|
||||
AppVersionEntity.PublishStatus publishStatus);
|
||||
|
||||
boolean existsByAppKey(String appKey);
|
||||
}
|
||||
|
||||
@ -32,6 +32,24 @@ public class UpdateTenantClient {
|
||||
return cache.computeIfAbsent(appKey, this::fetchPlatformInfo);
|
||||
}
|
||||
|
||||
public boolean isUpdateServiceEnabled(String appKey, String platform) {
|
||||
String url = UriComponentsBuilder.fromHttpUrl(tenantServiceUrl)
|
||||
.path("/api/internal/sdk/apps/{appKey}/services/{platform}/UPDATE")
|
||||
.buildAndExpand(appKey, platform)
|
||||
.toUriString();
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.set("X-Internal-Token", internalToken);
|
||||
try {
|
||||
ResponseEntity<JsonNode> response = restTemplate.exchange(
|
||||
url, HttpMethod.GET, new HttpEntity<>(headers), JsonNode.class);
|
||||
JsonNode data = response.getBody() == null ? null : response.getBody().path("data");
|
||||
if (response.getStatusCode().is2xxSuccessful() && data != null && !data.isMissingNode()) {
|
||||
return data.path("enabled").asBoolean(false);
|
||||
}
|
||||
} catch (RestClientException ignored) {}
|
||||
return false;
|
||||
}
|
||||
|
||||
private PlatformInfo fetchPlatformInfo(String appKey) {
|
||||
String url = UriComponentsBuilder.fromHttpUrl(tenantServiceUrl)
|
||||
.path("/api/internal/sdk/apps/{appKey}/platform-info")
|
||||
|
||||
正在加载...
在新工单中引用
屏蔽一个用户