From bcafeaa898257b3a43b01d75d502edc524b6b4cb Mon Sep 17 00:00:00 2001 From: guzeng Date: Tue, 24 Aug 2021 17:08:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8F=96siteinfo=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client.siteinfo.go | 11 ++++++++++- client.siteinfo_test.go | 4 +++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/client.siteinfo.go b/client.siteinfo.go index 987ce43..4a22ef9 100644 --- a/client.siteinfo.go +++ b/client.siteinfo.go @@ -6,6 +6,7 @@ import ( "strconv" "time" + "git.tetele.net/tgo/conf" "git.tetele.net/tgo/crypter" "github.com/golang/protobuf/proto" @@ -30,6 +31,15 @@ type SiteInfoRes struct { */ func GetSiteInfoByHost(host string, params ...string) (*SiteInfoRes, error) { + var res_arr SiteInfoRes + + if conf.IS_PRIVATE { + res_arr.Dbname = conf.DBNAME + res_arr.SiteId = conf.SITE_ID + res_arr.Domainname = conf.DOMAIN + return &res_arr, nil + } + var url string = "" var master string = "" if len(params) > 1 { @@ -75,7 +85,6 @@ func GetSiteInfoByHost(host string, params ...string) (*SiteInfoRes, error) { if err != nil { return nil, err } - var res_arr SiteInfoRes err = json.Unmarshal([]byte(res_data), &res_arr) diff --git a/client.siteinfo_test.go b/client.siteinfo_test.go index 0c850c8..66ccbf4 100644 --- a/client.siteinfo_test.go +++ b/client.siteinfo_test.go @@ -2,10 +2,12 @@ package siterpc import ( "testing" + + "git.tetele.net/tgo/conf" ) func Test_GetSiteInfoByHost(t *testing.T) { - + conf.IS_PRIVATE = true res, err := GetSiteInfoByHost("dev.tetele.net") t.Log(res) t.Log(err)