From ffc8b41c50d9fd804bc2e95651520ae072a2d558 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=B0=8F=E9=A3=9E=E5=90=8C=E5=AD=A6?= <61930212+tengfei-xy@users.noreply.github.com> Date: Wed, 3 Apr 2024 23:23:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9exportResources=E8=BF=99?= =?UTF-8?q?=E4=B8=AAAPI=E7=9A=84=E5=8F=82=E6=95=B0=20(#10855)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 修改exportResources这个API,使得能够同时识别path和paths参数 * 修改exportResources这个API的说明文档 * 设定exportResources这个API的paths参数是必须的 * 重新修改exportResources的参数示例 * 设定exportResources这个API的返回值为1 --- kernel/api/export.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/kernel/api/export.go b/kernel/api/export.go index 9acb9f0f6..e0b46dbdc 100644 --- a/kernel/api/export.go +++ b/kernel/api/export.go @@ -283,11 +283,16 @@ func exportResources(c *gin.Context) { name = time.Now().Format("export-2006-01-02_15-04-05") // 生成的 *.zip 文件主文件名 } + if arg["paths"] == nil { + ret.Code = 1 + ret.Data = "" + ret.Msg = "paths is required" + return + } + var resourcePaths []string // 文件/文件夹在工作空间中的路径 - if nil != arg["paths"] { - for _, resourcePath := range arg["paths"].([]interface{}) { - resourcePaths = append(resourcePaths, resourcePath.(string)) - } + for _, resourcePath := range arg["paths"].([]interface{}) { + resourcePaths = append(resourcePaths, resourcePath.(string)) } zipFilePath, err := model.ExportResources(resourcePaths, name)