fix:资源详情调整

This commit is contained in:
momo 2023-09-05 14:32:33 +08:00
parent bd2fc545c7
commit afe85433fd

View File

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