diff --git a/tenant-service/src/main/java/com/xuqm/tenant/controller/FeatureServiceController.java b/tenant-service/src/main/java/com/xuqm/tenant/controller/FeatureServiceController.java index 2842266..9bb4c49 100644 --- a/tenant-service/src/main/java/com/xuqm/tenant/controller/FeatureServiceController.java +++ b/tenant-service/src/main/java/com/xuqm/tenant/controller/FeatureServiceController.java @@ -114,6 +114,7 @@ public class FeatureServiceController { req == null ? null : req.pushConfig()); case FILE -> featureServiceManager.buildFileConfig(appKey, platform); case LICENSE -> "{\"maxDevices\":1}"; + case BUG_COLLECT -> "{}"; }; FeatureServiceEntity saved = featureServiceManager.updateConfig( appKey, platform, serviceType, config); diff --git a/tenant-service/src/main/java/com/xuqm/tenant/controller/SdkConfigController.java b/tenant-service/src/main/java/com/xuqm/tenant/controller/SdkConfigController.java index fb4f75f..a7408af 100644 --- a/tenant-service/src/main/java/com/xuqm/tenant/controller/SdkConfigController.java +++ b/tenant-service/src/main/java/com/xuqm/tenant/controller/SdkConfigController.java @@ -37,6 +37,9 @@ public class SdkConfigController { @Value("${sdk.im-api-url:https://im.dev.xuqinmin.com}") private String imApiUrl; + @Value("${sdk.bugcollect-api-url:https://bugcollect.dev.xuqinmin.com}") + private String bugCollectApiUrl; + public SdkConfigController(FeatureServiceRepository featureServiceRepository, SdkAppProvisioningService sdkAppProvisioningService, ObjectMapper objectMapper, @@ -82,15 +85,23 @@ public class SdkConfigController { .findByAppKeyAndPlatformAndServiceType(app.getAppKey(), platform, FeatureServiceEntity.ServiceType.UPDATE) .map(FeatureServiceEntity::isEnabled) .orElse(false); + boolean bugCollectEnabled = featureServiceRepository + .findByAppKeyAndServiceType(app.getAppKey(), FeatureServiceEntity.ServiceType.BUG_COLLECT) + .stream() + .findFirst() + .map(FeatureServiceEntity::isEnabled) + .orElse(false); SdkConfigResponse response = new SdkConfigResponse( imWsUrl, fileServiceUrl, imApiUrl, + bugCollectApiUrl, Map.of( "im", imEnabled, "push", pushEnabled, - "update", updateEnabled + "update", updateEnabled, + "bugCollect", bugCollectEnabled ), updateEnabled, updateConfig.path("defaultPublishMode").asText("MANUAL"), @@ -115,6 +126,7 @@ public class SdkConfigController { String imWsUrl, String fileServiceUrl, String imApiUrl, + String bugCollectApiUrl, Map features, boolean updateEnabled, String updateDefaultPublishMode, diff --git a/tenant-service/src/main/java/com/xuqm/tenant/entity/FeatureServiceEntity.java b/tenant-service/src/main/java/com/xuqm/tenant/entity/FeatureServiceEntity.java index 65c1318..bd1c880 100644 --- a/tenant-service/src/main/java/com/xuqm/tenant/entity/FeatureServiceEntity.java +++ b/tenant-service/src/main/java/com/xuqm/tenant/entity/FeatureServiceEntity.java @@ -20,7 +20,7 @@ public class FeatureServiceEntity { private static final SecureRandom RANDOM = new SecureRandom(); public enum Platform { ANDROID, IOS, HARMONY } - public enum ServiceType { IM, PUSH, UPDATE, FILE, LICENSE } + public enum ServiceType { IM, PUSH, UPDATE, FILE, LICENSE, BUG_COLLECT } @Id private String id; diff --git a/tenant-service/src/main/java/com/xuqm/tenant/service/FeatureServiceManager.java b/tenant-service/src/main/java/com/xuqm/tenant/service/FeatureServiceManager.java index b4204f6..901056d 100644 --- a/tenant-service/src/main/java/com/xuqm/tenant/service/FeatureServiceManager.java +++ b/tenant-service/src/main/java/com/xuqm/tenant/service/FeatureServiceManager.java @@ -65,7 +65,8 @@ public class FeatureServiceManager { FeatureServiceEntity.ServiceType.PUSH, FeatureServiceEntity.ServiceType.UPDATE, FeatureServiceEntity.ServiceType.FILE, - FeatureServiceEntity.ServiceType.LICENSE)) { + FeatureServiceEntity.ServiceType.LICENSE, + FeatureServiceEntity.ServiceType.BUG_COLLECT)) { services.stream() .filter(service -> service.getServiceType() == serviceType) .findFirst() @@ -241,7 +242,8 @@ public class FeatureServiceManager { public FeatureServiceEntity getOrFail(String appKey, FeatureServiceEntity.Platform platform, FeatureServiceEntity.ServiceType serviceType) { if (serviceType == FeatureServiceEntity.ServiceType.IM - || serviceType == FeatureServiceEntity.ServiceType.LICENSE) { + || serviceType == FeatureServiceEntity.ServiceType.LICENSE + || serviceType == FeatureServiceEntity.ServiceType.BUG_COLLECT) { return repository.findByAppKeyAndServiceType(appKey, serviceType) .stream() .findFirst() @@ -257,7 +259,8 @@ public class FeatureServiceManager { FeatureServiceEntity.ServiceType serviceType, String config) { if (serviceType == FeatureServiceEntity.ServiceType.IM - || serviceType == FeatureServiceEntity.ServiceType.LICENSE) { + || serviceType == FeatureServiceEntity.ServiceType.LICENSE + || serviceType == FeatureServiceEntity.ServiceType.BUG_COLLECT) { List services = repository.findByAppKeyAndServiceType(appKey, serviceType); if (services.isEmpty()) { throw new BusinessException(404, "服务未配置"); @@ -606,7 +609,8 @@ public class FeatureServiceManager { || serviceType == FeatureServiceEntity.ServiceType.PUSH || serviceType == FeatureServiceEntity.ServiceType.UPDATE || serviceType == FeatureServiceEntity.ServiceType.FILE - || serviceType == FeatureServiceEntity.ServiceType.LICENSE; + || serviceType == FeatureServiceEntity.ServiceType.LICENSE + || serviceType == FeatureServiceEntity.ServiceType.BUG_COLLECT; } private JsonNode readConfigNode(String appKey, @@ -614,7 +618,8 @@ public class FeatureServiceManager { FeatureServiceEntity.ServiceType serviceType) { FeatureServiceEntity entity; if (serviceType == FeatureServiceEntity.ServiceType.IM - || serviceType == FeatureServiceEntity.ServiceType.LICENSE) { + || serviceType == FeatureServiceEntity.ServiceType.LICENSE + || serviceType == FeatureServiceEntity.ServiceType.BUG_COLLECT) { entity = repository.findByAppKeyAndServiceType(appKey, serviceType) .stream() .findFirst()