From c2425f98cf6d0f4b2d3b55d213d1811cf970e2a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 24 Sep 2020 18:26:29 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BE=8E=E5=9B=A2=E9=85=8D=E9=80=81=EF=BC=8C?= =?UTF-8?q?=E9=AB=98=E5=BE=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- platformapi/autonavi/autonavi.go | 11 +++++++++++ platformapi/autonavi/autonavi_test.go | 4 ++-- platformapi/jdshopapi/order_test.go | 9 +++------ platformapi/mtpsapi/mtpsapi.go | 8 ++++---- platformapi/unipushapi/unipushapi_test.go | 4 ++-- platformapi/weixinapi/cgibin_test.go | 2 +- 6 files changed, 23 insertions(+), 15 deletions(-) diff --git a/platformapi/autonavi/autonavi.go b/platformapi/autonavi/autonavi.go index 65894fd2..97d3df5c 100644 --- a/platformapi/autonavi/autonavi.go +++ b/platformapi/autonavi/autonavi.go @@ -504,6 +504,17 @@ func (a *API) GetCoordinateTownInfo(lng, lat float64) (townName, townCode string return townName, townCode } +func (a *API) GetCoordinateCityInfo(lng, lat float64) (cityName, cityCode string) { + result, err := a.GetCoordinateAreaInfo(lng, lat) + // baseapi.SugarLogger.Debug(utils.Format4Output(result, false)) + if err == nil { + addressComponent := result["regeocode"].(map[string]interface{})["addressComponent"].(map[string]interface{}) + cityName = utils.Interface2String(addressComponent["city"]) + cityCode = utils.Interface2String(addressComponent["citycode"]) + } + return cityName, cityCode +} + // 这里的District指的是地点,不是实际上的区,具体级别看level // 这个函数返回的可能不是同级别的地点 func (a *API) GetDistricts(subDistrict int, keywords string) (districtList []*District, err error) { diff --git a/platformapi/autonavi/autonavi_test.go b/platformapi/autonavi/autonavi_test.go index e9c2675c..11ab230d 100644 --- a/platformapi/autonavi/autonavi_test.go +++ b/platformapi/autonavi/autonavi_test.go @@ -85,7 +85,7 @@ func TestGetDistricts(t *testing.T) { } func TestGetCoordinateFromAddress(t *testing.T) { - lng, lat, districtCode := autonaviAPI.GetCoordinateFromAddress("四川成都市武侯区城区天府三街与云华路交汇处大有智慧2栋1单元1101号", "") + lng, lat, districtCode := autonaviAPI.GetCoordinateFromAddress("河北廊坊市三河市燕郊镇燕郊经济开发区迎宾北路燕京理工学院", "") t.Logf("lng:%f, lat:%f, districtCode:%d", lng, lat, districtCode) } @@ -151,7 +151,7 @@ func TestBatchWalkingDistance(t *testing.T) { } func TestAA(t *testing.T) { - result, err := autonaviAPI.GetCoordinateAreaInfo(123.450477, 41.737170) + result, err := autonaviAPI.GetCoordinateAreaInfo(118.932092, 32.112661) if err != nil { t.Fatal(err) } diff --git a/platformapi/jdshopapi/order_test.go b/platformapi/jdshopapi/order_test.go index c1ec31f2..db795da3 100644 --- a/platformapi/jdshopapi/order_test.go +++ b/platformapi/jdshopapi/order_test.go @@ -1,6 +1,7 @@ package jdshopapi import ( + "fmt" "testing" "git.rosy.net.cn/baseapi/utils" @@ -23,11 +24,7 @@ func TestGetDeliveryCompany(t *testing.T) { } func TestGetOrder(t *testing.T) { - // err := api.GetOrder(120146365818) - // if err != nil { - // t.Fatal(err) - // } - // t.Log(utils.Format4Output(result, false)) + fmt.Println(len("13153183146800000100")) } func TestVoucherInfoGet(t *testing.T) { @@ -47,7 +44,7 @@ func TestKeyGet(t *testing.T) { } func TestGetOrderExtInfoByOrderId(t *testing.T) { - result, err := api.GetOrderExtInfoByOrderId("130427633633") + result, err := api.GetOrderExtInfoByOrderId("127152338712") if err != nil { t.Fatal(err) } diff --git a/platformapi/mtpsapi/mtpsapi.go b/platformapi/mtpsapi/mtpsapi.go index 9c392ee9..b138c942 100644 --- a/platformapi/mtpsapi/mtpsapi.go +++ b/platformapi/mtpsapi/mtpsapi.go @@ -57,10 +57,10 @@ var ( ) const ( - DeliveryServiceCodeSuperRapid = 4002 // 飞速达 - DeliveryServiceCodeRapid = 4011 // 快速达 - DeliveryServiceCodeIntime = 4012 // 及时达 - DeliveryServiceCodeTogether = 4013 // 集中送 + DeliveryServiceCodeSuperRapid = 4002 // 飞速达 + DeliveryServiceCodeRapid = 10004 // 快速达 + DeliveryServiceCodeIntime = 4012 // 及时达 + DeliveryServiceCodeTogether = 4013 // 集中送 ) const ( diff --git a/platformapi/unipushapi/unipushapi_test.go b/platformapi/unipushapi/unipushapi_test.go index 0782f7dc..e04dcde6 100644 --- a/platformapi/unipushapi/unipushapi_test.go +++ b/platformapi/unipushapi/unipushapi_test.go @@ -18,7 +18,7 @@ func init() { sugarLogger = logger.Sugar() baseapi.Init(sugarLogger) api = New("5lyyrvHODG6wC8Sdr3a9h", "iFrkUDmR2g5eqQpfh2kQ57", "WTn53qd6WAAdLMXfmXvzb7", "dGZcR0XGGg7H5Pd7FR3n47") - api.CBSetToken("d6b5f133d8dbc7f2890bc500dee848f1ac191a32f2d2fba39b0dcb2e52aa4265") + api.CBSetToken("49f654af807d86b92059f01dea834f37cf2025b9853d4001406da091650e842e") // ef364b677911fa64d41a25d22d5e155065c4898046be65ddd627fa6c8cd87c2e } @@ -31,7 +31,7 @@ func TestCBRetrieveToken(t *testing.T) { } func TestPushToSingle(t *testing.T) { - result, err := api.PushToSingle("4fde99c9bd3d2ab317023f429f9ef62b", true, &Notification{ + result, err := api.PushToSingle("8aa96ba065a29a0135c5151819fb1666", false, &Notification{ Title: "测试", Body: "测测测", }) diff --git a/platformapi/weixinapi/cgibin_test.go b/platformapi/weixinapi/cgibin_test.go index 60d1179e..d664e020 100644 --- a/platformapi/weixinapi/cgibin_test.go +++ b/platformapi/weixinapi/cgibin_test.go @@ -44,7 +44,7 @@ func TestCBUpdateRemark(t *testing.T) { } func TestCBGetUserInfo(t *testing.T) { - userInfo, err := api.CBGetUserInfo("oYN_usnZ_ohyeJPKuBTEkIyZ7_uE") + userInfo, err := api.CBGetUserInfo("oYN_usv1RPvrSxCvo1WsbwI8lZa0") if err != nil { t.Fatal(err) }