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, }) }