From 03e8006e1ca0eafcc95a3042b6f172fa6c31ccb3 Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Tue, 31 Oct 2023 18:50:27 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):?= =?UTF-8?q?=20=E4=BC=98=E5=8C=96=E6=8E=A5=E5=8F=A3=E8=B0=83=E8=AF=95?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../framework/sdk/src/main/resources/i18n/api.properties | 5 +++++ .../sdk/src/main/resources/i18n/api_en_US.properties | 3 ++- .../sdk/src/main/resources/i18n/api_zh_CN.properties | 3 ++- .../sdk/src/main/resources/i18n/api_zh_TW.properties | 3 ++- .../api/service/debug/ApiDebugModuleService.java | 7 ++++--- 5 files changed, 15 insertions(+), 6 deletions(-) diff --git a/backend/framework/sdk/src/main/resources/i18n/api.properties b/backend/framework/sdk/src/main/resources/i18n/api.properties index 5047ca49ad..2109e962ca 100644 --- a/backend/framework/sdk/src/main/resources/i18n/api.properties +++ b/backend/framework/sdk/src/main/resources/i18n/api.properties @@ -274,3 +274,8 @@ api_debug_module.project_id.length_range=项目ID长度必须在1-50之间 api_debug_module.pos.not_blank=模块位置不能为空 api_debug_module.name.not_contain_slash=模块名称不能包含斜杠 +#module: ApiEnvironmentConfig +api_environment_config.id.not_blank=ID不能为空 +api_environment_config.environment_id.length_range=环境ID长度必须在1-50之间 +api_environment_config.environment_id.not_blank=环境ID不能为空 +api_module.not.exist=模块不存在 diff --git a/backend/framework/sdk/src/main/resources/i18n/api_en_US.properties b/backend/framework/sdk/src/main/resources/i18n/api_en_US.properties index 9dde4e28e8..a00785f297 100644 --- a/backend/framework/sdk/src/main/resources/i18n/api_en_US.properties +++ b/backend/framework/sdk/src/main/resources/i18n/api_en_US.properties @@ -279,4 +279,5 @@ api_debug_module.unplanned_request=Unplanned request #module: ApiEnvironmentConfig api_environment_config.id.not_blank=ID不能为空 api_environment_config.environment_id.length_range=环境ID长度必须在1-50之间 -api_environment_config.environment_id.not_blank=环境ID不能为空 \ No newline at end of file +api_environment_config.environment_id.not_blank=环境ID不能为空 +api_module.not.exist=模块不存在 \ No newline at end of file diff --git a/backend/framework/sdk/src/main/resources/i18n/api_zh_CN.properties b/backend/framework/sdk/src/main/resources/i18n/api_zh_CN.properties index b704c82baa..191a6f6a81 100644 --- a/backend/framework/sdk/src/main/resources/i18n/api_zh_CN.properties +++ b/backend/framework/sdk/src/main/resources/i18n/api_zh_CN.properties @@ -279,4 +279,5 @@ api_debug_module.unplanned_request=未规划请求 #module: ApiEnvironmentConfig api_environment_config.id.not_blank=ID不能为空 api_environment_config.environment_id.length_range=环境ID长度必须在1-50之间 -api_environment_config.environment_id.not_blank=环境ID不能为空 \ No newline at end of file +api_environment_config.environment_id.not_blank=环境ID不能为空 +api_module.not.exist=模块不存在 \ No newline at end of file diff --git a/backend/framework/sdk/src/main/resources/i18n/api_zh_TW.properties b/backend/framework/sdk/src/main/resources/i18n/api_zh_TW.properties index 212d86bb71..c31af51ca3 100644 --- a/backend/framework/sdk/src/main/resources/i18n/api_zh_TW.properties +++ b/backend/framework/sdk/src/main/resources/i18n/api_zh_TW.properties @@ -279,4 +279,5 @@ api_debug_module.unplanned_request=未規劃請求 #module: ApiEnvironmentConfig api_environment_config.id.not_blank=ID不能為空 api_environment_config.environment_id.length_range=環境ID長度必須在1-50之間 -api_environment_config.environment_id.not_blank=環境ID不能為空 \ No newline at end of file +api_environment_config.environment_id.not_blank=環境ID不能為空 +api_module.not.exist=模塊不存在 \ No newline at end of file diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/service/debug/ApiDebugModuleService.java b/backend/services/api-test/src/main/java/io/metersphere/api/service/debug/ApiDebugModuleService.java index b4ca615598..7abfa7a80c 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/service/debug/ApiDebugModuleService.java +++ b/backend/services/api-test/src/main/java/io/metersphere/api/service/debug/ApiDebugModuleService.java @@ -36,6 +36,7 @@ import java.util.stream.Collectors; @Transactional(rollbackFor = Exception.class) public class ApiDebugModuleService extends ModuleTreeService { private static final String UNPLANNED = "api_debug_module.unplanned_request"; + private static final String MODULE_NO_EXIST = "api_module.not.exist"; private static final String METHOD = "method"; private static final String DEBUG_MODULE_COUNT_ALL = "all"; @Resource @@ -151,7 +152,7 @@ public class ApiDebugModuleService extends ModuleTreeService { public void update(DebugModuleUpdateRequest request, String userId, String projectId) { ApiDebugModule module = apiDebugModuleMapper.selectByPrimaryKey(request.getId()); if (module == null) { - throw new MSException("file_module.not.exist"); + throw new MSException(Translator.get(MODULE_NO_EXIST)); } ApiDebugModule updateModule = new ApiDebugModule(); updateModule.setId(request.getId()); @@ -209,7 +210,7 @@ public class ApiDebugModuleService extends ModuleTreeService { ApiDebugModule dragNode = apiDebugModuleMapper.selectByPrimaryKey(request.getDragNodeId()); if (dragNode == null) { - throw new MSException("file_module.not.exist:" + request.getDragNodeId()); + throw new MSException(Translator.get(MODULE_NO_EXIST) + ": " + request.getDragNodeId()); } else { module = new BaseModule(dragNode.getId(), dragNode.getName(), dragNode.getPos(), dragNode.getProjectId(), dragNode.getParentId()); } @@ -221,7 +222,7 @@ public class ApiDebugModuleService extends ModuleTreeService { ApiDebugModule dropNode = apiDebugModuleMapper.selectByPrimaryKey(request.getDropNodeId()); if (dropNode == null) { - throw new MSException("file_module.not.exist:" + request.getDropNodeId()); + throw new MSException(Translator.get(MODULE_NO_EXIST) + ": " + request.getDropNodeId()); } if (request.getDropPosition() == 0) {