From 7f4dd8859eaafc1e41e6c24af98b6fb692700f7e Mon Sep 17 00:00:00 2001 From: Ulric Qin Date: Mon, 12 Oct 2020 18:04:59 +0800 Subject: [PATCH] code refactor --- src/modules/rdb/http/router_resource.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/modules/rdb/http/router_resource.go b/src/modules/rdb/http/router_resource.go index 83baedde..f497ef72 100644 --- a/src/modules/rdb/http/router_resource.go +++ b/src/modules/rdb/http/router_resource.go @@ -245,14 +245,20 @@ func resourceBindNode(c *gin.Context) { var err error if f.Field == "uuid" { ids, err = models.ResourceIdsByUUIDs(f.Items) + dangerous(err) + if len(ids) == 0 { + bomb("resources not found by uuid") + } } else if f.Field == "ident" { ids, err = models.ResourceIdsByIdents(f.Items) + dangerous(err) + if len(ids) == 0 { + bomb("resources not found by ident") + } } else { bomb("field[%s] not supported", f.Field) } - dangerous(err) - loginUser(c).CheckPermByNode(node, "rdb_resource_bind") renderMessage(c, node.Bind(ids))