fix:资源详情调整

This commit is contained in:
momo 2023-09-05 14:41:36 +08:00
parent afe85433fd
commit 0d894a4269

View File

@ -1,6 +1,7 @@
package logic package logic
import ( import (
"encoding/json"
"fusenapi/model/gmodel" "fusenapi/model/gmodel"
"fusenapi/utils/auth" "fusenapi/utils/auth"
"fusenapi/utils/basic" "fusenapi/utils/basic"
@ -50,15 +51,15 @@ func (l *ResourceInfoLogic) ResourceInfo(req *types.ResourceInfoReq, userinfo *a
resourceInfo, err := resourceModel.FindOneById(l.ctx, resourceId) resourceInfo, err := resourceModel.FindOneById(l.ctx, resourceId)
var resourceUrl string var resourceUrl string
var metadata string var resourceMetadata map[string]interface{}
if err == nil && resourceInfo.ResourceId != "" { if err == nil && resourceInfo.ResourceId != "" {
resourceId = resourceInfo.ResourceId resourceId = resourceInfo.ResourceId
resourceUrl = *resourceInfo.ResourceUrl resourceUrl = *resourceInfo.ResourceUrl
metadata = *resourceInfo.Metadata json.Unmarshal([]byte(*resourceInfo.Metadata), &resourceMetadata)
} }
return resp.SetStatus(basic.CodeOK, map[string]interface{}{ return resp.SetStatus(basic.CodeOK, map[string]interface{}{
"resource_id": resourceId, "resource_id": resourceId,
"resource_url": resourceUrl, "resource_url": resourceUrl,
"resource_metadata": metadata, "resource_metadata": resourceMetadata,
}) })
} }