优化节点信息

This commit is contained in:
陈景阳
2019-10-11 21:57:25 +08:00
parent 46d89c8cce
commit 973251a0fb
6 changed files with 38 additions and 25 deletions

View File

@@ -157,10 +157,12 @@ func GetNodeList(filter interface{}) ([]Node, error) {
}
func GetNode(id bson.ObjectId) (Node, error) {
var node Node
if id.Hex() == "" {
return node, nil
}
s, c := database.GetCol("nodes")
defer s.Close()
var node Node
if err := c.FindId(id).One(&node); err != nil {
if err != mgo.ErrNotFound {
log.Errorf(err.Error())