1
This commit is contained in:
@@ -40,7 +40,7 @@ func (a *API) GetCyclingPlan(origin, destination string) ([]string, int64, int64
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
distance = utils.Str2Int64(v.Distance)
|
distance = utils.Str2Int64(v.Distance)
|
||||||
duration = utils.Str2Int64(v.Duration) + 600
|
duration = utils.Str2Int64(v.Duration) + 300
|
||||||
}
|
}
|
||||||
|
|
||||||
return polyLineList, distance, duration, nil
|
return polyLineList, distance, duration, nil
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ package autonavi
|
|||||||
|
|
||||||
// 高德骑行计划账号配置
|
// 高德骑行计划账号配置
|
||||||
const (
|
const (
|
||||||
AMAPCyclingPlanKey1 = "e44ae2850c0ac930b65c9652d2db0321" // 高德地图 成都若溪科技有限公司 18048531223 Rosy201507
|
AMAPCyclingPlanKey1 = "cb4ea3516f88c0fd8fed73f92aeddffa" // 高德地图 成都京西到家网络科技有限公司 18080188338 Rosy201507
|
||||||
AMAPCyclingPlanKey2 = "e44ae2850c0ac930b65c9652d2db0321" // 高德地图 成都京西到家网络科技有限公司 18080188338 Rosy201507
|
AMAPCyclingPlanKey2 = "e44ae2850c0ac930b65c9652d2db0321" // 高德地图 成都若溪科技有限公司 18048531223 Rosy201507
|
||||||
AMAPCyclingPlanKey3 = "e44ae2850c0ac930b65c9652d2db0321" // 高德地图 冲天猴儿(成都)科技有限公司 19802843833 Rosy201507
|
AMAPCyclingPlanKey3 = "9805128688b11d011219e76e960e0feb" // 高德地图 冲天猴儿(成都)科技有限公司 19802843833 Rosy201507
|
||||||
AMAPCyclingPlanKey4 = "e44ae2850c0ac930b65c9652d2db0321" // 高德地图 京西(成都)科技有限公司 18884789801 Rosy201507
|
AMAPCyclingPlanKey4 = "727130840c0466c5a79494eca9b7cf98" // 高德地图 京西(成都)科技有限公司 18884789801 Rosy201507
|
||||||
AMAPCyclingPlanKey5 = "e44ae2850c0ac930b65c9652d2db0321" // 高德地图 京西菜市(北京)科技有限公司 17723303721 Rosy201507
|
AMAPCyclingPlanKey5 = "962667fb03713cf9bcfce849b4c2ece1" // 高德地图 京西菜市(北京)科技有限公司 17723303721 Rosy201507
|
||||||
)
|
)
|
||||||
|
|
||||||
// 错误码
|
// 错误码
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestGetCyclingPlan(t *testing.T) {
|
func TestGetCyclingPlan(t *testing.T) {
|
||||||
key := "e44ae2850c0ac930b65c9652d2db0321"
|
key := "cb4ea3516f88c0fd8fed73f92aeddffa"
|
||||||
a := New(key)
|
a := New(key)
|
||||||
data1, dada2, dada3, err := a.GetCyclingPlan("104.045460,30.693001", "104.045474,30.693344")
|
data1, dada2, dada3, err := a.GetCyclingPlan("104.045460,30.693001", "104.045474,30.693344")
|
||||||
fmt.Println(data1)
|
fmt.Println(data1)
|
||||||
|
|||||||
@@ -20,13 +20,13 @@ func init() {
|
|||||||
baseapi.Init(sugarLogger)
|
baseapi.Init(sugarLogger)
|
||||||
|
|
||||||
// 菜市
|
// 菜市
|
||||||
//api = New("589", "a81eb3df418d83d6a1a4b7c572156d2f", "", "")
|
api = New("589", "a81eb3df418d83d6a1a4b7c572156d2f", "", "")
|
||||||
|
|
||||||
// 果园
|
// 果园
|
||||||
//api = New("4123", "df2c88338b85f830cebce2a9eab56628", "", "")
|
//api = New("4123", "df2c88338b85f830cebce2a9eab56628", "", "")
|
||||||
|
|
||||||
//商超
|
//商超
|
||||||
api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_stuXR8Sf8XhvNz4f9A9Bxw") //token_n4TwqCntWWuvQwAawzxC0w
|
//api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_izAHEkoEl4lV-w4JdJFNww") //token_n4TwqCntWWuvQwAawzxC0w
|
||||||
//api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_r36FEse6_ywebQI65FNNWA") //token_n4TwqCntWWuvQwAawzxC0w
|
//api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_r36FEse6_ywebQI65FNNWA") //token_n4TwqCntWWuvQwAawzxC0w
|
||||||
cookieStr := `
|
cookieStr := `
|
||||||
acctId=57396785; token=0bWbK5VbK50E2BmIhIH2zHB-am_y7mB37yXHm6RLZWx4*; wmPoiId=-1;
|
acctId=57396785; token=0bWbK5VbK50E2BmIhIH2zHB-am_y7mB37yXHm6RLZWx4*; wmPoiId=-1;
|
||||||
|
|||||||
@@ -358,6 +358,17 @@ type RiderRealPhoneNumberInfo struct {
|
|||||||
RiderRealPhoneNumber string `json:"rider_real_phone_number"` // 骑手真实手机号
|
RiderRealPhoneNumber string `json:"rider_real_phone_number"` // 骑手真实手机号
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetRiderDeliveryPath 获取骑手坐标
|
||||||
|
type GetRiderDeliveryPath struct {
|
||||||
|
//Code int64 `json:"code"`
|
||||||
|
//Msg string `json:"msg"`
|
||||||
|
//Data []struct {
|
||||||
|
Longitude int `json:"longitude"`
|
||||||
|
Latitude int `json:"latitude"`
|
||||||
|
Time int64 `json:"time"`
|
||||||
|
//} `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
func (a *API) OrderReceived(orderID int64) (err error) {
|
func (a *API) OrderReceived(orderID int64) (err error) {
|
||||||
_, err = a.AccessAPI("order/poi_received", true, map[string]interface{}{
|
_, err = a.AccessAPI("order/poi_received", true, map[string]interface{}{
|
||||||
KeyOrderID: orderID,
|
KeyOrderID: orderID,
|
||||||
@@ -570,6 +581,27 @@ func (a *API) OrderLogisticsStatus(orderID int64) (status *utils.RiderInfo, err
|
|||||||
return logistics, err
|
return logistics, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *API) GetDeliveryPath(orderId int64, appPoiCode string) (lng, lat int, err error) {
|
||||||
|
result, err := a.AccessAPI("order/getDeliveryPath", true, map[string]interface{}{
|
||||||
|
KeyOrderID: orderId,
|
||||||
|
KeyAppPoiCode: appPoiCode,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return 0, 0, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if result == nil {
|
||||||
|
return 0, 0, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
path, _ := json.Marshal(result)
|
||||||
|
riderPath := make([]*GetRiderDeliveryPath, 0, 0)
|
||||||
|
if err := json.Unmarshal(path, &riderPath); err != nil {
|
||||||
|
return 0, 0, err
|
||||||
|
}
|
||||||
|
return riderPath[len(riderPath)-1].Longitude, riderPath[len(riderPath)-1].Latitude, nil
|
||||||
|
}
|
||||||
|
|
||||||
// OrderLogisticsFee 获取订单配送费
|
// OrderLogisticsFee 获取订单配送费
|
||||||
func (a *API) OrderLogisticsFee(orderID int64) (payFee float64, err error) {
|
func (a *API) OrderLogisticsFee(orderID int64) (payFee float64, err error) {
|
||||||
result, err := a.AccessAPI("order/logistics/status", true, map[string]interface{}{
|
result, err := a.AccessAPI("order/logistics/status", true, map[string]interface{}{
|
||||||
|
|||||||
@@ -87,6 +87,10 @@ func TestOrderLogisticsStatus(t *testing.T) {
|
|||||||
t.Log(utils.Format4Output(result, false))
|
t.Log(utils.Format4Output(result, false))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestGetDeliveryPath(t *testing.T) {
|
||||||
|
api.GetDeliveryPath(1000713330160837459, "7821254")
|
||||||
|
}
|
||||||
|
|
||||||
func TestOrderLogisticsFee(t *testing.T) {
|
func TestOrderLogisticsFee(t *testing.T) {
|
||||||
result, err := api.OrderLogisticsFee(1100709560902354698)
|
result, err := api.OrderLogisticsFee(1100709560902354698)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user