From 100ff999fb3561355bb5d25cb9aac76249cba638 Mon Sep 17 00:00:00 2001 From: CaptainB Date: Tue, 12 Mar 2024 09:34:50 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E4=BD=BF=E7=94=A8TextNode=E6=9B=BF?= =?UTF-8?q?=E6=8D=A2String?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../metersphere/system/controller/LicenseController.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/controller/LicenseController.java b/backend/services/system-setting/src/main/java/io/metersphere/system/controller/LicenseController.java index 5ac63291c0..4658498ff8 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/controller/LicenseController.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/controller/LicenseController.java @@ -1,5 +1,6 @@ package io.metersphere.system.controller; +import com.fasterxml.jackson.databind.node.TextNode; import io.metersphere.sdk.constants.PermissionConstants; import io.metersphere.system.dto.sdk.LicenseDTO; import io.metersphere.system.service.LicenseService; @@ -29,12 +30,10 @@ public class LicenseController { @PostMapping("/add") @Operation(summary = "添加有效的License") @RequiresPermissions(value= {PermissionConstants.SYSTEM_AUTH_READ, PermissionConstants.SYSTEM_AUTH_READ_UPDATE}, logical = Logical.OR) - public LicenseDTO addLicense(@RequestBody String licenseCode) { + public LicenseDTO addLicense(@RequestBody TextNode licenseCode) { LicenseService licenseService = CommonBeanFactory.getBean(LicenseService.class); - // 前端传入的JSON会被加上双引号,需要去掉 - licenseCode = StringUtils.strip(licenseCode, "\""); if (licenseService != null) { - return licenseService.addLicense(licenseCode, SessionUtils.getUserId()); + return licenseService.addLicense(licenseCode.asText(), SessionUtils.getUserId()); } return new LicenseDTO(); }