From 5c6f604d7d144178a513c1d7e5ba60dfe4716a93 Mon Sep 17 00:00:00 2001 From: suyl <770236076@qq.com> Date: Tue, 11 May 2021 15:42:06 +0800 Subject: [PATCH] aa --- platformapi/autonavi/autonavi_page.go | 58 ++++++++++++++++++++++ platformapi/autonavi/autonavi_page_test.go | 8 +++ platformapi/tbunionapi/sku_test.go | 10 ++-- 3 files changed, 71 insertions(+), 5 deletions(-) diff --git a/platformapi/autonavi/autonavi_page.go b/platformapi/autonavi/autonavi_page.go index b9688dbd..135fc545 100644 --- a/platformapi/autonavi/autonavi_page.go +++ b/platformapi/autonavi/autonavi_page.go @@ -67,3 +67,61 @@ func (a *API) GetCoordinateFromAddressByPage(address string, cityCode int) (lng, } return lng, lat, err } + +type GetCoordinateFromAddressByPageAllResult struct { + Suggestion struct { + Keywords []interface{} `json:"keywords"` + Cities []interface{} `json:"cities"` + } `json:"suggestion"` + Count string `json:"count"` + Infocode string `json:"infocode"` + Pois []struct { + Parent []interface{} `json:"parent"` + Address string `json:"address"` + Distance []interface{} `json:"distance"` + Pname string `json:"pname"` + Importance []interface{} `json:"importance"` + BizExt struct { + Cost []interface{} `json:"cost"` + Rating []interface{} `json:"rating"` + } `json:"biz_ext"` + BizType []interface{} `json:"biz_type"` + Cityname string `json:"cityname"` + Type string `json:"type"` + Photos []interface{} `json:"photos"` + Typecode string `json:"typecode"` + Shopinfo string `json:"shopinfo"` + Poiweight []interface{} `json:"poiweight"` + Childtype []interface{} `json:"childtype"` + Adname string `json:"adname"` + Name string `json:"name"` + Location string `json:"location"` + Tel string `json:"tel"` + Shopid []interface{} `json:"shopid"` + ID string `json:"id"` + } `json:"pois"` + Status string `json:"status"` + Info string `json:"info"` +} + +func (a *API) GetCoordinateFromAddressByPageAll(address string, cityCode int) (getCoordinateFromAddressByPageAllResult *GetCoordinateFromAddressByPageAllResult, err error) { + result, err := a.AccessStorePage("https://restapi.amap.com/v3/place/text", map[string]interface{}{ + "s": "rsv3", + "key": "e07ffdf58c8e8672037bef0d6cae7d4a", + "page": 1, + "offset": 10, + "city": cityCode, + "language": "zh_cn", + "platform": "JS", + "logversion": 2.0, + "sdkversion": 1.3, + "appname": "https://lbs.amap.com/console/show/picker", + "csid": "7A90908C-BBA6-49FE-895E-DB70600E14F8", + "keywords": address, + "children": "", + }) + if err == nil { + utils.Map2StructByJson(result, &getCoordinateFromAddressByPageAllResult, false) + } + return getCoordinateFromAddressByPageAllResult, err +} diff --git a/platformapi/autonavi/autonavi_page_test.go b/platformapi/autonavi/autonavi_page_test.go index 1ae9ad1f..80a01f29 100644 --- a/platformapi/autonavi/autonavi_page_test.go +++ b/platformapi/autonavi/autonavi_page_test.go @@ -14,3 +14,11 @@ func TestGetCoordinateFromAddressByPage(t *testing.T) { t.Log(utils.Format4Output(lng, false)) t.Log(utils.Format4Output(lat, false)) } + +func TestGetCoordinateFromAddressByPageAll(t *testing.T) { + result, err := autonaviAPI.GetCoordinateFromAddressByPageAll("兴月宏干杂", 510100) + if err != nil { + t.Fatal(err) + } + t.Log(utils.Format4Output(result, false)) +} diff --git a/platformapi/tbunionapi/sku_test.go b/platformapi/tbunionapi/sku_test.go index 4ddb3d7d..a68ba2f5 100644 --- a/platformapi/tbunionapi/sku_test.go +++ b/platformapi/tbunionapi/sku_test.go @@ -6,11 +6,11 @@ import ( ) func TestOptimusMaterial(t *testing.T) { - result, err := api.OptimusMaterial(28026, 111339100149, 1, 20) - if err != nil { - t.Fatal(err) - } - t.Log(utils.Format4Output(result, false)) + //result, err := api.OptimusMaterial(28026, 111339100149, 1, 20) + //if err != nil { + // t.Fatal(err) + //} + //t.Log(utils.Format4Output(result, false)) } func TestMaterialOptional(t *testing.T) {