更新研发

This commit is contained in:
hoteas
2022-01-26 11:45:17 +08:00
parent cea7e57409
commit 3b11f44915
40 changed files with 10212 additions and 23 deletions
+6 -4
View File
@@ -15,16 +15,18 @@ type BaiduMap struct {
func (this *BaiduMap) Init(Ak string) {
//"ak=ZeT902EZvVgIoGVWEFK3osUm"
this.Ak = Ak
this.Url = "https://api.map.baidu.com/place/v2/suggestion?output=json&region=" + url.PathEscape("全国") + "&ak=" + Ak
this.Url = "https://api.map.baidu.com/place/v2/suggestion?output=json" + "&ak=" + Ak
//query
}
// GetPosition 获取定位列表
func (this *BaiduMap) GetPosition(name string) (string, error) {
func (this *BaiduMap) GetPosition(name string, region string) (string, error) {
client := &http.Client{}
reqest, err := http.NewRequest("GET", this.Url+"&query="+url.PathEscape(name), nil)
if region == "" {
region = "全国"
}
reqest, err := http.NewRequest("GET", this.Url+"&query="+url.PathEscape(name)+"&region="+url.PathEscape(region), nil)
if err != nil {
fmt.Println("Fatal error ", err.Error())