Fix license service activation visibility

这个提交包含在:
XuqmGroup 2026-05-15 21:25:58 +08:00
父节点 7ce4d728cc
当前提交 d5b8f03996
共有 2 个文件被更改,包括 12 次插入10 次删除

查看文件

@ -10,6 +10,7 @@ import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -37,13 +38,12 @@ public class LicenseInternalController {
} }
try { try {
CompanyEntity company = companyService.getById(appKey); CompanyEntity company = companyService.getById(appKey);
Map<String, Object> data = Map.of( Map<String, Object> data = new HashMap<>();
"exists", true, data.put("exists", true);
"active", companyService.isCompanyValid(company), data.put("active", companyService.isCompanyValid(company));
"maxDevices", company.getMaxDevices(), data.put("maxDevices", company.getMaxDevices());
"registeredDevices", company.getRegisteredDevices(), data.put("registeredDevices", company.getRegisteredDevices());
"expiresAt", company.getExpiresAt() data.put("expiresAt", company.getExpiresAt());
);
return ResponseEntity.ok(ApiResponse.success(data)); return ResponseEntity.ok(ApiResponse.success(data));
} catch (Exception e) { } catch (Exception e) {
return ResponseEntity.ok(ApiResponse.success(Map.of("exists", false))); return ResponseEntity.ok(ApiResponse.success(Map.of("exists", false)));

查看文件

@ -51,7 +51,8 @@ public class FeatureServiceManager {
FeatureServiceEntity.ServiceType.IM, FeatureServiceEntity.ServiceType.IM,
FeatureServiceEntity.ServiceType.PUSH, FeatureServiceEntity.ServiceType.PUSH,
FeatureServiceEntity.ServiceType.UPDATE, FeatureServiceEntity.ServiceType.UPDATE,
FeatureServiceEntity.ServiceType.FILE)) { FeatureServiceEntity.ServiceType.FILE,
FeatureServiceEntity.ServiceType.LICENSE)) {
services.stream() services.stream()
.filter(service -> service.getServiceType() == serviceType) .filter(service -> service.getServiceType() == serviceType)
.findFirst() .findFirst()
@ -62,7 +63,7 @@ public class FeatureServiceManager {
/** /**
* Submit an activation request. Disabling is immediate; enabling requires ops approval. * Submit an activation request. Disabling is immediate; enabling requires ops approval.
* IM / PUSH / UPDATE are app-wide, so duplicate checks ignore platform. * IM / PUSH / UPDATE / FILE / LICENSE are app-wide, so duplicate checks ignore platform.
*/ */
@Transactional @Transactional
public ServiceActivationRequestEntity submitActivationRequest( public ServiceActivationRequestEntity submitActivationRequest(
@ -559,7 +560,8 @@ public class FeatureServiceManager {
return serviceType == FeatureServiceEntity.ServiceType.IM return serviceType == FeatureServiceEntity.ServiceType.IM
|| serviceType == FeatureServiceEntity.ServiceType.PUSH || serviceType == FeatureServiceEntity.ServiceType.PUSH
|| serviceType == FeatureServiceEntity.ServiceType.UPDATE || serviceType == FeatureServiceEntity.ServiceType.UPDATE
|| serviceType == FeatureServiceEntity.ServiceType.FILE; || serviceType == FeatureServiceEntity.ServiceType.FILE
|| serviceType == FeatureServiceEntity.ServiceType.LICENSE;
} }
private JsonNode readConfigNode(String appKey, private JsonNode readConfigNode(String appKey,