美团配送,高德

This commit is contained in:
苏尹岚
2020-09-24 18:26:29 +08:00
parent b703b3fcd8
commit c2425f98cf
6 changed files with 23 additions and 15 deletions

View File

@@ -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) {

View File

@@ -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)
}

View File

@@ -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)
}

View File

@@ -57,10 +57,10 @@ var (
)
const (
DeliveryServiceCodeSuperRapid = 4002 // 飞速达
DeliveryServiceCodeRapid = 4011 // 快速达
DeliveryServiceCodeIntime = 4012 // 及时达
DeliveryServiceCodeTogether = 4013 // 集中送
DeliveryServiceCodeSuperRapid = 4002 // 飞速达
DeliveryServiceCodeRapid = 10004 // 快速达
DeliveryServiceCodeIntime = 4012 // 及时达
DeliveryServiceCodeTogether = 4013 // 集中送
)
const (

View File

@@ -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: "测测测",
})

View File

@@ -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)
}