aa
This commit is contained in:
@@ -112,6 +112,8 @@ type Coordinate struct {
|
||||
type ResponseResult map[string]interface{}
|
||||
|
||||
type API struct {
|
||||
platformapi.APICookie
|
||||
|
||||
client *http.Client
|
||||
config *platformapi.APIConfig
|
||||
key string
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -20,6 +20,7 @@ func init() {
|
||||
baseapi.Init(sugarLogger)
|
||||
|
||||
autonaviAPI = New("ef64f638f31e05cb7bde28790f7309fe")
|
||||
autonaviAPI.SetCookieWithStr(`cna=dyUYGJ5k1VICAbffYm17n9kQ; UM_distinctid=176036a06055e-0ee495abe2301e-5c173a1b-15f900-176036a060673; isg=BOrqQBinfq1rFcyHs0cHGEFiO1CMW261b382TXSjAz3bp4phXO9bxTLWM9O7V-ZN; l=eBLn3bArQD-PVZ6OBO5ZPurza77tgIRb4sPzaNbMiInca6GF9FPIpNCI6EvkWdtjgtC33etzuK-oqdLHR3xJ2xDDB5XXG7RE3xvO.; tfstk=cgmVBA_rmnK25ur6JoZNGm2q2UqAZinnX3yUoV3YnkeyezzcifCTEIYxUAPpqrf..`)
|
||||
}
|
||||
|
||||
func TestCoordinateConvert(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user