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{} -}