优化整体
This commit is contained in:
parent
5c64580378
commit
d6ef790010
@ -7,12 +7,14 @@ import (
|
|||||||
"net/url"
|
"net/url"
|
||||||
)
|
)
|
||||||
|
|
||||||
type BaiduMap struct {
|
type baiduMap struct {
|
||||||
Ak string
|
Ak string
|
||||||
Url string
|
Url string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (that *BaiduMap) Init(Ak string) {
|
var BaiDuMap = baiduMap{}
|
||||||
|
|
||||||
|
func (that *baiduMap) Init(Ak string) {
|
||||||
//"ak=ZeT902EZvVgIoGVWEFK3osUm"
|
//"ak=ZeT902EZvVgIoGVWEFK3osUm"
|
||||||
that.Ak = Ak
|
that.Ak = Ak
|
||||||
that.Url = "https://api.map.baidu.com/place/v2/suggestion?output=json" + "&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 获取定位列表
|
// GetPosition 获取定位列表
|
||||||
func (that *BaiduMap) GetPosition(name string, region string) (string, error) {
|
func (that *baiduMap) GetPosition(name string, region string) (string, error) {
|
||||||
|
|
||||||
client := &http.Client{}
|
client := &http.Client{}
|
||||||
if region == "" {
|
if region == "" {
|
||||||
@ -50,9 +52,3 @@ func (that *BaiduMap) GetPosition(name string, region string) (string, error) {
|
|||||||
return string(body), err
|
return string(body), err
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var DefaultBaiDuMap BaiduMap
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
DefaultBaiDuMap = BaiduMap{}
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user