From 6ae8f416616aae24e7f3a539ddfb5a4eacf94014 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Thu, 1 Sep 2022 21:59:57 +0800 Subject: [PATCH] =?UTF-8?q?add=20=E5=8C=BA=E5=9D=97=E6=98=9F=E9=93=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/db_block_star_chain.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/db/db_block_star_chain.go b/db/db_block_star_chain.go index a424a13..cdc5b0c 100644 --- a/db/db_block_star_chain.go +++ b/db/db_block_star_chain.go @@ -78,9 +78,13 @@ func BlockStarChainUpdate(session *xorm.Session, id interface{}, BlockStarChain func BlockStarChainGetOneByParams(session *xorm.Session, params map[string]interface{}) (*model.BlockStarChain, error) { var m model.BlockStarChain var query = fmt.Sprintf("%s =?", params["key"]) - if has, err := session.Where(query, params["value"]).Get(&m); err != nil || has == false { + has, err := session.Where(query, params["value"]).Get(&m) + if err != nil { return nil, zhios_order_relate_logx.Error(err) } + if has == false { + return nil, errors.New("未查询到相应的 block_star_chain 记录") + } return &m, nil }