From bd2fc545c751cd2dbcd7c5d07c1e39f9c84e53c5 Mon Sep 17 00:00:00 2001 From: momo <1012651275@qq.com> Date: Tue, 5 Sep 2023 14:26:31 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E8=B5=84=E6=BA=90=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/resource/internal/logic/resourceinfologic.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/server/resource/internal/logic/resourceinfologic.go b/server/resource/internal/logic/resourceinfologic.go index 599bede4..395bce18 100644 --- a/server/resource/internal/logic/resourceinfologic.go +++ b/server/resource/internal/logic/resourceinfologic.go @@ -1,6 +1,7 @@ package logic import ( + "encoding/json" "fusenapi/model/gmodel" "fusenapi/utils/auth" "fusenapi/utils/basic" @@ -50,15 +51,15 @@ func (l *ResourceInfoLogic) ResourceInfo(req *types.ResourceInfoReq, userinfo *a resourceInfo, err := resourceModel.FindOneById(l.ctx, resourceId) var resourceUrl string - var metadata string + var resourceMetadata map[string]interface{} if err == nil && resourceInfo.ResourceId != "" { resourceId = resourceInfo.ResourceId resourceUrl = *resourceInfo.ResourceUrl - metadata = *resourceInfo.Metadata + json.Unmarshal([]byte(*resourceInfo.Metadata), &resourceMetadata) } return resp.SetStatus(basic.CodeOK, map[string]interface{}{ "resource_id": resourceId, "resource_url": resourceUrl, - "resource_metadata": metadata, + "resource_metadata": resourceMetadata, }) }