feat: 注册 BugCollect 为服务类型
- ServiceType 枚举添加 BUG_COLLECT - FeatureServiceManager: BUG_COLLECT 作为 app-wide 服务 - SdkConfigController: 返回 bugCollectApiUrl 和 bugCollectEnabled - FeatureServiceController: updateConfig 支持 BUG_COLLECT Co-Authored-By: Claude <noreply@anthropic.com>
这个提交包含在:
父节点
5b020525ac
当前提交
4629c45941
@ -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);
|
||||
|
||||
@ -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<String, Boolean> features,
|
||||
boolean updateEnabled,
|
||||
String updateDefaultPublishMode,
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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<FeatureServiceEntity> 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()
|
||||
|
||||
正在加载...
在新工单中引用
屏蔽一个用户