This commit is contained in:
苏尹岚
2021-02-24 09:43:43 +08:00
parent e106a982a1
commit 39c1c304ee
4 changed files with 51 additions and 47 deletions

View File

@@ -15,6 +15,8 @@ func (a *API) AccessStorePage(fullURL string, bizParams map[string]interface{})
func() *http.Request {
var request *http.Request
request, _ = http.NewRequest(http.MethodGet, utils.GenerateGetURL(fullURL, "", bizParams), nil)
request.Header.Set("Referer", "https://lbs.amap.com/")
// a.FillRequestCookies(request)
return request
},
a.config,
@@ -41,7 +43,7 @@ func (a *API) AccessStorePage(fullURL string, bizParams map[string]interface{})
func (a *API) GetCoordinateFromAddressByPage(address string, cityCode int) (lng, lat float64, err error) {
result, err := a.AccessStorePage("https://restapi.amap.com/v3/place/text", map[string]interface{}{
"s": "rsv3",
"key": "8325164e247e15eea68b59e89200988b",
"key": "e07ffdf58c8e8672037bef0d6cae7d4a",
"page": 1,
"offset": 10,
"city": cityCode,
@@ -50,8 +52,9 @@ func (a *API) GetCoordinateFromAddressByPage(address string, cityCode int) (lng,
"logversion": 2.0,
"sdkversion": 1.3,
"appname": "https://lbs.amap.com/console/show/picker",
"csid": "170EFB02-7F7C-4F47-A1D5-47E98DC17ABB",
"csid": "7A90908C-BBA6-49FE-895E-DB70600E14F8",
"keywords": address,
"children": "",
})
if err == nil {
if len(result["pois"].([]interface{})) > 0 {