美团配送,高德
This commit is contained in:
@@ -504,6 +504,17 @@ func (a *API) GetCoordinateTownInfo(lng, lat float64) (townName, townCode string
|
|||||||
return townName, townCode
|
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
|
// 这里的District指的是地点,不是实际上的区,具体级别看level
|
||||||
// 这个函数返回的可能不是同级别的地点
|
// 这个函数返回的可能不是同级别的地点
|
||||||
func (a *API) GetDistricts(subDistrict int, keywords string) (districtList []*District, err error) {
|
func (a *API) GetDistricts(subDistrict int, keywords string) (districtList []*District, err error) {
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ func TestGetDistricts(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestGetCoordinateFromAddress(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)
|
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) {
|
func TestAA(t *testing.T) {
|
||||||
result, err := autonaviAPI.GetCoordinateAreaInfo(123.450477, 41.737170)
|
result, err := autonaviAPI.GetCoordinateAreaInfo(118.932092, 32.112661)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package jdshopapi
|
package jdshopapi
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"git.rosy.net.cn/baseapi/utils"
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
@@ -23,11 +24,7 @@ func TestGetDeliveryCompany(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestGetOrder(t *testing.T) {
|
func TestGetOrder(t *testing.T) {
|
||||||
// err := api.GetOrder(120146365818)
|
fmt.Println(len("13153183146800000100"))
|
||||||
// if err != nil {
|
|
||||||
// t.Fatal(err)
|
|
||||||
// }
|
|
||||||
// t.Log(utils.Format4Output(result, false))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestVoucherInfoGet(t *testing.T) {
|
func TestVoucherInfoGet(t *testing.T) {
|
||||||
@@ -47,7 +44,7 @@ func TestKeyGet(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestGetOrderExtInfoByOrderId(t *testing.T) {
|
func TestGetOrderExtInfoByOrderId(t *testing.T) {
|
||||||
result, err := api.GetOrderExtInfoByOrderId("130427633633")
|
result, err := api.GetOrderExtInfoByOrderId("127152338712")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,10 +57,10 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
DeliveryServiceCodeSuperRapid = 4002 // 飞速达
|
DeliveryServiceCodeSuperRapid = 4002 // 飞速达
|
||||||
DeliveryServiceCodeRapid = 4011 // 快速达
|
DeliveryServiceCodeRapid = 10004 // 快速达
|
||||||
DeliveryServiceCodeIntime = 4012 // 及时达
|
DeliveryServiceCodeIntime = 4012 // 及时达
|
||||||
DeliveryServiceCodeTogether = 4013 // 集中送
|
DeliveryServiceCodeTogether = 4013 // 集中送
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ func init() {
|
|||||||
sugarLogger = logger.Sugar()
|
sugarLogger = logger.Sugar()
|
||||||
baseapi.Init(sugarLogger)
|
baseapi.Init(sugarLogger)
|
||||||
api = New("5lyyrvHODG6wC8Sdr3a9h", "iFrkUDmR2g5eqQpfh2kQ57", "WTn53qd6WAAdLMXfmXvzb7", "dGZcR0XGGg7H5Pd7FR3n47")
|
api = New("5lyyrvHODG6wC8Sdr3a9h", "iFrkUDmR2g5eqQpfh2kQ57", "WTn53qd6WAAdLMXfmXvzb7", "dGZcR0XGGg7H5Pd7FR3n47")
|
||||||
api.CBSetToken("d6b5f133d8dbc7f2890bc500dee848f1ac191a32f2d2fba39b0dcb2e52aa4265")
|
api.CBSetToken("49f654af807d86b92059f01dea834f37cf2025b9853d4001406da091650e842e")
|
||||||
// ef364b677911fa64d41a25d22d5e155065c4898046be65ddd627fa6c8cd87c2e
|
// ef364b677911fa64d41a25d22d5e155065c4898046be65ddd627fa6c8cd87c2e
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@ func TestCBRetrieveToken(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestPushToSingle(t *testing.T) {
|
func TestPushToSingle(t *testing.T) {
|
||||||
result, err := api.PushToSingle("4fde99c9bd3d2ab317023f429f9ef62b", true, &Notification{
|
result, err := api.PushToSingle("8aa96ba065a29a0135c5151819fb1666", false, &Notification{
|
||||||
Title: "测试",
|
Title: "测试",
|
||||||
Body: "测测测",
|
Body: "测测测",
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ func TestCBUpdateRemark(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestCBGetUserInfo(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 {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user