From d6ef7900104d90a5a7a3eae29925d7ed82fa89ca Mon Sep 17 00:00:00 2001 From: hoteas Date: Sun, 13 Mar 2022 02:00:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=95=B4=E4=BD=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dri/baidu/map.go | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/dri/baidu/map.go b/dri/baidu/map.go index 3dd611d..c5c372a 100644 --- a/dri/baidu/map.go +++ b/dri/baidu/map.go @@ -7,12 +7,14 @@ import ( "net/url" ) -type BaiduMap struct { +type baiduMap struct { Ak string Url string } -func (that *BaiduMap) Init(Ak string) { +var BaiDuMap = baiduMap{} + +func (that *baiduMap) Init(Ak string) { //"ak=ZeT902EZvVgIoGVWEFK3osUm" that.Ak = Ak that.Url = "https://api.map.baidu.com/place/v2/suggestion?output=json" + "&ak=" + Ak @@ -20,7 +22,7 @@ func (that *BaiduMap) Init(Ak string) { } // GetPosition 获取定位列表 -func (that *BaiduMap) GetPosition(name string, region string) (string, error) { +func (that *baiduMap) GetPosition(name string, region string) (string, error) { client := &http.Client{} if region == "" { @@ -50,9 +52,3 @@ func (that *BaiduMap) GetPosition(name string, region string) (string, error) { return string(body), err } - -var DefaultBaiDuMap BaiduMap - -func init() { - DefaultBaiDuMap = BaiduMap{} -}