feat: 注册 BugCollect 为服务类型

- ServiceType 枚举添加 BUG_COLLECT
- FeatureServiceManager: BUG_COLLECT 作为 app-wide 服务
- SdkConfigController: 返回 bugCollectApiUrl 和 bugCollectEnabled
- FeatureServiceController: updateConfig 支持 BUG_COLLECT

Co-Authored-By: Claude <noreply@anthropic.com>
这个提交包含在:
XuqmGroup 2026-06-16 18:54:14 +08:00
父节点 5b020525ac
当前提交 4629c45941
共有 4 个文件被更改,包括 25 次插入7 次删除

查看文件

@ -114,6 +114,7 @@ public class FeatureServiceController {
req == null ? null : req.pushConfig()); req == null ? null : req.pushConfig());
case FILE -> featureServiceManager.buildFileConfig(appKey, platform); case FILE -> featureServiceManager.buildFileConfig(appKey, platform);
case LICENSE -> "{\"maxDevices\":1}"; case LICENSE -> "{\"maxDevices\":1}";
case BUG_COLLECT -> "{}";
}; };
FeatureServiceEntity saved = featureServiceManager.updateConfig( FeatureServiceEntity saved = featureServiceManager.updateConfig(
appKey, platform, serviceType, config); appKey, platform, serviceType, config);

查看文件

@ -37,6 +37,9 @@ public class SdkConfigController {
@Value("${sdk.im-api-url:https://im.dev.xuqinmin.com}") @Value("${sdk.im-api-url:https://im.dev.xuqinmin.com}")
private String imApiUrl; private String imApiUrl;
@Value("${sdk.bugcollect-api-url:https://bugcollect.dev.xuqinmin.com}")
private String bugCollectApiUrl;
public SdkConfigController(FeatureServiceRepository featureServiceRepository, public SdkConfigController(FeatureServiceRepository featureServiceRepository,
SdkAppProvisioningService sdkAppProvisioningService, SdkAppProvisioningService sdkAppProvisioningService,
ObjectMapper objectMapper, ObjectMapper objectMapper,
@ -82,15 +85,23 @@ public class SdkConfigController {
.findByAppKeyAndPlatformAndServiceType(app.getAppKey(), platform, FeatureServiceEntity.ServiceType.UPDATE) .findByAppKeyAndPlatformAndServiceType(app.getAppKey(), platform, FeatureServiceEntity.ServiceType.UPDATE)
.map(FeatureServiceEntity::isEnabled) .map(FeatureServiceEntity::isEnabled)
.orElse(false); .orElse(false);
boolean bugCollectEnabled = featureServiceRepository
.findByAppKeyAndServiceType(app.getAppKey(), FeatureServiceEntity.ServiceType.BUG_COLLECT)
.stream()
.findFirst()
.map(FeatureServiceEntity::isEnabled)
.orElse(false);
SdkConfigResponse response = new SdkConfigResponse( SdkConfigResponse response = new SdkConfigResponse(
imWsUrl, imWsUrl,
fileServiceUrl, fileServiceUrl,
imApiUrl, imApiUrl,
bugCollectApiUrl,
Map.of( Map.of(
"im", imEnabled, "im", imEnabled,
"push", pushEnabled, "push", pushEnabled,
"update", updateEnabled "update", updateEnabled,
"bugCollect", bugCollectEnabled
), ),
updateEnabled, updateEnabled,
updateConfig.path("defaultPublishMode").asText("MANUAL"), updateConfig.path("defaultPublishMode").asText("MANUAL"),
@ -115,6 +126,7 @@ public class SdkConfigController {
String imWsUrl, String imWsUrl,
String fileServiceUrl, String fileServiceUrl,
String imApiUrl, String imApiUrl,
String bugCollectApiUrl,
Map<String, Boolean> features, Map<String, Boolean> features,
boolean updateEnabled, boolean updateEnabled,
String updateDefaultPublishMode, String updateDefaultPublishMode,

查看文件

@ -20,7 +20,7 @@ public class FeatureServiceEntity {
private static final SecureRandom RANDOM = new SecureRandom(); private static final SecureRandom RANDOM = new SecureRandom();
public enum Platform { ANDROID, IOS, HARMONY } 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 @Id
private String id; private String id;

查看文件

@ -65,7 +65,8 @@ public class FeatureServiceManager {
FeatureServiceEntity.ServiceType.PUSH, FeatureServiceEntity.ServiceType.PUSH,
FeatureServiceEntity.ServiceType.UPDATE, FeatureServiceEntity.ServiceType.UPDATE,
FeatureServiceEntity.ServiceType.FILE, FeatureServiceEntity.ServiceType.FILE,
FeatureServiceEntity.ServiceType.LICENSE)) { FeatureServiceEntity.ServiceType.LICENSE,
FeatureServiceEntity.ServiceType.BUG_COLLECT)) {
services.stream() services.stream()
.filter(service -> service.getServiceType() == serviceType) .filter(service -> service.getServiceType() == serviceType)
.findFirst() .findFirst()
@ -241,7 +242,8 @@ public class FeatureServiceManager {
public FeatureServiceEntity getOrFail(String appKey, FeatureServiceEntity.Platform platform, public FeatureServiceEntity getOrFail(String appKey, FeatureServiceEntity.Platform platform,
FeatureServiceEntity.ServiceType serviceType) { FeatureServiceEntity.ServiceType serviceType) {
if (serviceType == FeatureServiceEntity.ServiceType.IM if (serviceType == FeatureServiceEntity.ServiceType.IM
|| serviceType == FeatureServiceEntity.ServiceType.LICENSE) { || serviceType == FeatureServiceEntity.ServiceType.LICENSE
|| serviceType == FeatureServiceEntity.ServiceType.BUG_COLLECT) {
return repository.findByAppKeyAndServiceType(appKey, serviceType) return repository.findByAppKeyAndServiceType(appKey, serviceType)
.stream() .stream()
.findFirst() .findFirst()
@ -257,7 +259,8 @@ public class FeatureServiceManager {
FeatureServiceEntity.ServiceType serviceType, FeatureServiceEntity.ServiceType serviceType,
String config) { String config) {
if (serviceType == FeatureServiceEntity.ServiceType.IM if (serviceType == FeatureServiceEntity.ServiceType.IM
|| serviceType == FeatureServiceEntity.ServiceType.LICENSE) { || serviceType == FeatureServiceEntity.ServiceType.LICENSE
|| serviceType == FeatureServiceEntity.ServiceType.BUG_COLLECT) {
List<FeatureServiceEntity> services = repository.findByAppKeyAndServiceType(appKey, serviceType); List<FeatureServiceEntity> services = repository.findByAppKeyAndServiceType(appKey, serviceType);
if (services.isEmpty()) { if (services.isEmpty()) {
throw new BusinessException(404, "服务未配置"); throw new BusinessException(404, "服务未配置");
@ -606,7 +609,8 @@ public class FeatureServiceManager {
|| 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; || serviceType == FeatureServiceEntity.ServiceType.LICENSE
|| serviceType == FeatureServiceEntity.ServiceType.BUG_COLLECT;
} }
private JsonNode readConfigNode(String appKey, private JsonNode readConfigNode(String appKey,
@ -614,7 +618,8 @@ public class FeatureServiceManager {
FeatureServiceEntity.ServiceType serviceType) { FeatureServiceEntity.ServiceType serviceType) {
FeatureServiceEntity entity; FeatureServiceEntity entity;
if (serviceType == FeatureServiceEntity.ServiceType.IM if (serviceType == FeatureServiceEntity.ServiceType.IM
|| serviceType == FeatureServiceEntity.ServiceType.LICENSE) { || serviceType == FeatureServiceEntity.ServiceType.LICENSE
|| serviceType == FeatureServiceEntity.ServiceType.BUG_COLLECT) {
entity = repository.findByAppKeyAndServiceType(appKey, serviceType) entity = repository.findByAppKeyAndServiceType(appKey, serviceType)
.stream() .stream()
.findFirst() .findFirst()