From f4e9c3f370dd06b994165131d98de3cc1c4643b7 Mon Sep 17 00:00:00 2001 From: guzeng Date: Sun, 18 Apr 2021 22:07:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=A4=9A=E4=B8=80=E4=B8=AA=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E7=B3=BB=E7=BB=9F=E9=85=8D=E7=BD=AE=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/client.go b/client.go index 79dbd3f..ded483c 100644 --- a/client.go +++ b/client.go @@ -23,6 +23,7 @@ type SiteConfigItemReqArg struct { type SiteConfigItemRes struct { Type string Value string + Exist bool } /** @@ -32,6 +33,20 @@ type SiteConfigItemRes struct { * GZ */ func GetConfigItem(site_id, dbname, key string, url ...string) (*SiteConfigItemRes, error) { + ret, err := getconfig(site_id, dbname, key, url...) + if err != nil { + return ret, err + } + if ret.Exist == false { + return ret, errors.New("no data") + } + return ret, err +} +func GetConfig(site_id, dbname, key string, url ...string) (*SiteConfigItemRes, error) { + return getconfig(site_id, dbname, key, url...) +} + +func getconfig(site_id, dbname, key string, url ...string) (*SiteConfigItemRes, error) { var site_rpc_url string = "127.0.0.1:7971" if len(url) > 0 && url[0] != "" {